From: Joerg Roedel <joro@8bytes.org>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Ingo Molnar <mingo@elte.hu>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
the arch/x86 maintainers <x86@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Xen-devel <xen-devel@lists.xensource.com>,
Ian Campbell <ian.campbell@citrix.com>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Subject: Re: [PATCH 3/9] xen: add hooks for mapping phys<->bus addresses in swiotlb
Date: Mon, 11 May 2009 16:11:01 +0200 [thread overview]
Message-ID: <20090511141059.GB8671@8bytes.org> (raw)
In-Reply-To: <1241741842-7966-4-git-send-email-jeremy@goop.org>
On Thu, May 07, 2009 at 05:17:16PM -0700, Jeremy Fitzhardinge wrote:
> From: Ian Campbell <ian.campbell@citrix.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@citrix.com>
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> Reviewed-by: "H. Peter Anvin" <hpa@zytor.com>
> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Joerg Roedel <joerg.roedel@amd.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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2009-05-11 14:11 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-08 0:17 [GIT PULL] xen: swiotlb support for Xen dom0 Jeremy Fitzhardinge
2009-05-08 0:17 ` [PATCH 1/9] xen: make sure swiotlb allocation is physically contigious Jeremy Fitzhardinge
2009-05-08 7:47 ` [Xen-devel] [PATCH 1/9] xen: make sure swiotlb allocation isphysically contigious Jan Beulich
2009-05-08 15:51 ` Jeremy Fitzhardinge
2009-05-11 3:40 ` [PATCH 1/9] xen: make sure swiotlb allocation is physically contigious FUJITA Tomonori
2009-05-11 13:55 ` Joerg Roedel
2009-05-11 18:42 ` Jeremy Fitzhardinge
2009-05-08 0:17 ` [PATCH 2/9] xen swiotlb: fixup swiotlb is chunks smaller than MAX_CONTIG_ORDER Jeremy Fitzhardinge
2009-05-08 0:17 ` [PATCH 3/9] xen: add hooks for mapping phys<->bus addresses in swiotlb Jeremy Fitzhardinge
2009-05-11 3:40 ` FUJITA Tomonori
2009-05-11 14:11 ` Joerg Roedel [this message]
2009-05-08 0:17 ` [PATCH 4/9] xen/swiotlb: add swiotlb_arch_range_needs_mapping hook for xen Jeremy Fitzhardinge
2009-05-11 3:40 ` FUJITA Tomonori
2009-05-11 14:16 ` Joerg Roedel
2009-05-08 0:17 ` [PATCH 5/9] xen: enable swiotlb for xen domain 0 Jeremy Fitzhardinge
2009-05-11 3:40 ` FUJITA Tomonori
2009-05-11 14:21 ` Joerg Roedel
2009-05-08 0:17 ` [PATCH 6/9] swiotlb: use swiotlb_alloc_boot to allocate emergency pool Jeremy Fitzhardinge
2009-05-08 0:17 ` [PATCH 7/9] xen/swiotlb: improve comment on gfp flags in xen_alloc_coherent() Jeremy Fitzhardinge
2009-05-08 0:17 ` [PATCH 8/9] xen/swiotlb: add sync functions Jeremy Fitzhardinge
2009-05-08 0:17 ` [PATCH 9/9] xen/swiotlb: update to new new dma_ops Jeremy Fitzhardinge
2009-05-08 11:19 ` [GIT PULL] xen: swiotlb support for Xen dom0 Ingo Molnar
2009-05-11 3:40 ` FUJITA Tomonori
2009-05-11 16:59 ` Jeremy Fitzhardinge
2009-05-11 22:45 ` FUJITA Tomonori
2009-05-11 13:04 ` Ingo Molnar
2009-05-11 16:57 ` Jeremy Fitzhardinge
-- strict thread matches above, loose matches on Subject: below --
2009-03-31 22:52 [PATCH] swiotlb updates " Jeremy Fitzhardinge
2009-03-31 22:52 ` [PATCH 3/9] xen: add hooks for mapping phys<->bus addresses in swiotlb Jeremy Fitzhardinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090511141059.GB8671@8bytes.org \
--to=joro@8bytes.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=ian.campbell@citrix.com \
--cc=jeremy.fitzhardinge@citrix.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox