[PATCH] mm: sparse: Skip no-map regions in memblocks_present

2019-07-12 Thread KarimAllah Ahmed
: linux...@kvack.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed --- mm/sparse.c | 4 1 file changed, 4 insertions(+) diff --git a/mm/sparse.c b/mm/sparse.c index fd13166..33810b6 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -256,6 +256,10 @@ void __init memblocks_present

[PATCH] fdt: Properly handle "no-map" field in the memory region

2019-07-12 Thread KarimAllah Ahmed
Mark the memory region with NOMAP flag instead of completely removing it from the memory blocks. That makes the FDT handling consistent with the EFI memory map handling. Cc: Rob Herring Cc: Frank Rowand Cc: devicet...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah

[PATCH] arm: Extend the check for RAM in /dev/mem

2019-07-11 Thread KarimAllah Ahmed
poport Cc: Andrew Morton Cc: Anders Roxell Cc: Enrico Weigelt Cc: Thomas Gleixner Cc: KarimAllah Ahmed Cc: Mark Rutland Cc: James Morse Cc: Anshuman Khandual Cc: Jun Yao Cc: Yu Zhao Cc: Robin Murphy Cc: Ard Biesheuvel Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.

[PATCH v6 03/14] X86/KVM: Handle PFNs outside of kernel reach when touching GPTEs

2019-01-31 Thread KarimAllah Ahmed
space with memremap(). Signed-off-by: Filippo Sironi Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/paging_tmpl.h | 38 +- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 6bdca39..c40a

[PATCH v6 01/14] X86/nVMX: handle_vmon: Read 4 bytes from guest memory

2019-01-31 Thread KarimAllah Ahmed
Read the data directly from guest memory instead of the map->read->unmap sequence. This also avoids using kvm_vcpu_gpa_to_page() and kmap() which assumes that there is a "struct page" for guest memory. Suggested-by: Jim Mattson Signed-off-by: KarimAllah Ahmed Reviewed-by: Jim M

[PATCH v6 08/14] KVM/nVMX: Use kvm_vcpu_map when mapping the posted interrupt descriptor table

2019-01-31 Thread KarimAllah Ahmed
ifetime of the pinning of the interrupt descriptor table page on the host side. Signed-off-by: KarimAllah Ahmed Reviewed-by: Konrad Rzeszutek Wilk --- v4 -> v5: - unmap with dirty flag v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) --- arch/x86/kvm/v

[PATCH v6 04/14] KVM: Introduce a new guest mapping API

2019-01-31 Thread KarimAllah Ahmed
ove the performance of the memremap case. Signed-off-by: KarimAllah Ahmed Reviewed-by: Konrad Rzeszutek Wilk --- v5 -> v6: - Added a helper function to check if the mapping is mapped or not. - Added more comments on the struct. - Setting ->page to NULL on unmap and to a poison ptr if un

[PATCH v6 06/14] KVM/nVMX: Use kvm_vcpu_map when mapping the L1 MSR bitmap

2019-01-31 Thread KarimAllah Ahmed
Use kvm_vcpu_map when mapping the L1 MSR bitmap since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v4 -> v5: - unmap with dirty flag v1 -> v2: - Do not change the lifecycle of the m

[PATCH v6 10/14] KVM/nSVM: Use the new mapping API for mapping guest memory

2019-01-31 Thread KarimAllah Ahmed
Use the new mapping API for mapping guest memory to avoid depending on "struct page". Signed-off-by: KarimAllah Ahmed Reviewed-by: Konrad Rzeszutek Wilk --- v4 -> v5: - unmap with dirty flag --- arch/x86/kvm/svm.c | 97 +++--- 1 fil

[PATCH v6 11/14] KVM/nVMX: Use kvm_vcpu_map for accessing the shadow VMCS

2019-01-31 Thread KarimAllah Ahmed
Use kvm_vcpu_map for accessing the shadow VMCS since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed Reviewed-by: Konrad Rzessutek Wilk --- v4 -> v5: - unmap with dirty flag --- arch/x86/kvm/vmx/

[PATCH v6 13/14] KVM/nVMX: Use page_address_valid in a few more locations

2019-01-31 Thread KarimAllah Ahmed
Use page_address_valid in a few more locations that is already checking for a page aligned address that does not cross the maximum physical address. Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/vmx/nested.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86

[PATCH v6 14/14] kvm, x86: Properly check whether a pfn is an MMIO or not

2019-01-31 Thread KarimAllah Ahmed
ed to the guest no matter what the guest caching attributes are for this memory. Introduce a new function e820__mapped_raw_any which is equivalent to e820__mapped_any but uses the original e820 unmodified and use it to identify real *RAM*. Signed-off-by: KarimAllah Ahmed --- v1 -&g

[PATCH v6 09/14] KVM/X86: Use kvm_vcpu_map in emulator_cmpxchg_emulated

2019-01-31 Thread KarimAllah Ahmed
Use kvm_vcpu_map in emulator_cmpxchg_emulated since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed Reviewed-by: Konrad Rzeszutek Wilk --- v5 -> v6: - Remove explicit call to dirty the page. It i

[PATCH v6 12/14] KVM/nVMX: Use kvm_vcpu_map for accessing the enlightened VMCS

2019-01-31 Thread KarimAllah Ahmed
Use kvm_vcpu_map for accessing the enlightened VMCS since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed Reviewed-by: Konrad Rzeszutek Wilk --- v4 -> v5: - s/enhanced/enlightened - unmap with dirty f

[PATCH v6 05/14] X86/nVMX: handle_vmptrld: Use kvm_vcpu_map when copying VMCS12 from guest memory

2019-01-31 Thread KarimAllah Ahmed
Use kvm_vcpu_map to the map the VMCS12 from guest memory because kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed Reviewed-by: Konrad Rzeszutek Wilk --- v4 -> v5: - Switch to the new guest mapping API inste

[PATCH v6 07/14] KVM/nVMX: Use kvm_vcpu_map when mapping the virtual APIC page

2019-01-31 Thread KarimAllah Ahmed
pinning of the virtual APIC page on the host side. Signed-off-by: KarimAllah Ahmed Reviewed-by: Konrad Rzeszutek Wilk --- v4 -> v5: - unmap with dirty flag v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) - Use pfn_to_hpa instead of gfn_to_gpa --- arch/x86/kvm/v

[PATCH v6 00/14] KVM/X86: Introduce a new guest mapping interface

2019-01-31 Thread KarimAllah Ahmed
. - Added a new trivial cleanup patch. v3 -> v4: - Rebase - Add a new patch to also fix the newly introduced enlightned VMCS. v2 -> v3: - Rebase - Add a new patch to also fix the newly introduced shadow VMCS. Filippo Sironi (1): X86/KVM: Handle PFNs outside of kernel reach when touchi

[PATCH v6 02/14] X86/nVMX: Update the PML table without mapping and unmapping the page

2019-01-31 Thread KarimAllah Ahmed
Update the PML table without mapping and unmapping the page. This also avoids using kvm_vcpu_gpa_to_page(..) which assumes that there is a "struct page" for guest memory. As a side-effect of using kvm_write_guest_page the page is also properly marked as dirty. Signed-off-by: KarimA

[PATCH v5 01/13] X86/nVMX: handle_vmon: Read 4 bytes from guest memory

2019-01-09 Thread KarimAllah Ahmed
Read the data directly from guest memory instead of the map->read->unmap sequence. This also avoids using kvm_vcpu_gpa_to_page() and kmap() which assumes that there is a "struct page" for guest memory. Suggested-by: Jim Mattson Signed-off-by: KarimAllah Ahmed Reviewed-by: Jim M

[PATCH v5 00/13] KVM/X86: Introduce a new guest mapping interface

2019-01-09 Thread KarimAllah Ahmed
lready as a side-effect of another patch. - Added a new trivial cleanup patch. v3 -> v4: - Rebase - Add a new patch to also fix the newly introduced enlightned VMCS. v2 -> v3: - Rebase - Add a new patch to also fix the newly introduced shadow VMCS. Filippo Sironi (1): X86/KVM: Handle

[PATCH v5 12/13] KVM/nVMX: Use kvm_vcpu_map for accessing the enlightened VMCS

2019-01-09 Thread KarimAllah Ahmed
Use kvm_vcpu_map for accessing the enhanced VMCS since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v4 -> v5: - s/enhanced/enlightened - unmap with dirty flag --- arch/x86/kvm/vmx/

[PATCH v5 08/13] KVM/nVMX: Use kvm_vcpu_map when mapping the posted interrupt descriptor table

2019-01-09 Thread KarimAllah Ahmed
ifetime of the pinning of the interrupt descriptor table page on the host side. Signed-off-by: KarimAllah Ahmed --- v4 -> v5: - unmap with dirty flag v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) --- arch/x86/kvm/vmx/nested.c | 43 -

[PATCH v5 09/13] KVM/X86: Use kvm_vcpu_map in emulator_cmpxchg_emulated

2019-01-09 Thread KarimAllah Ahmed
Use kvm_vcpu_map in emulator_cmpxchg_emulated since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v4 -> v5: - unmap with dirty flag v1 -> v2: - Update to match the new API return codes ---

[PATCH v5 02/13] X86/nVMX: Update the PML table without mapping and unmapping the page

2019-01-09 Thread KarimAllah Ahmed
Update the PML table without mapping and unmapping the page. This also avoids using kvm_vcpu_gpa_to_page(..) which assumes that there is a "struct page" for guest memory. As a side-effect of using kvm_write_guest_page the page is also properly marked as dirty. Signed-off-by: KarimA

[PATCH v5 07/13] KVM/nVMX: Use kvm_vcpu_map when mapping the virtual APIC page

2019-01-09 Thread KarimAllah Ahmed
pinning of the virtual APIC page on the host side. Signed-off-by: KarimAllah Ahmed --- v4 -> v5: - unmap with dirty flag v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) - Use pfn_to_hpa instead of gfn_to_gpa --- arch/x86/kvm/vmx/nested.c | 32 +++---

[PATCH v5 11/13] KVM/nVMX: Use kvm_vcpu_map for accessing the shadow VMCS

2019-01-09 Thread KarimAllah Ahmed
Use kvm_vcpu_map for accessing the shadow VMCS since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v4 -> v5: - unmap with dirty flag --- arch/x86/kvm/vmx/nested.c | 25

[PATCH v5 10/13] KVM/nSVM: Use the new mapping API for mapping guest memory

2019-01-09 Thread KarimAllah Ahmed
Use the new mapping API for mapping guest memory to avoid depending on "struct page". Signed-off-by: KarimAllah Ahmed --- v4 -> v5: - unmap with dirty flag --- arch/x86/kvm/svm.c | 97 +++--- 1 file changed, 49 insertions(+), 48 delet

[PATCH v5 06/13] KVM/nVMX: Use kvm_vcpu_map when mapping the L1 MSR bitmap

2019-01-09 Thread KarimAllah Ahmed
Use kvm_vcpu_map when mapping the L1 MSR bitmap since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v4 -> v5: - unmap with dirty flag v1 -> v2: - Do not change the lifecycle of the m

[PATCH v5 04/13] KVM: Introduce a new guest mapping API

2019-01-09 Thread KarimAllah Ahmed
ove the performance of the memremap case. Signed-off-by: KarimAllah Ahmed --- v3 -> v4: - Update the commit message. v1 -> v2: - Drop the caching optimization (pbonzini) - Use 'hva' instead of 'kaddr' (pbonzini) - Return 0/-EINVAL/-EFAULT instead of true/false. -EFAULT will

[PATCH v5 03/13] X86/KVM: Handle PFNs outside of kernel reach when touching GPTEs

2019-01-09 Thread KarimAllah Ahmed
space with memremap(). Signed-off-by: Filippo Sironi Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/paging_tmpl.h | 38 +- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 6bdca39..c40a

[PATCH v5 13/13] KVM/nVMX: Use page_address_valid in a few more locations

2019-01-09 Thread KarimAllah Ahmed
Use page_address_valid in a few more locations that is already checking for a page aligned address that does not cross the maximum physical address. Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/vmx/nested.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86

[PATCH v5 05/13] X86/nVMX: handle_vmptrld: Use kvm_vcpu_map when copying VMCS12 from guest memory

2019-01-09 Thread KarimAllah Ahmed
Use kvm_vcpu_map to the map the VMCS12 from guest memory because kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v4 -> v5: - Switch to the new guest mapping API instead of reading directly from guest.

[PATCH] KVM/nVMX: Stop mapping the "APIC-access address" page into the kernel

2018-12-03 Thread KarimAllah Ahmed
APIC-access address" page into the kernel and even drop the requirements to have a valid page backing it. Instead, just use some token that: 1) Not one of the valid guest pages. 2) Within the physical address supported by the CPU. Suggested-by: Jim Mattson Signed-off-by: KarimAllah Ah

[PATCH v4 05/14] KVM: Introduce a new guest mapping API

2018-12-03 Thread KarimAllah Ahmed
ove the performance of the memremap case. Signed-off-by: KarimAllah Ahmed --- v3 -> v4: - Update the commit message. v1 -> v2: - Drop the caching optimization (pbonzini) - Use 'hva' instead of 'kaddr' (pbonzini) - Return 0/-EINVAL/-EFAULT instead of true/false. -EFAULT will

[PATCH v4 00/14] KVM/X86: Introduce a new guest mapping interface

2018-12-03 Thread KarimAllah Ahmed
a new patch to also fix the newly introduced enhanced VMCS. v2 -> v3: - Rebase - Add a new patch to also fix the newly introduced shadow VMCS. Filippo Sironi (1): X86/KVM: Handle PFNs outside of kernel reach when touching GPTEs KarimAllah Ahmed (13): X86/nVMX: handle_vmon: Read 4 b

[PATCH v4 13/14] KVM/nVMX: Use kvm_vcpu_map for accessing the shadow VMCS

2018-12-03 Thread KarimAllah Ahmed
Use kvm_vcpu_map for accessing the shadow VMCS since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/vmx.c | 25 - 1 file changed, 12 insertions(+), 13 deletion

[PATCH v4 07/14] KVM/nVMX: Use kvm_vcpu_map when mapping the virtual APIC page

2018-12-03 Thread KarimAllah Ahmed
pinning of the virtual APIC page on the host side. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) - Use pfn_to_hpa instead of gfn_to_gpa --- arch/x86/kvm/vmx.c | 39 +-- 1 file changed, 13 insertions(+),

[PATCH v4 08/14] KVM/nVMX: Use kvm_vcpu_map when mapping the posted interrupt descriptor table

2018-12-03 Thread KarimAllah Ahmed
ifetime of the pinning of the interrupt descriptor table page on the host side. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) --- arch/x86/kvm/vmx.c | 45 +++-- 1 file changed, 15 insertions(+),

[PATCH v4 04/14] X86/KVM: Handle PFNs outside of kernel reach when touching GPTEs

2018-12-03 Thread KarimAllah Ahmed
space with memremap(). Signed-off-by: Filippo Sironi Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/paging_tmpl.h | 38 +- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 7cf2185..b953

[PATCH v4 09/14] KVM/X86: Use kvm_vcpu_map in emulator_cmpxchg_emulated

2018-12-03 Thread KarimAllah Ahmed
Use kvm_vcpu_map in emulator_cmpxchg_emulated since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Update to match the new API return codes --- arch/x86/kvm/x86.c | 13 ++--

[PATCH v4 10/14] KVM/X86: hyperv: Use kvm_vcpu_map in synic_clear_sint_msg_pending

2018-12-03 Thread KarimAllah Ahmed
Use kvm_vcpu_map in synic_clear_sint_msg_pending since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Update to match the new API return codes --- arch/x86/kvm/hyperv.c | 16 ++

[PATCH v4 11/14] KVM/X86: hyperv: Use kvm_vcpu_map in synic_deliver_msg

2018-12-03 Thread KarimAllah Ahmed
Use kvm_vcpu_map in synic_deliver_msg since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Update to match the new API return codes --- arch/x86/kvm/hyperv.c | 12 ++-- 1 fi

[PATCH v4 14/14] KVM/nVMX: Use kvm_vcpu_map for accessing the enhanced VMCS

2018-12-03 Thread KarimAllah Ahmed
Use kvm_vcpu_map for accessing the enhanced VMCS since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/vmx.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) di

[PATCH v4 12/14] KVM/nSVM: Use the new mapping API for mapping guest memory

2018-12-03 Thread KarimAllah Ahmed
Use the new mapping API for mapping guest memory to avoid depending on "struct page". Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/svm.c | 97 +++--- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/arch/x86/kvm/svm.c

[PATCH v4 01/14] X86/nVMX: handle_vmon: Read 4 bytes from guest memory

2018-12-03 Thread KarimAllah Ahmed
Read the data directly from guest memory instead of the map->read->unmap sequence. This also avoids using kvm_vcpu_gpa_to_page() and kmap() which assumes that there is a "struct page" for guest memory. Suggested-by: Jim Mattson Signed-off-by: KarimAllah Ahmed Reviewed-by: Jim

[PATCH v4 06/14] KVM/nVMX: Use kvm_vcpu_map when mapping the L1 MSR bitmap

2018-12-03 Thread KarimAllah Ahmed
Use kvm_vcpu_map when mapping the L1 MSR bitmap since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) --- arch/x86/k

[PATCH v4 02/14] X86/nVMX: handle_vmptrld: Copy the VMCS12 directly from guest memory

2018-12-03 Thread KarimAllah Ahmed
Copy the VMCS12 directly from guest memory instead of the map->copy->unmap sequence. This also avoids using kvm_vcpu_gpa_to_page() and kmap() which assumes that there is a "struct page" for guest memory. Signed-off-by: KarimAllah Ahmed --- v3

[PATCH v4 03/14] X86/nVMX: Update the PML table without mapping and unmapping the page

2018-12-03 Thread KarimAllah Ahmed
Update the PML table without mapping and unmapping the page. This also avoids using kvm_vcpu_gpa_to_page(..) which assumes that there is a "struct page" for guest memory. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Use kvm_write_guest_page instead of kvm_write_guest (pbonzini)

[RESEND PATCH v3 07/13] KVM/nVMX: Use kvm_vcpu_map when mapping the virtual APIC page

2018-10-21 Thread KarimAllah Ahmed
pinning of the virtual APIC page on the host side. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) - Use pfn_to_hpa instead of gfn_to_gpa --- arch/x86/kvm/vmx.c | 39 +-- 1 file changed, 13 insertions(+),

[PATCH v2] KVM/nVMX: Do not validate that posted_intr_desc_addr is page aligned

2018-10-20 Thread KarimAllah Ahmed
k posted-interrupt descriptor addresss on vmentry of L2") Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 38f1a16..bb0fcdb 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/

[PATCH v3 06/13] KVM/nVMX: Use kvm_vcpu_map when mapping the L1 MSR bitmap

2018-10-20 Thread KarimAllah Ahmed
Use kvm_vcpu_map when mapping the L1 MSR bitmap since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) --- arch/x86/k

[PATCH v3 01/13] X86/nVMX: handle_vmon: Read 4 bytes from guest memory

2018-10-20 Thread KarimAllah Ahmed
Read the data directly from guest memory instead of the map->read->unmap sequence. This also avoids using kvm_vcpu_gpa_to_page() and kmap() which assumes that there is a "struct page" for guest memory. Suggested-by: Jim Mattson Signed-off-by: KarimAllah Ahmed --- v1 -> v

[PATCH v3 05/13] KVM: Introduce a new guest mapping API

2018-10-20 Thread KarimAllah Ahmed
apping operations. But rather for low-frequency mappings. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Drop the caching optimization (pbonzini) - Use 'hva' instead of 'kaddr' (pbonzini) - Return 0/-EINVAL/-EFAULT instead of true/false. -EFAULT will be used for AMD patch

[PATCH v3 03/13] X86/nVMX: Update the PML table without mapping and unmapping the page

2018-10-20 Thread KarimAllah Ahmed
Update the PML table without mapping and unmapping the page. This also avoids using kvm_vcpu_gpa_to_page(..) which assumes that there is a "struct page" for guest memory. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Use kvm_write_guest_page instead of kvm_write_guest (pbonzini)

[PATCH v3 11/13] KVM/X86: hyperv: Use kvm_vcpu_map in synic_deliver_msg

2018-10-20 Thread KarimAllah Ahmed
Use kvm_vcpu_map in synic_deliver_msg since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Update to match the new API return codes --- arch/x86/kvm/hyperv.c | 12 ++-- 1 fi

[PATCH v3 10/13] KVM/X86: hyperv: Use kvm_vcpu_map in synic_clear_sint_msg_pending

2018-10-20 Thread KarimAllah Ahmed
Use kvm_vcpu_map in synic_clear_sint_msg_pending since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Update to match the new API return codes --- arch/x86/kvm/hyperv.c | 16 ++

[PATCH v3 07/13] KVM/nVMX: Use kvm_vcpu_map when mapping the virtual APIC page

2018-10-20 Thread KarimAllah Ahmed
pinning of the virtual APIC page on the host side. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) - Use pfn_to_hpa instead of gfn_to_gpa --- arch/x86/kvm/vmx.c | 34 +++--- 1 file changed, 11 insertions(+),

[PATCH v3 09/13] KVM/X86: Use kvm_vcpu_map in emulator_cmpxchg_emulated

2018-10-20 Thread KarimAllah Ahmed
Use kvm_vcpu_map in emulator_cmpxchg_emulated since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Update to match the new API return codes --- arch/x86/kvm/x86.c | 13 ++--

[PATCH v3 00/13] KVM/X86: Introduce a new guest mapping interface

2018-10-20 Thread KarimAllah Ahmed
ntroducing shadow VMCS support for nested. Filippo Sironi (1): X86/KVM: Handle PFNs outside of kernel reach when touching GPTEs KarimAllah Ahmed (12): X86/nVMX: handle_vmon: Read 4 bytes from guest memory X86/nVMX: handle_vmptrld: Copy the VMCS12 directly from guest memory X86/nVMX: Update

[PATCH v3 13/13] KVM/nVMX: Use kvm_vcpu_map for accessing the shadow VMCS

2018-10-20 Thread KarimAllah Ahmed
Use kvm_vcpu_map for accessing the shadow VMCS since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/vmx.c | 25 - 1 file changed, 12 insertions(+), 13 deletion

[PATCH v3 12/13] KVM/nSVM: Use the new mapping API for mapping guest memory

2018-10-20 Thread KarimAllah Ahmed
Use the new mapping API for mapping guest memory to avoid depending on "struct page". Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/svm.c | 97 +++--- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/arch/x86/kvm/svm.c

[PATCH v3 02/13] X86/nVMX: handle_vmptrld: Copy the VMCS12 directly from guest memory

2018-10-20 Thread KarimAllah Ahmed
Copy the VMCS12 directly from guest memory instead of the map->copy->unmap sequence. This also avoids using kvm_vcpu_gpa_to_page() and kmap() which assumes that there is a "struct page" for guest memory. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Massage commit message a

[PATCH v3 08/13] KVM/nVMX: Use kvm_vcpu_map when mapping the posted interrupt descriptor table

2018-10-20 Thread KarimAllah Ahmed
ifetime of the pinning of the interrupt descriptor table page on the host side. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) --- arch/x86/kvm/vmx.c | 45 +++-- 1 file changed, 15 insertions(+),

[PATCH v3 04/13] X86/KVM: Handle PFNs outside of kernel reach when touching GPTEs

2018-10-20 Thread KarimAllah Ahmed
space with memremap(). Signed-off-by: Filippo Sironi Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/paging_tmpl.h | 38 +- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 14ffd97..8f7b

[PATCH] KVM/nVMX: Do not validate that posted_intr_desc_addr is page aligned

2018-10-20 Thread KarimAllah Ahmed
ned-off-by: KarimAllah Ahmed --- arch/x86/kvm/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 30bf860..47962f2 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -11668,7 +11668,7 @@ static int nested_vmx_check_apicv_contr

[PATCH] rcu: Benefit from expedited grace period in __wait_rcu_gp

2018-10-18 Thread KarimAllah Ahmed
when an expedited grace-period is set, however, given the improved latency it does not really matter. Cc: Paul E. McKenney Cc: Josh Triplett Cc: Steven Rostedt Cc: Mathieu Desnoyers Cc: Lai Jiangshan Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed --- kernel/rcu/update.c | 34

[PATCH v2] PCI/IOV: Use VF0 cached config space size for other VFs

2018-10-10 Thread KarimAllah Ahmed
-...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Drop the __pci_cfg_space_size (bhelgaas@) - Extend pci_cfg_space_size to return the cached value for all VFs except VF0 (bhelgaas@) --- drivers/pci/iov.c | 2 ++ drivers/pci/pci.h | 1 + drivers/

[PATCH v5 2/2] kvm: nVMX: Introduce KVM_CAP_NESTED_STATE

2018-07-10 Thread KarimAllah Ahmed
nested.smm state. - rebase & a bit of refactoring. - Merge 7/8 and 8/8 into one patch. ] Signed-off-by: KarimAllah Ahmed --- v4 -> v5: - Drop the update to KVM_REQUEST_ARCH_BASE in favor of a patch to switch to u64 instead. - Fix commit message. - Handle nested.smm state

[PATCH v5 1/2] KVM: Switch 'requests' to be 64-bit (explicitly)

2018-07-10 Thread KarimAllah Ahmed
k. The only exception here is ARM32 as it is still 32-bits. Cc: Paolo Bonzini Cc: Radim Krčmář Cc: k...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Jim Mattson Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Use FIELD_SIZEOF --- include/linux/kvm_host.h | 10 +- 1

[PATCH] x86/headers/UAPI: Move DISABLE_EXITS KVM capability bits to the UAPI

2018-04-16 Thread KarimAllah Ahmed
Move DISABLE_EXITS KVM capability bits to the UAPI just like the rest of capabilities. Cc: Paolo Bonzini Cc: Radim Krčmář Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Cc: x...@kernel.org Cc: k...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed

[PATCH v2 06/12] KVM/nVMX: Use kvm_vcpu_map when mapping the L1 MSR bitmap

2018-04-15 Thread KarimAllah Ahmed
Use kvm_vcpu_map when mapping the L1 MSR bitmap since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) --- arch/x86/k

[PATCH v2 07/12] KVM/nVMX: Use kvm_vcpu_map when mapping the virtual APIC page

2018-04-15 Thread KarimAllah Ahmed
pinning of the virtual APIC page on the host side. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) - Use pfn_to_hpa instead of gfn_to_gpa --- arch/x86/kvm/vmx.c | 34 +++--- 1 file changed, 11 insertions(+),

[PATCH v2 02/12] X86/nVMX: handle_vmptrld: Copy the VMCS12 directly from guest memory

2018-04-15 Thread KarimAllah Ahmed
Copy the VMCS12 directly from guest memory instead of the map->copy->unmap sequence. This also avoids using kvm_vcpu_gpa_to_page() and kmap() which assumes that there is a "struct page" for guest memory. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Massage commit message a

[PATCH v2 03/12] X86/nVMX: Update the PML table without mapping and unmapping the page

2018-04-15 Thread KarimAllah Ahmed
Update the PML table without mapping and unmapping the page. This also avoids using kvm_vcpu_gpa_to_page(..) which assumes that there is a "struct page" for guest memory. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Use kvm_write_guest_page instead of kvm_write_guest (pbonzini)

[PATCH v2 09/12] KVM/X86: Use kvm_vcpu_map in emulator_cmpxchg_emulated

2018-04-15 Thread KarimAllah Ahmed
Use kvm_vcpu_map in emulator_cmpxchg_emulated since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Update to match the new API return codes --- arch/x86/kvm/x86.c | 13 ++--

[PATCH v2 08/12] KVM/nVMX: Use kvm_vcpu_map when mapping the posted interrupt descriptor table

2018-04-15 Thread KarimAllah Ahmed
ifetime of the pinning of the interrupt descriptor table page on the host side. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Do not change the lifecycle of the mapping (pbonzini) --- arch/x86/kvm/vmx.c | 45 +++-- 1 file changed, 15 insertions(+),

[PATCH v2 05/12] KVM: Introduce a new guest mapping API

2018-04-15 Thread KarimAllah Ahmed
apping operations. But rather for low-frequency mappings. Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Drop the caching optimization (pbonzini) - Use 'hva' instead of 'kaddr' (pbonzini) - Return 0/-EINVAL/-EFAULT instead of true/false. -EFAULT will be used for AMD patch

[PATCH v2 11/12] KVM/X86: hyperv: Use kvm_vcpu_map in synic_deliver_msg

2018-04-15 Thread KarimAllah Ahmed
Use kvm_vcpu_map in synic_deliver_msg since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Update to match the new API return codes --- arch/x86/kvm/hyperv.c | 12 ++-- 1 fi

[PATCH v2 01/12] X86/nVMX: handle_vmon: Read 4 bytes from guest memory

2018-04-15 Thread KarimAllah Ahmed
Read the data directly from guest memory instead instead of the map->read->unmap sequence. This also avoids using kvm_vcpu_gpa_to_page() and kmap() which assumes that there is a "struct page" for guest memory. Suggested-by: Jim Mattson Signed-off-by: KarimAllah Ahmed --- v1

[PATCH v2 10/12] KVM/X86: hyperv: Use kvm_vcpu_map in synic_clear_sint_msg_pending

2018-04-15 Thread KarimAllah Ahmed
Use kvm_vcpu_map in synic_clear_sint_msg_pending since using kvm_vcpu_gpa_to_page() and kmap() will only work for guest memory that has a "struct page". Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Update to match the new API return codes --- arch/x86/kvm/hyperv.c | 16 ++

[PATCH v2 04/12] X86/KVM: Handle PFNs outside of kernel reach when touching GPTEs

2018-04-15 Thread KarimAllah Ahmed
space with memremap(). Signed-off-by: Filippo Sironi Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/paging_tmpl.h | 38 +- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 6288e9d..31a3

[PATCH v2 12/12] KVM/nSVM: Use the new mapping API for mapping guest memory

2018-04-15 Thread KarimAllah Ahmed
Use the new mapping API for mapping guest memory to avoid depending on "struct page". Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/svm.c | 97 +++--- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/arch/x86/kvm/svm.c

[PATCH v2 00/12] KVM/X86: Introduce a new guest mapping interface

2018-04-15 Thread KarimAllah Ahmed
from guest memory. As far as I can see all offending code is now fixed except the APIC-access page which I will handle in a seperate patch. Filippo Sironi (1): X86/KVM: Handle PFNs outside of kernel reach when touching GPTEs KarimAllah Ahmed (11): X86/nVMX: handle_vmon: Read 4 bytes from guest

[PATCH] KVM: Switch 'requests' to be 64-bit (explicitly)

2018-04-14 Thread KarimAllah Ahmed
Cc: Paolo Bonzini Cc: Radim Krčmář Cc: k...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed --- include/linux/kvm_host.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index

[PATCH v4] X86/KVM: Properly update 'tsc_offset' to represent the running guest

2018-04-13 Thread KarimAllah Ahmed
lo Bonzini Signed-off-by: KarimAllah Ahmed [AMD changes, fix update_ia32_tsc_adjust_msr. - Paolo] Signed-off-by: Paolo Bonzini --- v3 -> v4: - Restore L01 tsc_offset on enter_vmx_non_root_mode failures. - Move tsc_offset update for L02 later in nested_vmx_run. v2 -> v3: - Add AMD bit

[PATCH v4 2/2] kvm: nVMX: Introduce KVM_CAP_STATE

2018-04-12 Thread KarimAllah Ahmed
t of refactoring. - Merge 7/8 and 8/8 into one patch. - Force a VMExit from L2 after reading the kvm_state to avoid mixed state between L1 and L2 on resurrecting the instance. ] Signed-off-by: KarimAllah Ahmed --- v3 -> v4: - Rename function to have _nested v

[PATCH v4 1/2] X86/KVM: Properly update 'tsc_offset' to represent the running guest

2018-04-12 Thread KarimAllah Ahmed
lo Bonzini Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Rewrote the patch to always update tsc_offset to represent the current guest (pbonzini@) --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx.c | 25 - arch/x86/kvm/x86.c | 9

[PATCH 2/2] kvm: nVMX: Introduce KVM_CAP_STATE

2018-04-12 Thread KarimAllah Ahmed
t of refactoring. - Merge 7/8 and 8/8 into one patch. - Force a VMExit from L2 after reading the kvm_state to avoid mixed state between L1 and L2 on resurrecting the instance. ] Signed-off-by: KarimAllah Ahmed --- v2 -> v3: - Remove the forced VMExit from L

[PATCH 1/2] X86/KVM: Properly restore 'tsc_offset' when running an L2 guest

2018-04-12 Thread KarimAllah Ahmed
mář Cc: k...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/vmx.c | 12 +--- arch/x86/kvm/x86.c | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index cff2f50..2f57571 100644 --- a/arch/x86

[PATCH] X86/KVM: Do not allow DISABLE_EXITS_MWAIT when LAPIC ARAT is not available

2018-04-11 Thread KarimAllah Ahmed
s with VMX support but no LAPIC ARAT or not. Cc: Paolo Bonzini Cc: Radim Krčmář Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Cc: x...@kernel.org Cc: k...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reported-by: Wanpeng Li Signed-off-by: KarimAllah Ahmed --- arch/x86/kvm/x86.c

[PATCH v3] X86/VMX: Disable VMX preemption timer if MWAIT is not intercepted

2018-04-10 Thread KarimAllah Ahmed
eixner Cc: Ingo Molnar Cc: H. Peter Anvin Cc: x...@kernel.org Cc: k...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed --- v2 -> v3: - return -EOPNOTSUPP before any other operation in vmx_set_hv_timer v1 -> v2: - Drop everything .. just return -EOPNOTSUPP (p

[PATCH v2] X86/VMX: Disable VMX preemption timer if MWAIT is not intercepted

2018-04-10 Thread KarimAllah Ahmed
eixner Cc: Ingo Molnar Cc: H. Peter Anvin Cc: x...@kernel.org Cc: k...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - Drop everything .. just return -EOPNOTSUPP (pbonzini@) :D --- arch/x86/kvm/vmx.c | 3 +++ 1 file changed, 3 insertions(+) diff

[PATCH] X86/VMX: Disable VMX preempition timer if MWAIT is not intercepted

2018-04-10 Thread KarimAllah Ahmed
eixner Cc: Ingo Molnar Cc: H. Peter Anvin Cc: x...@kernel.org Cc: k...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/lapic.c| 3 ++- arch/x86/kvm/vmx.c | 11 +-- 3 file

[PATCH v2] kvm: nVMX: Introduce KVM_CAP_STATE

2018-04-09 Thread KarimAllah Ahmed
t of refactoring. - Merge 7/8 and 8/8 into one patch. - Force a VMExit from L2 after reading the kvm_state to avoid mixed state between L1 and L2 on resurrecting the instance. ] Signed-off-by: KarimAllah Ahmed --- v1 -> v2: - rename structs and functions and ma

[PATCH v4 1/2] PCI/IOV: Use VF0 cached config registers for other VFs

2018-03-19 Thread KarimAllah Ahmed
a device with many VFs. Cc: Bjorn Helgaas Cc: linux-...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed [bhelgaas: changelog, simplify comments, remove unused "device"] Signed-off-by: Bjorn Helgaas --- v3->v4: - Restructure the code to handle C

[PATCH v4 2/2] PCI/IOV: Use VF0 cached config space size for other VFs

2018-03-19 Thread KarimAllah Ahmed
-...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed --- drivers/pci/iov.c | 3 +++ drivers/pci/pci.h | 1 + drivers/pci/probe.c | 11 ++- include/linux/pci.h | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/pci/iov.c b/drivers/pci

[PATCH] nvmx: Check exit qualification RD/WR permission for MMIO accesses

2018-03-04 Thread KarimAllah Ahmed
Validate that a write MMIO access that follows a read MMIO access would have the correct access captured in the exit qualification. Cc: Paolo Bonzini Cc: Radim Krčmář Cc: k...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed Message-Id: <1519841208-23349-1-

[PATCH] PCI/IOV: Skip initializing the base addresses from the VF config space

2018-03-02 Thread KarimAllah Ahmed
Suggested-by: Bjorn Helgaas Signed-off-by: KarimAllah Ahmed --- drivers/pci/probe.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index a96837e..7204d46 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -329,6 +329,10 @@ static void

[PATCH v3 2/2] PCI/IOV: Use the cached VF BARs size instead of re-reading them

2018-03-01 Thread KarimAllah Ahmed
: KarimAllah Ahmed --- drivers/pci/probe.c | 24 ++-- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index a96837e..aeaa10a 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -180,6 +180,7 @@ static inline

[PATCH v3 1/2] PCI/IOV: Store more data about VFs into the SRIOV struct

2018-03-01 Thread KarimAllah Ahmed
Store more data about PCI VFs into the SRIOV to avoid reading them from the config space of all the PCI VFs. This is specially a useful optimization when bringing up thousands of VFs. Cc: Bjorn Helgaas Cc: linux-...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: KarimAllah Ahmed

  1   2   3   >