Re: Introduce a C++ wrapper for the kvm APIs

2010-12-02 Thread Mike Day
On 24/11/10 18:10 +0200, Avi Kivity wrote:
 On 11/24/2010 05:50 PM, Anthony Liguori wrote:

 My answer is that C++ is the only language that allows you to evolve
 away from C, with mixed C/C++ source (not just linkage level
 compatibility).  If there are others, I want to know about them.

Objective C is good (I like it better than C++) if you can live with
the message-passing architecture. 

Mike



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ioapic/msi interrupt delivery consolidation.

2009-03-10 Thread Mike Day
On 05/03/09 16:34 +0200, Gleb Natapov wrote:
 ioapic_deliver() and kvm_set_msi() have code duplication. Move
 the code into ioapic_deliver_entry() function and call it from
 both places.
 

 +static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
 +{
 + union kvm_ioapic_redirect_entry entry = ioapic-redirtbl[irq];
 +
 + ioapic_debug(dest=%x dest_mode=%x delivery_mode=%x 
 +  vector=%x trig_mode=%x\n,
 +  entry.fields.dest, entry.fields.dest_mode,
 +  entry.fields.delivery_mode, entry.fields.vector,
 +  entry.fields.trig_mode);
 +
 +#ifdef CONFIG_X86
 + /* Always delivery PIT interrupt to vcpu 0 */
 + if (irq == 0) {
 + entry.fields.dest_mode = 0; /* Physical mode. */
 + entry.fields.dest_id = ioapic-kvm-vcpus[0]-vcpu_id;
 + }
 +#endif
 + return ioapic_deliver_entry(ioapic-kvm, entry);
 +}
 +

Why is the PIT always handled by vcpu 0? 

thanks, 

Mike


-- 
Mike Day
http://www.ncultra.org
AIM: ncmikeday |  Yahoo IM: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: KVM: Merge MSI handling to kvm_set_irq

2009-01-08 Thread Mike Day
On 07/01/09 18:42 +0800, Sheng Yang wrote:
 Using kvm_set_irq to handle all interrupt injection.
 
 Signed-off-by: Sheng Yang sh...@linux.intel.com
 ---

 +static void gsi_dispatch(struct kvm *kvm, u32 gsi)

...

 + case IOAPIC_FIXED:
 + for (vcpu_id = 0; deliver_bitmask != 0; vcpu_id++) {
 + if (!(deliver_bitmask  (1  vcpu_id)))
 + continue;
 + deliver_bitmask = ~(1  vcpu_id);
 + vcpu = ioapic-kvm-vcpus[vcpu_id];
 + if (vcpu)
 + kvm_apic_set_irq(vcpu, vector,
 + trig_mode);
 + }
 + break;
 + default:
 + break;
 + }

In cases such as the for() loop above, which are numerous in the
patchset, I wonder if using bitops would be slightly better:

case IOAPIC_FIXED:
while (deliver_bitmask != 0) {
vcpu_id = ffs(deliver_bitmask);
__clear_bit(vcpu_id - 1, deliver_bitmask);
vcpu = ioapic-kvm-vcpus[vcpu_id - 1];
if (vcpu)
kvm_apic_set_irq(vcpu, vector,
 trig_mode);
} ;


I did a quick check and the second example compiles to a more
consise set of assembler instructions. The current code uses bitops in
cases like this.

Mike

-- 
Mike Day
http://www.ncultra.org
AIM: ncmikeday |  Yahoo IM: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Add VMRUN handler v5

2008-10-28 Thread Mike Day
On 20/10/08 19:04 +0200, Alexander Graf wrote:

 +static int vmrun_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
 +{
 + nsvm_printk(VMrun\n);
 + if (nested_svm_check_permissions(svm))
 + return 1;
 +
 + svm-next_rip = kvm_rip_read(svm-vcpu) + 3;
 + skip_emulated_instruction(svm-vcpu);
 +
 + if (nested_svm_do(svm, svm-vmcb-save.rax, 0,
 +   NULL, nested_svm_vmrun))
 + return 1;
 +
 + if (nested_svm_do(svm, svm-vmcb-control.msrpm_base_pa, 0,
 +   NULL, nested_svm_vmrun_msrpm))
 + return 1;
 +
 + return 1;
 +}

A nitpick, but you could remove the last if() statement and one of 
the last two return statements. Unless you forsee more calls to
nested_svm_do() in here.

Mike

-- 
Mike Day
http://www.ncultra.org
AIM: ncmikeday |  Yahoo IM: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Implement GIF, clgi and stgi v5

2008-10-27 Thread Mike Day
On 20/10/08 19:04 +0200, Alexander Graf wrote:

  include/asm-x86/kvm_host.h |3 +++

This file is not present in my clone of Avi's tree, so the patch
doesn't apply. 

Am I missing a step? 

thanks, 

Mike

-- 
Mike Day
http://www.ncultra.org
AIM: ncmikeday |  Yahoo IM: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Implement GIF, clgi and stgi v5

2008-10-27 Thread Mike Day
On 27/10/08 21:29 +0200, Avi Kivity wrote:


 Mainline recently renamed include/asm-x86 to arch/x86/include/asm.   
 Either edit the patches to reflect this,  or try 'git am -3' (not sure  
 if the latter will work).

Thanks! editing the patches works fine.

Mike
-- 
Mike Day
http://www.ncultra.org
AIM: ncmikeday |  Yahoo IM: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: remove compatibility code related toCONFIG_DMAR

2008-09-18 Thread Mike Day
On 18/09/08 22:07 +0800, Han, Weidong wrote:
The previous patch I sent out (for the kvm kernel tree) changes
intel-iommu.h so this compatibility code is no longer needed.

Mike

 This compatibility code for intel_iommu makes VT-d cannot work in
 current code (version  2.6.28), due to intel_iommu_found() returns 0.
 Why add this limitation?
 
 Randy (Weidong)
 
 Mike Day wrote:
  Compatibility code for intel_iommu no longer needed when
  dependency on CONFIG_DMAR removed from kvm kernel build.
  
  Signed-off-by: Mike D. Day [EMAIL PROTECTED]
  ---
   external-module-compat.c |   11 ---
   1 file changed, 11 deletions(-)
  
  diff --git a/kernel/external-module-compat.c
  b/kernel/external-module-compat.c 
  index 4b9a9f2..71429c7 100644
  --- a/kernel/external-module-compat.c
  +++ b/kernel/external-module-compat.c
  @@ -265,14 +265,3 @@ struct pci_dev *pci_get_bus_and_slot(unsigned
   int bus, unsigned int devfn) }
  
   #endif
  -
  -#include linux/intel-iommu.h
  -
  -#if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,28)
  -
  -int intel_iommu_found()
  -{
  -   return 0;
  -}
  -
  -#endif
  
  --
  Mike Day
  http://www.ncultra.org
  AIM: ncmikeday |  Yahoo IM: ultra.runner
  PGP key: http://www.ncultra.org/ncmike/pubkey.asc

-- 
Mike Day
http://www.ncultra.org
AIM: ncmikeday |  Yahoo IM: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [KVM] fix build dependency on CONFIG_DMAR

2008-09-17 Thread Mike Day
KVM kernel build fails unless CONFIG_DMAR is defined.

Signed-off-by: Mike D. Day [EMAIL PROTECTED]
---
 intel-iommu.h |7 +++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 1490fc0..5a83c05 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -349,7 +349,14 @@ int intel_iommu_page_mapping(struct dmar_domain *domain, 
dma_addr_t iova,
 u64 hpa, size_t size, int prot);
 void intel_iommu_detach_dev(struct dmar_domain *domain, u8 bus, u8 devfn);
 struct dmar_domain *intel_iommu_find_domain(struct pci_dev *pdev);
+#ifndef CONFIG_DMAR
+static inline int intel_iommu_found(void)
+{
+   return 0;
+}
+#else
 int intel_iommu_found(void);
+#endif /* CONFIG_DMAR */
 u64 intel_iommu_iova_to_pfn(struct dmar_domain *domain, u64 iova);
 
 #endif

-- 
Mike Day
http://www.ncultra.org
AIM: ncmikeday |  Yahoo IM: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [KVM-userspace] remove compatibility code related to CONFIG_DMAR

2008-09-17 Thread Mike Day
Compatibility code for intel_iommu no longer needed when
dependency on CONFIG_DMAR removed from kvm kernel build.

Signed-off-by: Mike D. Day [EMAIL PROTECTED]
---
 external-module-compat.c |   11 ---
 1 file changed, 11 deletions(-)

diff --git a/kernel/external-module-compat.c b/kernel/external-module-compat.c
index 4b9a9f2..71429c7 100644
--- a/kernel/external-module-compat.c
+++ b/kernel/external-module-compat.c
@@ -265,14 +265,3 @@ struct pci_dev *pci_get_bus_and_slot(unsigned int bus, 
unsigned int devfn)
 }
 
 #endif
-
-#include linux/intel-iommu.h
-
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,28)
-
-int intel_iommu_found()
-{
-   return 0;
-}
-
-#endif

-- 
Mike Day
http://www.ncultra.org
AIM: ncmikeday |  Yahoo IM: ultra.runner
PGP key: http://www.ncultra.org/ncmike/pubkey.asc
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html