[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 1/6] kvm: promote KVM_MEMSLOT_INCOHERENT to uapi
From: |
Andrew Jones |
Subject: |
[Qemu-devel] [RFC PATCH 1/6] kvm: promote KVM_MEMSLOT_INCOHERENT to uapi |
Date: |
Fri, 6 Mar 2015 13:52:28 -0500 |
Signed-off-by: Andrew Jones <address@hidden>
---
arch/arm/kvm/mmu.c | 9 +++++++--
include/linux/kvm_host.h | 1 -
include/uapi/linux/kvm.h | 1 +
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index bcc1b3ad2adce..a806e8cecc01b 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -1260,7 +1260,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu,
phys_addr_t fault_ipa,
if (!hugetlb && !force_pte)
hugetlb = transparent_hugepage_adjust(&pfn, &fault_ipa);
- fault_ipa_uncached = memslot->flags & KVM_MEMSLOT_INCOHERENT;
+ fault_ipa_uncached = memslot->flags & KVM_MEM_INCOHERENT;
if (hugetlb) {
pmd_t new_pmd = pfn_pmd(pfn, mem_type);
@@ -1784,15 +1784,20 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct
kvm_memory_slot *free,
int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
unsigned long npages)
{
+#if 1
/*
* Readonly memslots are not incoherent with the caches by definition,
* but in practice, they are used mostly to emulate ROMs or NOR flashes
* that the guest may consider devices and hence map as uncached.
* To prevent incoherency issues in these cases, tag all readonly
* regions as incoherent.
+ *
+ * This heuristic can be removed after userspace has been updated to
+ * use KVM_MEM_INCOHERENT on readonly regions when necessary.
*/
if (slot->flags & KVM_MEM_READONLY)
- slot->flags |= KVM_MEMSLOT_INCOHERENT;
+ slot->flags |= KVM_MEM_INCOHERENT;
+#endif
return 0;
}
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 3b934cc94cc83..9dfb519c51e5b 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -43,7 +43,6 @@
* include/linux/kvm_h.
*/
#define KVM_MEMSLOT_INVALID (1UL << 16)
-#define KVM_MEMSLOT_INCOHERENT (1UL << 17)
/* Two fragments for cross MMIO pages. */
#define KVM_MAX_MMIO_FRAGMENTS 2
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index a37fd1224f363..f7f9432bcf485 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -108,6 +108,7 @@ struct kvm_userspace_memory_region {
*/
#define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0)
#define KVM_MEM_READONLY (1UL << 1)
+#define KVM_MEM_INCOHERENT (1UL << 2)
/* for KVM_IRQ_LINE */
struct kvm_irq_level {
--
1.8.3.1
- [Qemu-devel] the arm cache coherency cluster, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 0/6] flush/invalidate on entry/exit, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 2/6] KVM: Introduce incoherent cache maintenance API, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 3/6] KVM: ARM: change __coherent_cache_guest_page interface, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 5/6] KVM: ARM: implement kvm_*_incoherent_memory_regions, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 4/6] KVM: ARM: extend __coherent_cache_guest_page, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 6/6] KVM: ARM: no need for kvm_arch_flush_incoherent, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 1/6] kvm: promote KVM_MEMSLOT_INCOHERENT to uapi,
Andrew Jones <=
- [Qemu-devel] [RFC PATCH 0/6] support KVM_MEM_INCOHERENT, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 2/6] HACK: linux header update, Andrew Jones, 2015/03/06
- [Qemu-devel] [PATCH 3/6] kvm-all: put kvm_mem_flags to more work, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 4/6] kvm-all: set KVM_MEM_INCOHERENT, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 1/6] memory: add incoherent cache flag, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC PATCH 5/6] vga: flag vram as incoherent, Andrew Jones, 2015/03/06
- [Qemu-devel] [RFC/WIP PATCH 6/6] memory: add clear_cache_to_poc, Andrew Jones, 2015/03/06
- Re: [Qemu-devel] the arm cache coherency cluster, Andrew Jones, 2015/03/18