From: Amit Shah <amit.shah@qumranet.com>
To: kvm-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Cc: Amit Shah <amit.shah@qumranet.com>
Subject: [PATCH 5/8] KVM: PVDMA: Update dma_alloc_coherent to make it paravirt-aware
Date: Wed, 7 Nov 2007 16:21:06 +0200 [thread overview]
Message-ID: <1194445269469-git-send-email-amit.shah@qumranet.com> (raw)
Message-ID: <e2f5f0c08d08cf66a39c8b452410078617e611f7.1194445109.git.amit.shah@qumranet.com> (raw)
In-Reply-To: <1194445269859-git-send-email-amit.shah@qumranet.com>
In-Reply-To: <d1c72ce6e3a0e73c18993c3f066d1350b147f726.1194445109.git.amit.shah@qumranet.com>
Of all the DMA calls, only dma_alloc_coherent might not actually
call dma_ops->alloc_coherent. We make sure that gets called
if the device that's being worked on is a PV device
Signed-off-by: Amit Shah <amit.shah@qumranet.com>
---
arch/x86/kernel/pci-dma_64.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index aa805b1..d4b1713 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -11,6 +11,7 @@
#include <asm/io.h>
#include <asm/gart.h>
#include <asm/calgary.h>
+#include <linux/kvm_para.h>
int iommu_merge __read_mostly = 1;
EXPORT_SYMBOL(iommu_merge);
@@ -134,6 +135,18 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
memset(memory, 0, size);
if (!mmu) {
*dma_handle = virt_to_bus(memory);
+ if (unlikely(dma_ops->is_pv_device)
+ && unlikely(dma_ops->is_pv_device(dev, dev->bus_id))) {
+ void *r;
+ r = dma_ops->alloc_coherent(dev, size,
+ dma_handle,
+ gfp);
+ if (r == NULL) {
+ free_pages((unsigned long)memory,
+ get_order(size));
+ memory = NULL;
+ }
+ }
return memory;
}
}
--
1.5.3
next prev parent reply other threads:[~2007-11-07 14:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-07 14:21 RFC: Paravirtualized DMA accesses for KVM Amit Shah
[not found] ` <d1c72ce6e3a0e73c18993c3f066d1350b147f726.1194445109.git.amit.shah@qumranet.com>
2007-11-07 14:21 ` [PATCH 1/8] KVM: PVDMA Host: Handle reqeusts for guest DMA mappings Amit Shah
[not found] ` <6d486436cf50e269d8914229d10ff60f3d646795.1194445109.git.amit.shah@qumranet.com>
2007-11-07 14:21 ` [PATCH 2/8] KVM: Move #include asm/kvm_para.h outside of __KERNEL__ Amit Shah
[not found] ` <218cf425feff1d4daf23d3f25df1eb224108a1a3.1194445109.git.amit.shah@qumranet.com>
2007-11-07 14:21 ` [PATCH 4/8] KVM: PVDMA: Introduce is_pv_device() dma operation Amit Shah
2007-11-12 10:52 ` [kvm-devel] " Muli Ben-Yehuda
[not found] ` <6bbd61409e4779febab1eaf03796455b22e8ea70.1194445109.git.amit.shah@qumranet.com>
2007-11-07 14:21 ` [PATCH 6/8] KVM: PVDMA Guest: Add Makefile rule Amit Shah
[not found] ` <01dd7657bda537d738ea92330606592fa8aaf3c5.1194445109.git.amit.shah@qumranet.com>
2007-11-07 14:21 ` [PATCH 7/8] PVDMA: Guest: Add Kconfig options to select PVDMA Amit Shah
[not found] ` <fbc5dea9bfdb021ab2d3808583314901799405a0.1194445109.git.amit.shah@qumranet.com>
2007-11-07 14:21 ` [PATCH 8/8] KVM: Update drivers/Makefile to check for CONFIG_VIRTUALIZATION Amit Shah
[not found] ` <609d5d611a5fb58ab5a7184be7b6d29494023ba0.1194445109.git.amit.shah@qumranet.com>
2007-11-07 14:21 ` [PATCH 3/8] KVM: PVDMA Guest: Guest-side routines for paravirtualized DMA Amit Shah
2007-11-12 10:50 ` [kvm-devel] " Muli Ben-Yehuda
2007-11-12 11:56 ` Amit Shah
2007-11-12 13:32 ` Muli Ben-Yehuda
2007-11-12 13:55 ` Amit Shah
2007-11-12 14:01 ` Muli Ben-Yehuda
2007-11-12 14:53 ` Gerd Hoffmann
2007-11-12 16:00 ` Joerg Roedel
[not found] ` <e2f5f0c08d08cf66a39c8b452410078617e611f7.1194445109.git.amit.shah@qumranet.com>
2007-11-07 14:21 ` Amit Shah [this message]
2007-11-12 10:56 ` [kvm-devel] [PATCH 5/8] KVM: PVDMA: Update dma_alloc_coherent to make it paravirt-aware Muli Ben-Yehuda
2007-11-12 11:59 ` Amit Shah
2007-11-12 15:55 ` [kvm-devel] [PATCH 1/8] KVM: PVDMA Host: Handle reqeusts for guest DMA mappings Joerg Roedel
2007-11-12 17:07 ` Amit Shah
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=1194445269469-git-send-email-amit.shah@qumranet.com \
--to=amit.shah@qumranet.com \
--cc=kvm-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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