From xen-changelog-bounces@lists.xensource.com Thu Sep 01 07:33:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 01 Sep 2011 07:33:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1Qz8KV-0007AL-DO; Thu, 01 Sep 2011 07:33:19 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1Qz8KP-00076m-D0
	for xen-changelog@lists.xensource.com; Thu, 01 Sep 2011 07:33:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1314887576!52517366!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16210 invoked from network); 1 Sep 2011 14:32:57 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Sep 2011 14:32:57 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1Qz8KL-0003wF-Uc
	for xen-changelog@lists.xensource.com; Thu, 01 Sep 2011 15:33:09 +0100
Message-Id: <E1Qz8KL-0003wF-Uc@xenbits.xen.org>
Date: Thu, 01 Sep 2011 15:33:09 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] IRQ: manually EOI migrating line
	interrupts
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1314801477 -3600
# Node ID 0383662ea34cb24314ff614a6abed8294e6c14c3
# Parent  4b7b75ace86391ca337198857be65491adf08756
IRQ: manually EOI migrating line interrupts

When migrating IO-APIC line level interrupts between PCPUs, the
migration code rewrites the IO-APIC entry to point to the new
CPU/Vector before EOI'ing it.

The EOI process says that EOI'ing the Local APIC will cause a
broadcast with the vector number, which the IO-APIC must listen to to
clear the IRR and Status bits.

In the case of migrating, the IO-APIC has already been
reprogrammed so the EOI broadcast with the old vector fails to match
the new vector, leaving the IO-APIC with an outstanding vector,
preventing any more use of that line interrupt.  This causes a lockup
especially when your root device is using PCI INTA (megaraid_sas
driver *ehem*)

However, the problem is mostly hidden because send_cleanup_vector()
causes a cleanup of all moving vectors on the current PCPU in such a
way which does not cause the problem, and if the problem has occured,
the writes it makes to the IO-APIC clears the IRR and Status bits
which unlocks the problem.

This fix is distinctly a temporary hack, waiting on a cleanup of the
irq code.  It checks for the edge case where we have moved the irq,
and manually EOI's the old vector with the IO-APIC which correctly
clears the IRR and Status bits.  Also, it protects the code which
updates irq_cfg by disabling interrupts.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen-unstable changeset:   23805:7048810180de
xen-unstable date:        Wed Aug 31 15:19:24 2011 +0100
---


diff -r 4b7b75ace863 -r 0383662ea34c xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Thu Aug 25 15:36:50 2011 +0100
+++ b/xen/arch/x86/hpet.c	Wed Aug 31 15:37:57 2011 +0100
@@ -297,7 +297,7 @@
     ack_APIC_irq();
 }
 
-static void hpet_msi_end(unsigned int irq)
+static void hpet_msi_end(unsigned int irq, u8 vector)
 {
 }
 
diff -r 4b7b75ace863 -r 0383662ea34c xen/arch/x86/hvm/vmx/vpmu_core2.c
--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c	Thu Aug 25 15:36:50 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c	Wed Aug 31 15:37:57 2011 +0100
@@ -55,7 +55,8 @@
     is_pmc_quirk = 0;
     if ( family == 6 )
     {
-        if ( cpu_model == 46 || cpu_model == 26 )
+        if ( cpu_model == 47 || cpu_model == 46 || cpu_model == 42 ||
+             cpu_model == 26 )
             is_pmc_quirk = 1;
     }
 }
diff -r 4b7b75ace863 -r 0383662ea34c xen/arch/x86/i8259.c
--- a/xen/arch/x86/i8259.c	Thu Aug 25 15:36:50 2011 +0100
+++ b/xen/arch/x86/i8259.c	Wed Aug 31 15:37:57 2011 +0100
@@ -91,7 +91,7 @@
     return 0; /* never anything pending */
 }
 
-static void end_8259A_irq(unsigned int irq)
+static void end_8259A_irq(unsigned int irq, u8 vector)
 {
     if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
         enable_8259A_irq(irq);
diff -r 4b7b75ace863 -r 0383662ea34c xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Thu Aug 25 15:36:50 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Wed Aug 31 15:37:57 2011 +0100
@@ -1651,7 +1651,7 @@
     }
 }
 
-static void end_level_ioapic_irq (unsigned int irq)
+static void end_level_ioapic_irq (unsigned int irq, u8 vector)
 {
     unsigned long v;
     int i;
@@ -1700,6 +1700,14 @@
  */
     i = IO_APIC_VECTOR(irq);
 
+    /* Manually EOI the old vector if we are moving to the new */
+    if ( vector && i != vector )
+    {
+        int ioapic;
+        for (ioapic = 0; ioapic < nr_ioapics; ioapic++)
+            io_apic_eoi(ioapic, i);
+    }
+
     v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
 
     ack_APIC_irq();
@@ -1724,9 +1732,9 @@
 {
 }
 
-static void end_edge_ioapic_irq(unsigned int irq)
- {
- }
+static void end_edge_ioapic_irq(unsigned int irq, u8 vector)
+{
+}
 
 /*
  * Level and edge triggered IO-APIC interrupts need different handling,
@@ -1775,7 +1783,7 @@
         ack_APIC_irq(); /* ACKTYPE_NONE */
 }
 
-static void end_msi_irq(unsigned int irq)
+static void end_msi_irq(unsigned int irq, u8 vector)
 {
     if ( !msi_maskable_irq(irq_desc[irq].msi_desc) )
         ack_APIC_irq(); /* ACKTYPE_EOI */
@@ -1828,7 +1836,7 @@
     ack_APIC_irq();
 }
 
-static void end_lapic_irq(unsigned int irq) { /* nothing */ }
+#define end_lapic_irq end_edge_ioapic_irq
 
 static hw_irq_controller lapic_irq_type = {
     .typename 	= "local-APIC-edge",
diff -r 4b7b75ace863 -r 0383662ea34c xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Thu Aug 25 15:36:50 2011 +0100
+++ b/xen/arch/x86/irq.c	Wed Aug 31 15:37:57 2011 +0100
@@ -307,6 +307,7 @@
 void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs) { }
 
 static void enable_none(unsigned int vector) { }
+static void end_none(unsigned int irq, u8 vector) { }
 static unsigned int startup_none(unsigned int vector) { return 0; }
 static void disable_none(unsigned int vector) { }
 static void ack_none(unsigned int irq)
@@ -315,7 +316,6 @@
 }
 
 #define shutdown_none   disable_none
-#define end_none        enable_none
 
 hw_irq_controller no_irq_type = {
     "none",
@@ -345,6 +345,7 @@
     static int current_vector = FIRST_DYNAMIC_VECTOR, current_offset = 0;
     unsigned int old_vector;
     int cpu, err;
+    unsigned long flags;
     cpumask_t tmp_mask;
 
     if ((cfg->move_in_progress) || cfg->move_cleanup_count)
@@ -392,6 +393,7 @@
         /* Found one! */
         current_vector = vector;
         current_offset = offset;
+        local_irq_save(flags);
         if (old_vector) {
             cfg->move_in_progress = 1;
             cpus_copy(cfg->old_domain, cfg->domain);
@@ -405,6 +407,7 @@
             if (IO_APIC_IRQ(irq))
                     irq_vector[irq] = vector;
         err = 0;
+        local_irq_restore(flags);
         break;
     }
     return err;
@@ -599,7 +602,7 @@
     desc->status &= ~IRQ_INPROGRESS;
 
  out:
-    desc->handler->end(irq);
+    desc->handler->end(irq, regs->entry_vector);
  out_no_end:
     spin_unlock(&desc->lock);
     irq_exit();
@@ -815,7 +818,7 @@
     switch ( action->ack_type )
     {
     case ACKTYPE_UNMASK:
-        desc->handler->end(irq);
+        desc->handler->end(irq, 0);
         break;
     case ACKTYPE_EOI:
         cpu_eoi_map = action->cpu_eoi_map;
@@ -846,7 +849,7 @@
         /* An interrupt may slip through while freeing an ACKTYPE_EOI irq. */
         ASSERT(action->ack_type == ACKTYPE_EOI);
         ASSERT(desc->status & IRQ_DISABLED);
-        desc->handler->end(irq);
+        desc->handler->end(irq, vector);
         return;
     }
 
@@ -957,7 +960,7 @@
         ASSERT(irq > 0);
         desc = irq_to_desc(irq);
         spin_lock(&desc->lock);
-        desc->handler->end(irq);
+        desc->handler->end(irq, peoi[sp].vector);
         spin_unlock(&desc->lock);
     }
 
@@ -1038,7 +1041,7 @@
     if ( action->ack_type == ACKTYPE_UNMASK )
     {
         ASSERT(cpus_empty(action->cpu_eoi_map));
-        desc->handler->end(irq);
+        desc->handler->end(irq, 0);
         spin_unlock_irq(&desc->lock);
         return;
     }
@@ -1298,7 +1301,7 @@
     case ACKTYPE_UNMASK:
         if ( test_and_clear_bit(pirq, d->pirq_mask) &&
              (--action->in_flight == 0) )
-            desc->handler->end(irq);
+            desc->handler->end(irq, 0);
         break;
     case ACKTYPE_EOI:
         /* NB. If #guests == 0 then we clear the eoi_map later on. */
diff -r 4b7b75ace863 -r 0383662ea34c xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Thu Aug 25 15:36:50 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Wed Aug 31 15:37:57 2011 +0100
@@ -437,7 +437,7 @@
     return 0;
 }
 
-static void iommu_msi_end(unsigned int irq)
+static void iommu_msi_end(unsigned int irq, u8 vector)
 {
     iommu_msi_unmask(irq);
     ack_APIC_irq();
diff -r 4b7b75ace863 -r 0383662ea34c xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Thu Aug 25 15:36:50 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Aug 31 15:37:57 2011 +0100
@@ -967,7 +967,7 @@
     return 0;
 }
 
-static void dma_msi_end(unsigned int irq)
+static void dma_msi_end(unsigned int irq, u8 vector)
 {
     dma_msi_unmask(irq);
     ack_APIC_irq();
diff -r 4b7b75ace863 -r 0383662ea34c xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Thu Aug 25 15:36:50 2011 +0100
+++ b/xen/include/xen/irq.h	Wed Aug 31 15:37:57 2011 +0100
@@ -43,7 +43,7 @@
     void (*enable)(unsigned int irq);
     void (*disable)(unsigned int irq);
     void (*ack)(unsigned int irq);
-    void (*end)(unsigned int irq);
+    void (*end)(unsigned int irq, u8 vector);
     void (*set_affinity)(unsigned int irq, cpumask_t mask);
 };
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 01 11:22:15 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 01 Sep 2011 11:22:15 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzBu3-0004rB-ED; Thu, 01 Sep 2011 11:22:15 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzBu0-0004qJ-F9
	for xen-changelog@lists.xensource.com; Thu, 01 Sep 2011 11:22:12 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-21.messagelabs.com!1314901330!49013868!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11449 invoked from network); 1 Sep 2011 18:22:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Sep 2011 18:22:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzBtx-00065u-7P
	for xen-changelog@lists.xensource.com; Thu, 01 Sep 2011 19:22:09 +0100
Message-Id: <E1QzBtx-00065u-7P@xenbits.xen.org>
Date: Thu, 01 Sep 2011 19:22:08 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] vpmu: Add processors Westmere
	E7-8837 and SandyBridge i5-2500 to the vpmu list
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
# Date 1314800805 -3600
# Node ID 2ace86381b97ce98b2ea7f9ab24a056d66cb5f6b
# Parent  be4b078e2d083be51f4ae7d73434750a6ba14915
vpmu: Add processors Westmere E7-8837 and SandyBridge i5-2500 to the vpmu list

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
xen-unstable changeset:   23803:51983821efa4
xen-unstable date:        Wed Aug 31 15:17:45 2011 +0100
---


diff -r be4b078e2d08 -r 2ace86381b97 xen/arch/x86/hvm/vmx/vpmu_core2.c
--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c	Sun Jun 05 16:55:21 2011 +0200
+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c	Wed Aug 31 15:26:45 2011 +0100
@@ -56,7 +56,8 @@
     is_pmc_quirk = 0;
     if ( family == 6 )
     {
-        if ( cpu_model == 46 || cpu_model == 26 )
+        if ( cpu_model == 47 || cpu_model == 46 || cpu_model == 42 ||
+             cpu_model == 26 )
             is_pmc_quirk = 1;
     }
 }
diff -r be4b078e2d08 -r 2ace86381b97 xen/arch/x86/hvm/vpmu.c
--- a/xen/arch/x86/hvm/vpmu.c	Sun Jun 05 16:55:21 2011 +0200
+++ b/xen/arch/x86/hvm/vpmu.c	Wed Aug 31 15:26:45 2011 +0100
@@ -120,7 +120,9 @@
             case 23:
             case 26:
             case 29:
+            case 42:
             case 46:
+            case 47:
                 vpmu->arch_vpmu_ops = &core2_vpmu_ops;
                 break;
             }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 01 11:22:22 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 01 Sep 2011 11:22:22 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzBu9-0004uN-Jr; Thu, 01 Sep 2011 11:22:21 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzBu0-0004qK-Qi
	for xen-changelog@lists.xensource.com; Thu, 01 Sep 2011 11:22:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1314901301!53281555!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11836 invoked from network); 1 Sep 2011 18:21:41 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Sep 2011 18:21:41 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzBtx-000669-QF
	for xen-changelog@lists.xensource.com; Thu, 01 Sep 2011 19:22:09 +0100
Message-Id: <E1QzBtx-000669-QF@xenbits.xen.org>
Date: Thu, 01 Sep 2011 19:22:09 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] IRQ: manually EOI migrating line
	interrupts
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1314801082 -3600
# Node ID 1092a143ef9ddb370d12090784b62f5082f30a78
# Parent  2ace86381b97ce98b2ea7f9ab24a056d66cb5f6b
IRQ: manually EOI migrating line interrupts

When migrating IO-APIC line level interrupts between PCPUs, the
migration code rewrites the IO-APIC entry to point to the new
CPU/Vector before EOI'ing it.

The EOI process says that EOI'ing the Local APIC will cause a
broadcast with the vector number, which the IO-APIC must listen to to
clear the IRR and Status bits.

In the case of migrating, the IO-APIC has already been
reprogrammed so the EOI broadcast with the old vector fails to match
the new vector, leaving the IO-APIC with an outstanding vector,
preventing any more use of that line interrupt.  This causes a lockup
especially when your root device is using PCI INTA (megaraid_sas
driver *ehem*)

However, the problem is mostly hidden because send_cleanup_vector()
causes a cleanup of all moving vectors on the current PCPU in such a
way which does not cause the problem, and if the problem has occured,
the writes it makes to the IO-APIC clears the IRR and Status bits
which unlocks the problem.

This fix is distinctly a temporary hack, waiting on a cleanup of the
irq code.  It checks for the edge case where we have moved the irq,
and manually EOI's the old vector with the IO-APIC which correctly
clears the IRR and Status bits.  Also, it protects the code which
updates irq_cfg by disabling interrupts.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen-unstable changeset:   23805:7048810180de
xen-unstable date:        Wed Aug 31 15:19:24 2011 +0100
---


diff -r 2ace86381b97 -r 1092a143ef9d xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Wed Aug 31 15:26:45 2011 +0100
+++ b/xen/arch/x86/hpet.c	Wed Aug 31 15:31:22 2011 +0100
@@ -325,7 +325,7 @@
     ack_APIC_irq();
 }
 
-static void hpet_msi_end(unsigned int irq)
+static void hpet_msi_end(unsigned int irq, u8 vector)
 {
 }
 
diff -r 2ace86381b97 -r 1092a143ef9d xen/arch/x86/i8259.c
--- a/xen/arch/x86/i8259.c	Wed Aug 31 15:26:45 2011 +0100
+++ b/xen/arch/x86/i8259.c	Wed Aug 31 15:31:22 2011 +0100
@@ -91,7 +91,7 @@
     return 0; /* never anything pending */
 }
 
-static void end_8259A_irq(unsigned int irq)
+static void end_8259A_irq(unsigned int irq, u8 vector)
 {
     if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
         enable_8259A_irq(irq);
diff -r 2ace86381b97 -r 1092a143ef9d xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Wed Aug 31 15:26:45 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Wed Aug 31 15:31:22 2011 +0100
@@ -1645,7 +1645,7 @@
     }
 }
 
-static void end_level_ioapic_irq (unsigned int irq)
+static void end_level_ioapic_irq (unsigned int irq, u8 vector)
 {
     unsigned long v;
     int i;
@@ -1694,6 +1694,14 @@
  */
     i = IO_APIC_VECTOR(irq);
 
+    /* Manually EOI the old vector if we are moving to the new */
+    if ( vector && i != vector )
+    {
+        int ioapic;
+        for (ioapic = 0; ioapic < nr_ioapics; ioapic++)
+            io_apic_eoi(ioapic, i);
+    }
+
     v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
 
     ack_APIC_irq();
@@ -1717,9 +1725,9 @@
 {
 }
 
-static void end_edge_ioapic_irq(unsigned int irq)
- {
- }
+static void end_edge_ioapic_irq(unsigned int irq, u8 vector)
+{
+}
 
 /*
  * Level and edge triggered IO-APIC interrupts need different handling,
@@ -1768,7 +1776,7 @@
         ack_APIC_irq(); /* ACKTYPE_NONE */
 }
 
-static void end_msi_irq(unsigned int irq)
+static void end_msi_irq(unsigned int irq, u8 vector)
 {
     if ( !msi_maskable_irq(irq_desc[irq].msi_desc) )
         ack_APIC_irq(); /* ACKTYPE_EOI */
@@ -1821,7 +1829,7 @@
     ack_APIC_irq();
 }
 
-static void end_lapic_irq(unsigned int irq) { /* nothing */ }
+#define end_lapic_irq end_edge_ioapic_irq
 
 static hw_irq_controller lapic_irq_type = {
     .typename 	= "local-APIC-edge",
diff -r 2ace86381b97 -r 1092a143ef9d xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Wed Aug 31 15:26:45 2011 +0100
+++ b/xen/arch/x86/irq.c	Wed Aug 31 15:31:22 2011 +0100
@@ -309,6 +309,7 @@
 void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs) { }
 
 static void enable_none(unsigned int vector) { }
+static void end_none(unsigned int irq, u8 vector) { }
 static unsigned int startup_none(unsigned int vector) { return 0; }
 static void disable_none(unsigned int vector) { }
 static void ack_none(unsigned int irq)
@@ -317,7 +318,6 @@
 }
 
 #define shutdown_none   disable_none
-#define end_none        enable_none
 
 hw_irq_controller no_irq_type = {
     "none",
@@ -345,6 +345,7 @@
     static int current_vector = FIRST_DYNAMIC_VECTOR, current_offset = 0;
     unsigned int old_vector;
     int cpu, err;
+    unsigned long flags;
     cpumask_t tmp_mask;
 
     old_vector = irq_to_vector(irq);
@@ -391,6 +392,7 @@
         /* Found one! */
         current_vector = vector;
         current_offset = offset;
+        local_irq_save(flags);
         if (old_vector) {
             cfg->move_in_progress = 1;
             cpus_copy(cfg->old_cpu_mask, cfg->cpu_mask);
@@ -404,6 +406,7 @@
             if (IO_APIC_IRQ(irq))
                     irq_vector[irq] = vector;
         err = 0;
+        local_irq_restore(flags);
         break;
     }
     return err;
@@ -610,7 +613,7 @@
     desc->status &= ~IRQ_INPROGRESS;
 
  out:
-    desc->handler->end(irq);
+    desc->handler->end(irq, regs->entry_vector);
  out_no_end:
     spin_unlock(&desc->lock);
     irq_exit();
@@ -826,7 +829,7 @@
     switch ( action->ack_type )
     {
     case ACKTYPE_UNMASK:
-        desc->handler->end(irq);
+        desc->handler->end(irq, 0);
         break;
     case ACKTYPE_EOI:
         cpu_eoi_map = action->cpu_eoi_map;
@@ -857,7 +860,7 @@
         /* An interrupt may slip through while freeing an ACKTYPE_EOI irq. */
         ASSERT(action->ack_type == ACKTYPE_EOI);
         ASSERT(desc->status & IRQ_DISABLED);
-        desc->handler->end(irq);
+        desc->handler->end(irq, vector);
         return;
     }
 
@@ -968,7 +971,7 @@
         ASSERT(irq > 0);
         desc = irq_to_desc(irq);
         spin_lock(&desc->lock);
-        desc->handler->end(irq);
+        desc->handler->end(irq, peoi[sp].vector);
         spin_unlock(&desc->lock);
     }
 
@@ -1049,7 +1052,7 @@
     if ( action->ack_type == ACKTYPE_UNMASK )
     {
         ASSERT(cpus_empty(action->cpu_eoi_map));
-        desc->handler->end(irq);
+        desc->handler->end(irq, 0);
         spin_unlock_irq(&desc->lock);
         return;
     }
@@ -1309,7 +1312,7 @@
     case ACKTYPE_UNMASK:
         if ( test_and_clear_bit(pirq, d->pirq_mask) &&
              (--action->in_flight == 0) )
-            desc->handler->end(irq);
+            desc->handler->end(irq, 0);
         break;
     case ACKTYPE_EOI:
         /* NB. If #guests == 0 then we clear the eoi_map later on. */
diff -r 2ace86381b97 -r 1092a143ef9d xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Wed Aug 31 15:26:45 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Wed Aug 31 15:31:22 2011 +0100
@@ -442,7 +442,7 @@
     return 0;
 }
 
-static void iommu_msi_end(unsigned int irq)
+static void iommu_msi_end(unsigned int irq, u8 vector)
 {
     iommu_msi_unmask(irq);
     ack_APIC_irq();
diff -r 2ace86381b97 -r 1092a143ef9d xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Wed Aug 31 15:26:45 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Aug 31 15:31:22 2011 +0100
@@ -980,7 +980,7 @@
     return 0;
 }
 
-static void dma_msi_end(unsigned int irq)
+static void dma_msi_end(unsigned int irq, u8 vector)
 {
     dma_msi_unmask(irq);
     ack_APIC_irq();
diff -r 2ace86381b97 -r 1092a143ef9d xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Wed Aug 31 15:26:45 2011 +0100
+++ b/xen/include/xen/irq.h	Wed Aug 31 15:31:22 2011 +0100
@@ -44,7 +44,7 @@
     void (*enable)(unsigned int irq);
     void (*disable)(unsigned int irq);
     void (*ack)(unsigned int irq);
-    void (*end)(unsigned int irq);
+    void (*end)(unsigned int irq, u8 vector);
     void (*set_affinity)(unsigned int irq, cpumask_t mask);
 };
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 01 11:22:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 01 Sep 2011 11:22:28 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzBuF-0004xf-SV; Thu, 01 Sep 2011 11:22:27 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzBu1-0004qL-H0
	for xen-changelog@lists.xensource.com; Thu, 01 Sep 2011 11:22:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1314901330!23578668!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29420 invoked from network); 1 Sep 2011 18:22:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Sep 2011 18:22:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzBty-00066O-9O
	for xen-changelog@lists.xensource.com; Thu, 01 Sep 2011 19:22:10 +0100
Message-Id: <E1QzBty-00066O-9O@xenbits.xen.org>
Date: Thu, 01 Sep 2011 19:22:09 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xen: fix hvm_domain_use_pirq's
	behavior
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1314801144 -3600
# Node ID 50496ccde3c386b2bc34e290e61ae55fa9195d2d
# Parent  1092a143ef9ddb370d12090784b62f5082f30a78
xen: fix hvm_domain_use_pirq's behavior

hvm_domain_use_pirq should return true when the guest is using a
certain pirq, no matter if the corresponding event channel is
currently enabled or disabled.  As an additional complication, qemu is
going to request pirqs for passthrough devices even for Xen unaware
HVM guests, so we need to wait for an event channel to be connected
before considering the pirq of a passthrough device as "in use".

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
xen-unstable changeset:   23806:4226ea1785b5
xen-unstable date:        Wed Aug 31 15:23:12 2011 +0100
---


diff -r 1092a143ef9d -r 50496ccde3c3 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Wed Aug 31 15:31:22 2011 +0100
+++ b/xen/arch/x86/irq.c	Wed Aug 31 15:32:24 2011 +0100
@@ -1879,7 +1879,7 @@
         return 0;
 
     emuirq = domain_pirq_to_emuirq(d, pirq);
-    if ( emuirq != IRQ_UNBOUND && d->pirq_to_evtchn[pirq] != 0 )
+    if ( emuirq != IRQ_UNBOUND )
         return 1;
     else
         return 0;
diff -r 1092a143ef9d -r 50496ccde3c3 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Wed Aug 31 15:31:22 2011 +0100
+++ b/xen/arch/x86/physdev.c	Wed Aug 31 15:32:24 2011 +0100
@@ -202,9 +202,6 @@
     if ( ret == 0 )
         map->pirq = pirq;
 
-    if ( !ret && is_hvm_domain(d) )
-        map_domain_emuirq_pirq(d, pirq, IRQ_PT);
-
  done:
     spin_unlock(&d->event_lock);
     spin_unlock(&pcidevs_lock);
@@ -267,7 +264,7 @@
         if ( v->domain->arch.pirq_eoi_map )
             evtchn_unmask(v->domain->pirq_to_evtchn[eoi.irq]);
         if ( !is_hvm_domain(v->domain) ||
-             domain_pirq_to_emuirq(v->domain, eoi.irq) == IRQ_PT )
+             domain_pirq_to_irq(v->domain, eoi.irq) > 0 )
             ret = pirq_guest_eoi(v->domain, eoi.irq);
         else
             ret = 0;
@@ -326,7 +323,7 @@
             break;
         irq_status_query.flags = 0;
         if ( is_hvm_domain(v->domain) &&
-             domain_pirq_to_emuirq(v->domain, irq) != IRQ_PT )
+             domain_pirq_to_irq(v->domain, irq) <= 0 )
         {
             ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
             break;
diff -r 1092a143ef9d -r 50496ccde3c3 xen/common/event_channel.c
--- a/xen/common/event_channel.c	Wed Aug 31 15:31:22 2011 +0100
+++ b/xen/common/event_channel.c	Wed Aug 31 15:32:24 2011 +0100
@@ -361,6 +361,9 @@
 
     bind->port = port;
 
+    if ( is_hvm_domain(d) && domain_pirq_to_irq(d, pirq) > 0 )
+        map_domain_emuirq_pirq(d, pirq, IRQ_PT);
+
  out:
     spin_unlock(&d->event_lock);
 
@@ -409,6 +412,8 @@
             pirq_guest_unbind(d1, chn1->u.pirq.irq);
         d1->pirq_to_evtchn[chn1->u.pirq.irq] = 0;
         unlink_pirq_port(chn1, d1->vcpu[chn1->notify_vcpu_id]);
+        if ( is_hvm_domain(d1) && domain_pirq_to_irq(d1, chn1->u.pirq.irq) > 0 )
+            unmap_domain_pirq_emuirq(d1, chn1->u.pirq.irq);
         break;
 
     case ECS_VIRQ:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 01 11:22:36 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 01 Sep 2011 11:22:36 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzBuN-00050t-OC; Thu, 01 Sep 2011 11:22:35 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzBu1-0004qM-OD
	for xen-changelog@lists.xensource.com; Thu, 01 Sep 2011 11:22:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1314901302!53281560!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11883 invoked from network); 1 Sep 2011 18:21:42 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Sep 2011 18:21:42 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzBty-00066d-OF
	for xen-changelog@lists.xensource.com; Thu, 01 Sep 2011 19:22:10 +0100
Message-Id: <E1QzBty-00066d-OF@xenbits.xen.org>
Date: Thu, 01 Sep 2011 19:22:10 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xen: __hvm_pci_intx_assert should
	check for gsis remapped onto pirqs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1314801167 -3600
# Node ID 6239209bb560b4931d4d97456c82c1a5ca4bd10a
# Parent  50496ccde3c386b2bc34e290e61ae55fa9195d2d
xen: __hvm_pci_intx_assert should check for gsis remapped onto pirqs

If the isa irq corresponding to a particular gsi is disabled while the
gsi is enabled, __hvm_pci_intx_assert will always inject the gsi
through the violapic, even if the gsi has been remapped onto a pirq.
This patch makes sure that even in this case we inject the
notification appropriately.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
xen-unstable changeset:   23807:2297b90a6a7b
xen-unstable date:        Wed Aug 31 15:23:34 2011 +0100
---


diff -r 50496ccde3c3 -r 6239209bb560 xen/arch/x86/hvm/irq.c
--- a/xen/arch/x86/hvm/irq.c	Wed Aug 31 15:32:24 2011 +0100
+++ b/xen/arch/x86/hvm/irq.c	Wed Aug 31 15:32:47 2011 +0100
@@ -28,7 +28,7 @@
 #include <asm/hvm/support.h>
 
 /* Must be called with hvm_domain->irq_lock hold */
-static void assert_irq(struct domain *d, unsigned ioapic_gsi, unsigned pic_irq)
+static void assert_gsi(struct domain *d, unsigned ioapic_gsi)
 {
     int pirq = domain_emuirq_to_pirq(d, ioapic_gsi);
     if ( hvm_domain_use_pirq(d, pirq) )
@@ -37,6 +37,11 @@
         return;
     }
     vioapic_irq_positive_edge(d, ioapic_gsi);
+}
+
+static void assert_irq(struct domain *d, unsigned ioapic_gsi, unsigned pic_irq)
+{
+    assert_gsi(d, ioapic_gsi);
     vpic_irq_positive_edge(d, pic_irq);
 }
 
@@ -61,7 +66,7 @@
 
     gsi = hvm_pci_intx_gsi(device, intx);
     if ( hvm_irq->gsi_assert_count[gsi]++ == 0 )
-        vioapic_irq_positive_edge(d, gsi);
+        assert_gsi(d, gsi);
 
     link    = hvm_pci_intx_link(device, intx);
     isa_irq = hvm_irq->pci_link.route[link];

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 09:44:25 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 09:44:25 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzWqu-00069t-4H; Fri, 02 Sep 2011 09:44:24 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzWqr-00068u-0M
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 09:44:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1314981857!16691947!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30280 invoked from network); 2 Sep 2011 16:44:18 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 16:44:18 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzWqn-00025W-EW
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 17:44:17 +0100
Message-Id: <E1QzWqn-00025W-EW@xenbits.xen.org>
Date: Fri, 02 Sep 2011 17:44:16 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86-64: Fix off-by-one error in
	__addr_ok() macro
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1314800089 -3600
# Node ID 72edc40e2942a3cf0ee8e0d3a330d2e5c2bdfb53
# Parent  ac9aa65050e9abc8f1c12c8603acf3b99e22cddc
x86-64: Fix off-by-one error in __addr_ok() macro

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r ac9aa65050e9 -r 72edc40e2942 xen/include/asm-x86/x86_64/uaccess.h
--- a/xen/include/asm-x86/x86_64/uaccess.h	Tue Aug 30 11:46:58 2011 +0100
+++ b/xen/include/asm-x86/x86_64/uaccess.h	Wed Aug 31 15:14:49 2011 +0100
@@ -34,7 +34,7 @@
  * non-canonical address (and thus fault) before ever reaching VIRT_START.
  */
 #define __addr_ok(addr) \
-    (((unsigned long)(addr) < (1UL<<48)) || \
+    (((unsigned long)(addr) < (1UL<<47)) || \
      ((unsigned long)(addr) >= HYPERVISOR_VIRT_END))
 
 #define access_ok(addr, size) \

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 09:44:31 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 09:44:31 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzWr1-0006D5-0I; Fri, 02 Sep 2011 09:44:31 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzWqr-00068v-Cq
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 09:44:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1314981848!38448307!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11009 invoked from network); 2 Sep 2011 16:44:08 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 16:44:08 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzWqo-00026Z-74
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 17:44:18 +0100
Message-Id: <E1QzWqo-00026Z-74@xenbits.xen.org>
Date: Fri, 02 Sep 2011 17:44:17 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] nestedsvm: VMRUN doesn't use nextrip
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Christoph Egger <Christoph.Egger@amd.com>
# Date 1314800141 -3600
# Node ID d54cfae72cd13fb933323d862201c1667b9b4279
# Parent  72edc40e2942a3cf0ee8e0d3a330d2e5c2bdfb53
nestedsvm: VMRUN doesn't use nextrip

VMRUN does not use nextrip. So remove pointless assignment.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
---


diff -r 72edc40e2942 -r d54cfae72cd1 xen/arch/x86/hvm/svm/nestedsvm.c
--- a/xen/arch/x86/hvm/svm/nestedsvm.c	Wed Aug 31 15:14:49 2011 +0100
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c	Wed Aug 31 15:15:41 2011 +0100
@@ -493,8 +493,7 @@
     n2vmcb->lbr_control.bytes =
         n1vmcb->lbr_control.bytes | ns_vmcb->lbr_control.bytes;
 
-    /* NextRIP */
-    n2vmcb->nextrip = ns_vmcb->nextrip;
+    /* NextRIP - only evaluated on #VMEXIT. */
 
     /*
      * VMCB Save State Area

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 09:44:38 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 09:44:38 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzWr7-0006GU-CK; Fri, 02 Sep 2011 09:44:37 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzWqr-00068w-Va
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 09:44:22 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1314981858!15838686!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25526 invoked from network); 2 Sep 2011 16:44:19 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 16:44:19 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzWqo-00027T-QT
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 17:44:18 +0100
Message-Id: <E1QzWqo-00027T-QT@xenbits.xen.org>
Date: Fri, 02 Sep 2011 17:44:18 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: Increase the default NR_CPUS to
	256
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Laszlo Ersek <lersek@redhat.com>
# Date 1314800174 -3600
# Node ID bb9b810087337479d8de834d4f19fed4bc3e2dbc
# Parent  d54cfae72cd13fb933323d862201c1667b9b4279
x86: Increase the default NR_CPUS to 256

Changeset 21012:ef845a385014 bumped the default to 128 about one and a
half years ago. Increase it now to 256, as systems with eg. 160
logical CPUs are becoming (have become) common.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---


diff -r d54cfae72cd1 -r bb9b81008733 xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h	Wed Aug 31 15:15:41 2011 +0100
+++ b/xen/include/asm-x86/config.h	Wed Aug 31 15:16:14 2011 +0100
@@ -50,7 +50,7 @@
 #ifdef MAX_PHYS_CPUS
 #define NR_CPUS MAX_PHYS_CPUS
 #else
-#define NR_CPUS 128
+#define NR_CPUS 256
 #endif
 
 #ifdef __i386__

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 09:44:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 09:44:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzWrF-0006Jj-S3; Fri, 02 Sep 2011 09:44:45 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzWqs-00068x-E7
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 09:44:22 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1314981847!34541109!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11518 invoked from network); 2 Sep 2011 16:44:07 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 16:44:07 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzWqp-000286-Co
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 17:44:19 +0100
Message-Id: <E1QzWqp-000286-Co@xenbits.xen.org>
Date: Fri, 02 Sep 2011 17:44:18 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] vpmu: Add processors Westmere
	E7-8837 and SandyBridge i5-2500 to the vpmu list
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
# Date 1314800265 -3600
# Node ID 51983821efa4db4040ae1c5063a4404791597699
# Parent  bb9b810087337479d8de834d4f19fed4bc3e2dbc
vpmu: Add processors Westmere E7-8837 and SandyBridge i5-2500 to the vpmu list

Signed-off-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
---


diff -r bb9b81008733 -r 51983821efa4 xen/arch/x86/hvm/vmx/vpmu_core2.c
--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c	Wed Aug 31 15:16:14 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c	Wed Aug 31 15:17:45 2011 +0100
@@ -58,7 +58,8 @@
     is_pmc_quirk = 0;
     if ( family == 6 )
     {
-        if ( cpu_model == 46 || cpu_model == 26 )
+        if ( cpu_model == 47 || cpu_model == 46 || cpu_model == 42 ||
+             cpu_model == 26 )
             is_pmc_quirk = 1;
     }
 }
diff -r bb9b81008733 -r 51983821efa4 xen/arch/x86/hvm/vpmu.c
--- a/xen/arch/x86/hvm/vpmu.c	Wed Aug 31 15:16:14 2011 +0100
+++ b/xen/arch/x86/hvm/vpmu.c	Wed Aug 31 15:17:45 2011 +0100
@@ -119,7 +119,9 @@
             case 23:
             case 26:
             case 29:
+            case 42:
             case 46:
+            case 47:
                 vpmu->arch_vpmu_ops = &core2_vpmu_ops;
                 break;
             }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 09:44:51 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 09:44:51 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzWrL-0006Mj-Oq; Fri, 02 Sep 2011 09:44:51 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzWqt-00068y-35
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 09:44:23 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1314981871!50117283!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22440 invoked from network); 2 Sep 2011 16:44:31 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 16:44:31 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzWqq-00028t-1D
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 17:44:20 +0100
Message-Id: <E1QzWqq-00028t-1D@xenbits.xen.org>
Date: Fri, 02 Sep 2011 17:44:19 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: add irq count for IPIs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Kevin Tian <kevin.tian@intel.com>
# Date 1314800303 -3600
# Node ID 42d76c68b2bfbedee3e5f79d32344e14bce48b0f
# Parent  51983821efa4db4040ae1c5063a4404791597699
x86: add irq count for IPIs

such count is useful to assist decision make in cpuidle governor,
while w/o this patch only device interrupts through do_IRQ is
currently counted.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
---


diff -r 51983821efa4 -r 42d76c68b2bf xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c	Wed Aug 31 15:17:45 2011 +0100
+++ b/xen/arch/x86/apic.c	Wed Aug 31 15:18:23 2011 +0100
@@ -1332,6 +1332,7 @@
     struct cpu_user_regs *old_regs = set_irq_regs(regs);
     ack_APIC_irq();
     perfc_incr(apic_timer);
+    this_cpu(irq_count)++;
     raise_softirq(TIMER_SOFTIRQ);
     set_irq_regs(old_regs);
 }
@@ -1353,6 +1354,7 @@
     unsigned long v;
     struct cpu_user_regs *old_regs = set_irq_regs(regs);
 
+    this_cpu(irq_count)++;
     irq_enter();
 
     /*
@@ -1388,6 +1390,7 @@
     unsigned long v, v1;
     struct cpu_user_regs *old_regs = set_irq_regs(regs);
 
+    this_cpu(irq_count)++;
     irq_enter();
     /* First tickle the hardware, only then report what went on. -- REW */
     v = apic_read(APIC_ESR);
@@ -1419,6 +1422,7 @@
 {
     struct cpu_user_regs *old_regs = set_irq_regs(regs);
     ack_APIC_irq();
+    this_cpu(irq_count)++;
     hvm_do_pmu_interrupt(regs);
     set_irq_regs(old_regs);
 }
diff -r 51983821efa4 -r 42d76c68b2bf xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Wed Aug 31 15:17:45 2011 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Wed Aug 31 15:18:23 2011 +0100
@@ -77,6 +77,7 @@
 fastcall void smp_thermal_interrupt(struct cpu_user_regs *regs)
 {
     struct cpu_user_regs *old_regs = set_irq_regs(regs);
+    this_cpu(irq_count)++;
     irq_enter();
     vendor_thermal_interrupt(regs);
     irq_exit();
@@ -1147,6 +1148,7 @@
     struct cpu_user_regs *old_regs = set_irq_regs(regs);
 
     ack_APIC_irq();
+    this_cpu(irq_count)++;
     irq_enter();
 
     mctc = mcheck_mca_logout(
diff -r 51983821efa4 -r 42d76c68b2bf xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Wed Aug 31 15:17:45 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Wed Aug 31 15:18:23 2011 +0100
@@ -441,6 +441,7 @@
     struct cpu_user_regs *old_regs = set_irq_regs(regs);
 
     ack_APIC_irq();
+    this_cpu(irq_count)++;
     irq_enter();
 
     me = smp_processor_id();
diff -r 51983821efa4 -r 42d76c68b2bf xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Wed Aug 31 15:17:45 2011 +0100
+++ b/xen/arch/x86/smp.c	Wed Aug 31 15:18:23 2011 +0100
@@ -221,6 +221,7 @@
 {
     ack_APIC_irq();
     perfc_incr(ipis);
+    this_cpu(irq_count)++;
     irq_enter();
     if ( !__sync_local_execstate() ||
          (flush_flags & (FLUSH_TLB_GLOBAL | FLUSH_CACHE)) )
@@ -385,6 +386,7 @@
     struct cpu_user_regs *old_regs = set_irq_regs(regs);
     ack_APIC_irq();
     perfc_incr(ipis);
+    this_cpu(irq_count)++;
     set_irq_regs(old_regs);
 }
 
@@ -421,6 +423,7 @@
 
     ack_APIC_irq();
     perfc_incr(ipis);
+    this_cpu(irq_count)++;
     __smp_call_function_interrupt();
     set_irq_regs(old_regs);
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 09:44:58 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 09:44:58 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzWrS-0006Pr-K7; Fri, 02 Sep 2011 09:44:58 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzWqu-000696-Bt
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 09:44:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1314981861!15838690!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25561 invoked from network); 2 Sep 2011 16:44:21 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 16:44:21 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzWqr-0002AP-AZ
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 17:44:21 +0100
Message-Id: <E1QzWqr-0002AP-AZ@xenbits.xen.org>
Date: Fri, 02 Sep 2011 17:44:20 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: fix hvm_domain_use_pirq's
	behavior
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1314800592 -3600
# Node ID 4226ea1785b5a30df45f3bde2947bc65a685fed9
# Parent  7048810180de0476ff2c5b95c4924e96e6b35875
xen: fix hvm_domain_use_pirq's behavior

hvm_domain_use_pirq should return true when the guest is using a
certain pirq, no matter if the corresponding event channel is
currently enabled or disabled.  As an additional complication, qemu is
going to request pirqs for passthrough devices even for Xen unaware
HVM guests, so we need to wait for an event channel to be connected
before considering the pirq of a passthrough device as "in use".

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r 7048810180de -r 4226ea1785b5 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Wed Aug 31 15:19:24 2011 +0100
+++ b/xen/arch/x86/irq.c	Wed Aug 31 15:23:12 2011 +0100
@@ -2027,6 +2027,5 @@
 bool_t hvm_domain_use_pirq(const struct domain *d, const struct pirq *pirq)
 {
     return is_hvm_domain(d) && pirq &&
-           pirq->arch.hvm.emuirq != IRQ_UNBOUND &&
-           pirq->evtchn != 0;
+           pirq->arch.hvm.emuirq != IRQ_UNBOUND; 
 }
diff -r 7048810180de -r 4226ea1785b5 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Wed Aug 31 15:19:24 2011 +0100
+++ b/xen/arch/x86/physdev.c	Wed Aug 31 15:23:12 2011 +0100
@@ -196,9 +196,6 @@
     if ( ret == 0 )
         *pirq_p = pirq;
 
-    if ( !ret && is_hvm_domain(d) )
-        map_domain_emuirq_pirq(d, pirq, IRQ_PT);
-
  done:
     spin_unlock(&d->event_lock);
     spin_unlock(&pcidevs_lock);
@@ -271,7 +268,7 @@
              v->domain->arch.pv_domain.pirq_eoi_map )
             evtchn_unmask(pirq->evtchn);
         if ( !is_hvm_domain(v->domain) ||
-             pirq->arch.hvm.emuirq == IRQ_PT )
+             domain_pirq_to_irq(v->domain, eoi.irq) > 0 )
             pirq_guest_eoi(pirq);
         spin_unlock(&v->domain->event_lock);
         ret = 0;
@@ -331,7 +328,7 @@
             break;
         irq_status_query.flags = 0;
         if ( is_hvm_domain(v->domain) &&
-             domain_pirq_to_emuirq(v->domain, irq) != IRQ_PT )
+             domain_pirq_to_irq(v->domain, irq) <= 0 )
         {
             ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
             break;
diff -r 7048810180de -r 4226ea1785b5 xen/common/event_channel.c
--- a/xen/common/event_channel.c	Wed Aug 31 15:19:24 2011 +0100
+++ b/xen/common/event_channel.c	Wed Aug 31 15:23:12 2011 +0100
@@ -366,6 +366,9 @@
 
     bind->port = port;
 
+    if ( is_hvm_domain(d) && domain_pirq_to_irq(d, pirq) > 0 )
+        map_domain_emuirq_pirq(d, pirq, IRQ_PT);
+
  out:
     spin_unlock(&d->event_lock);
 
@@ -419,6 +422,8 @@
         pirq->evtchn = 0;
         pirq_cleanup_check(pirq, d1);
         unlink_pirq_port(chn1, d1->vcpu[chn1->notify_vcpu_id]);
+        if ( is_hvm_domain(d1) && domain_pirq_to_irq(d1, pirq->pirq) > 0 )
+            unmap_domain_pirq_emuirq(d1, pirq->pirq);
         break;
     }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 09:45:08 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 09:45:08 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzWrb-0006Th-T0; Fri, 02 Sep 2011 09:45:07 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzWqu-000693-3P
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 09:44:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1314981860!30049224!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30933 invoked from network); 2 Sep 2011 16:44:21 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 16:44:21 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzWqq-00029i-Ms
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 17:44:20 +0100
Message-Id: <E1QzWqq-00029i-Ms@xenbits.xen.org>
Date: Fri, 02 Sep 2011 17:44:20 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IRQ: manually EOI migrating line
	interrupts
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1314800364 -3600
# Node ID 7048810180de0476ff2c5b95c4924e96e6b35875
# Parent  42d76c68b2bfbedee3e5f79d32344e14bce48b0f
IRQ: manually EOI migrating line interrupts

When migrating IO-APIC line level interrupts between PCPUs, the
migration code rewrites the IO-APIC entry to point to the new
CPU/Vector before EOI'ing it.

The EOI process says that EOI'ing the Local APIC will cause a
broadcast with the vector number, which the IO-APIC must listen to to
clear the IRR and Status bits.

In the case of migrating, the IO-APIC has already been
reprogrammed so the EOI broadcast with the old vector fails to match
the new vector, leaving the IO-APIC with an outstanding vector,
preventing any more use of that line interrupt.  This causes a lockup
especially when your root device is using PCI INTA (megaraid_sas
driver *ehem*)

However, the problem is mostly hidden because send_cleanup_vector()
causes a cleanup of all moving vectors on the current PCPU in such a
way which does not cause the problem, and if the problem has occured,
the writes it makes to the IO-APIC clears the IRR and Status bits
which unlocks the problem.

This fix is distinctly a temporary hack, waiting on a cleanup of the
irq code.  It checks for the edge case where we have moved the irq,
and manually EOI's the old vector with the IO-APIC which correctly
clears the IRR and Status bits.  Also, it protects the code which
updates irq_cfg by disabling interrupts.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r 42d76c68b2bf -r 7048810180de xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Wed Aug 31 15:18:23 2011 +0100
+++ b/xen/arch/x86/hpet.c	Wed Aug 31 15:19:24 2011 +0100
@@ -301,7 +301,7 @@
     ack_APIC_irq();
 }
 
-static void hpet_msi_end(unsigned int irq)
+static void hpet_msi_end(unsigned int irq, u8 vector)
 {
 }
 
diff -r 42d76c68b2bf -r 7048810180de xen/arch/x86/i8259.c
--- a/xen/arch/x86/i8259.c	Wed Aug 31 15:18:23 2011 +0100
+++ b/xen/arch/x86/i8259.c	Wed Aug 31 15:19:24 2011 +0100
@@ -93,7 +93,7 @@
     return 0; /* never anything pending */
 }
 
-static void end_8259A_irq(unsigned int irq)
+static void end_8259A_irq(unsigned int irq, u8 vector)
 {
     if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
         enable_8259A_irq(irq);
diff -r 42d76c68b2bf -r 7048810180de xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Wed Aug 31 15:18:23 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Wed Aug 31 15:19:24 2011 +0100
@@ -1691,7 +1691,7 @@
     }
 }
 
-static void end_level_ioapic_irq (unsigned int irq)
+static void end_level_ioapic_irq (unsigned int irq, u8 vector)
 {
     unsigned long v;
     int i;
@@ -1740,6 +1740,14 @@
  */
     i = IO_APIC_VECTOR(irq);
 
+    /* Manually EOI the old vector if we are moving to the new */
+    if ( vector && i != vector )
+    {
+        int ioapic;
+        for (ioapic = 0; ioapic < nr_ioapics; ioapic++)
+            io_apic_eoi(ioapic, i);
+    }
+
     v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
 
     ack_APIC_irq();
@@ -1763,7 +1771,10 @@
 {
 }
 
-#define end_edge_ioapic_irq disable_edge_ioapic_irq
+static void end_edge_ioapic_irq(unsigned int irq, u8 vector)
+{
+}
+
 
 /*
  * Level and edge triggered IO-APIC interrupts need different handling,
@@ -1812,7 +1823,7 @@
         ack_APIC_irq(); /* ACKTYPE_NONE */
 }
 
-static void end_msi_irq(unsigned int irq)
+static void end_msi_irq(unsigned int irq, u8 vector)
 {
     if ( !msi_maskable_irq(irq_desc[irq].msi_desc) )
         ack_APIC_irq(); /* ACKTYPE_EOI */
diff -r 42d76c68b2bf -r 7048810180de xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Wed Aug 31 15:18:23 2011 +0100
+++ b/xen/arch/x86/irq.c	Wed Aug 31 15:19:24 2011 +0100
@@ -345,6 +345,7 @@
 void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs) { }
 
 static void enable_none(unsigned int vector) { }
+static void end_none(unsigned int irq, u8 vector) { }
 static unsigned int startup_none(unsigned int vector) { return 0; }
 static void disable_none(unsigned int vector) { }
 static void ack_none(unsigned int irq)
@@ -353,7 +354,6 @@
 }
 
 #define shutdown_none   disable_none
-#define end_none        enable_none
 
 hw_irq_controller no_irq_type = {
     "none",
@@ -381,6 +381,7 @@
     static int current_vector = FIRST_DYNAMIC_VECTOR, current_offset = 0;
     unsigned int old_vector;
     int cpu, err;
+    unsigned long flags;
     cpumask_t tmp_mask;
 
     old_vector = irq_to_vector(irq);
@@ -431,6 +432,7 @@
         /* Found one! */
         current_vector = vector;
         current_offset = offset;
+        local_irq_save(flags);
         if (old_vector) {
             cfg->move_in_progress = 1;
             cpus_copy(cfg->old_cpu_mask, cfg->cpu_mask);
@@ -450,6 +452,7 @@
             if (IO_APIC_IRQ(irq))
                     irq_vector[irq] = vector;
         err = 0;
+        local_irq_restore(flags);
         break;
     }
     return err;
@@ -657,7 +660,7 @@
     desc->status &= ~IRQ_INPROGRESS;
 
  out:
-    desc->handler->end(irq);
+    desc->handler->end(irq, regs->entry_vector);
  out_no_end:
     spin_unlock(&desc->lock);
     irq_exit();
@@ -857,7 +860,7 @@
     switch ( action->ack_type )
     {
     case ACKTYPE_UNMASK:
-        desc->handler->end(irq);
+        desc->handler->end(irq, 0);
         break;
     case ACKTYPE_EOI:
         cpu_eoi_map = action->cpu_eoi_map;
@@ -885,7 +888,7 @@
         /* An interrupt may slip through while freeing an ACKTYPE_EOI irq. */
         ASSERT(action->ack_type == ACKTYPE_EOI);
         ASSERT(desc->status & IRQ_DISABLED);
-        desc->handler->end(irq);
+        desc->handler->end(irq, vector);
         return;
     }
 
@@ -1099,7 +1102,7 @@
         ASSERT(irq > 0);
         desc = irq_to_desc(irq);
         spin_lock(&desc->lock);
-        desc->handler->end(irq);
+        desc->handler->end(irq, peoi[sp].vector);
         spin_unlock(&desc->lock);
     }
 
@@ -1177,7 +1180,7 @@
     if ( action->ack_type == ACKTYPE_UNMASK )
     {
         ASSERT(cpus_empty(action->cpu_eoi_map));
-        desc->handler->end(irq);
+        desc->handler->end(irq, 0);
         spin_unlock_irq(&desc->lock);
         return;
     }
@@ -1431,7 +1434,7 @@
     case ACKTYPE_UNMASK:
         if ( test_and_clear_bool(pirq->masked) &&
              (--action->in_flight == 0) )
-            desc->handler->end(irq);
+            desc->handler->end(irq, 0);
         break;
     case ACKTYPE_EOI:
         /* NB. If #guests == 0 then we clear the eoi_map later on. */
diff -r 42d76c68b2bf -r 7048810180de xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Wed Aug 31 15:18:23 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Wed Aug 31 15:19:24 2011 +0100
@@ -441,7 +441,7 @@
     return 0;
 }
 
-static void iommu_msi_end(unsigned int irq)
+static void iommu_msi_end(unsigned int irq, u8 vector)
 {
     iommu_msi_unmask(irq);
     ack_APIC_irq();
diff -r 42d76c68b2bf -r 7048810180de xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Wed Aug 31 15:18:23 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Aug 31 15:19:24 2011 +0100
@@ -971,7 +971,7 @@
     return 0;
 }
 
-static void dma_msi_end(unsigned int irq)
+static void dma_msi_end(unsigned int irq, u8 vector)
 {
     dma_msi_unmask(irq);
     ack_APIC_irq();
diff -r 42d76c68b2bf -r 7048810180de xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Wed Aug 31 15:18:23 2011 +0100
+++ b/xen/include/xen/irq.h	Wed Aug 31 15:19:24 2011 +0100
@@ -44,7 +44,7 @@
     void (*enable)(unsigned int irq);
     void (*disable)(unsigned int irq);
     void (*ack)(unsigned int irq);
-    void (*end)(unsigned int irq);
+    void (*end)(unsigned int irq, u8 vector);
     void (*set_affinity)(unsigned int irq, cpumask_t mask);
 };
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 09:45:15 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 09:45:15 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzWrj-0006Wb-LA; Fri, 02 Sep 2011 09:45:15 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzWqv-00069B-3T
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 09:44:25 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1314981843!36788959!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31274 invoked from network); 2 Sep 2011 16:44:03 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 16:44:03 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzWqs-0002BF-2R
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 17:44:22 +0100
Message-Id: <E1QzWqs-0002BF-2R@xenbits.xen.org>
Date: Fri, 02 Sep 2011 17:44:21 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: __hvm_pci_intx_assert should
	check for gsis remapped onto pirqs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1314800614 -3600
# Node ID 2297b90a6a7bec2655672f4e775664046be0b3c4
# Parent  4226ea1785b5a30df45f3bde2947bc65a685fed9
xen: __hvm_pci_intx_assert should check for gsis remapped onto pirqs

If the isa irq corresponding to a particular gsi is disabled while the
gsi is enabled, __hvm_pci_intx_assert will always inject the gsi
through the violapic, even if the gsi has been remapped onto a pirq.
This patch makes sure that even in this case we inject the
notification appropriately.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r 4226ea1785b5 -r 2297b90a6a7b xen/arch/x86/hvm/irq.c
--- a/xen/arch/x86/hvm/irq.c	Wed Aug 31 15:23:12 2011 +0100
+++ b/xen/arch/x86/hvm/irq.c	Wed Aug 31 15:23:34 2011 +0100
@@ -29,7 +29,7 @@
 #include <asm/msi.h>
 
 /* Must be called with hvm_domain->irq_lock hold */
-static void assert_irq(struct domain *d, unsigned ioapic_gsi, unsigned pic_irq)
+static void assert_gsi(struct domain *d, unsigned ioapic_gsi)
 {
     struct pirq *pirq =
         pirq_info(d, domain_emuirq_to_pirq(d, ioapic_gsi));
@@ -40,6 +40,11 @@
         return;
     }
     vioapic_irq_positive_edge(d, ioapic_gsi);
+}
+
+static void assert_irq(struct domain *d, unsigned ioapic_gsi, unsigned pic_irq)
+{
+    assert_gsi(d, ioapic_gsi);
     vpic_irq_positive_edge(d, pic_irq);
 }
 
@@ -66,7 +71,7 @@
 
     gsi = hvm_pci_intx_gsi(device, intx);
     if ( hvm_irq->gsi_assert_count[gsi]++ == 0 )
-        vioapic_irq_positive_edge(d, gsi);
+        assert_gsi(d, gsi);
 
     link    = hvm_pci_intx_link(device, intx);
     isa_irq = hvm_irq->pci_link.route[link];

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 09:45:27 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 09:45:27 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzWru-0006au-Cz; Fri, 02 Sep 2011 09:45:26 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzWqv-00069O-Ls
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 09:44:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1314981862!32647925!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19649 invoked from network); 2 Sep 2011 16:44:22 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 16:44:22 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzWqs-0002Bl-Jp
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 17:44:22 +0100
Message-Id: <E1QzWqs-0002Bl-Jp@xenbits.xen.org>
Date: Fri, 02 Sep 2011 17:44:22 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: get_free_pirq: make sure that
	the returned pirq is allocated
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1314800629 -3600
# Node ID 4a4882df5649dc65775b37f757a6aa6b14704f4a
# Parent  2297b90a6a7bec2655672f4e775664046be0b3c4
xen: get_free_pirq: make sure that the returned pirq is allocated

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r 2297b90a6a7b -r 4a4882df5649 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Wed Aug 31 15:23:34 2011 +0100
+++ b/xen/arch/x86/irq.c	Wed Aug 31 15:23:49 2011 +0100
@@ -1587,13 +1587,19 @@
     {
         for ( i = 16; i < nr_irqs_gsi; i++ )
             if ( is_free_pirq(d, pirq_info(d, i)) )
+            {
+                pirq_get_info(d, i);
                 return i;
+            }
     }
     else
     {
         for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- )
             if ( is_free_pirq(d, pirq_info(d, i)) )
+            {
+                pirq_get_info(d, i);
                 return i;
+            }
     }
 
     return -ENOSPC;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 09:45:33 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 09:45:33 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzWs1-0006ds-7i; Fri, 02 Sep 2011 09:45:33 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzWqw-00069r-GR
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 09:44:27 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1314981863!26349118!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10577 invoked from network); 2 Sep 2011 16:44:23 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 16:44:23 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzWqt-0002CH-4n
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 17:44:23 +0100
Message-Id: <E1QzWqt-0002CH-4n@xenbits.xen.org>
Date: Fri, 02 Sep 2011 17:44:22 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: use defines for page sizes
	rather hardcoding them.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1314866365 -3600
# Node ID 85b29185c9119ff9139596251d7bd13586853994
# Parent  4a4882df5649dc65775b37f757a6aa6b14704f4a
x86/mm: use defines for page sizes rather hardcoding them.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 4a4882df5649 -r 85b29185c911 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Aug 31 15:23:49 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Sep 01 09:39:25 2011 +0100
@@ -881,7 +881,7 @@
 
     if ( access_w && p2ma == p2m_access_rx2rw ) 
     {
-        p2m->set_entry(p2m, gfn, mfn, 0, p2mt, p2m_access_rw);
+        p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rw);
         p2m_unlock(p2m);
         return;
     }
@@ -904,7 +904,7 @@
         {
             /* A listener is not required, so clear the access restrictions */
             p2m_lock(p2m);
-            p2m->set_entry(p2m, gfn, mfn, 0, p2mt, p2m_access_rwx);
+            p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2mt, p2m_access_rwx);
             p2m_unlock(p2m);
         }
 
@@ -996,7 +996,7 @@
     for ( pfn = start_pfn; pfn < start_pfn + nr; pfn++ )
     {
         mfn = gfn_to_mfn_query(d, pfn, &t);
-        if ( p2m->set_entry(p2m, pfn, mfn, 0, t, a) == 0 )
+        if ( p2m->set_entry(p2m, pfn, mfn, PAGE_ORDER_4K, t, a) == 0 )
         {
             rc = -ENOMEM;
             break;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 09:45:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 09:45:41 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzWs9-0006hB-OI; Fri, 02 Sep 2011 09:45:41 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzWr1-0006CQ-PJ
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 09:44:32 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1314981856!34541119!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11826 invoked from network); 2 Sep 2011 16:44:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 16:44:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzWqt-0002Cw-My
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 17:44:23 +0100
Message-Id: <E1QzWqt-0002Cw-My@xenbits.xen.org>
Date: Fri, 02 Sep 2011 17:44:23 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/x86: only support >128 CPUs on
	x86_64
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1314895603 -3600
# Node ID a6a5bda3c962f1e9a14fcbb770c7e3b7cd62bee4
# Parent  85b29185c9119ff9139596251d7bd13586853994
xen/x86: only support >128 CPUs on x86_64

32 bit cannot cope with 256 cpus and hits:

    /* At least half the ioremap space should be available to us. */
    BUILD_BUG_ON(IOREMAP_VIRT_START + (IOREMAP_MBYTES << 19) >=
    FIXADDR_START);

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 85b29185c911 -r a6a5bda3c962 xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h	Thu Sep 01 09:39:25 2011 +0100
+++ b/xen/include/asm-x86/config.h	Thu Sep 01 17:46:43 2011 +0100
@@ -49,6 +49,8 @@
 
 #ifdef MAX_PHYS_CPUS
 #define NR_CPUS MAX_PHYS_CPUS
+#elif defined __i386__
+#define NR_CPUS 128
 #else
 #define NR_CPUS 256
 #endif

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 02 12:22:18 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 02 Sep 2011 12:22:18 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1QzZJi-0003iL-5S; Fri, 02 Sep 2011 12:22:18 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1QzZJc-0003hS-QP
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 12:22:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1314991316!52672000!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12028 invoked from network); 2 Sep 2011 19:21:56 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Sep 2011 19:21:56 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1QzZJZ-00062Y-Em
	for xen-changelog@lists.xensource.com; Fri, 02 Sep 2011 20:22:09 +0100
Message-Id: <E1QzZJZ-00062Y-Em@xenbits.xen.org>
Date: Fri, 02 Sep 2011 20:22:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ns16550: Simplify UART and
	UART-interrupt probing logic.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1314971786 -3600
# Node ID f1349a968a5ac5577d67ad4a3f3490c580dbe264
# Parent  a6a5bda3c962f1e9a14fcbb770c7e3b7cd62bee4
ns16550: Simplify UART and UART-interrupt probing logic.

1. No need to check for UART existence in the polling routine. We
already check for UART existence during boot-time initialisation (see
check_existence() function).

2. No obvious need to send a dummy character. The poll routine will
run until a character is eventually sent, but for the most common use
of serial ports (console logging) that will happen almost immediately.

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r a6a5bda3c962 -r f1349a968a5a xen/drivers/char/ns16550.c
--- a/xen/drivers/char/ns16550.c	Thu Sep 01 17:46:43 2011 +0100
+++ b/xen/drivers/char/ns16550.c	Fri Sep 02 14:56:26 2011 +0100
@@ -43,7 +43,7 @@
     /* UART with no IRQ line: periodically-polled I/O. */
     struct timer timer;
     unsigned int timeout_ms;
-    bool_t probing, intr_works;
+    bool_t intr_works;
     /* PCI card parameters. */
     unsigned int pb_bdf[3]; /* pci bridge BDF */
     unsigned int ps_bdf[3]; /* pci serial port BDF */
@@ -138,12 +138,7 @@
     struct serial_port *port = dev_id;
     struct ns16550 *uart = port->uart;
 
-    if ( !uart->intr_works )
-    {
-        uart->probing = 0;
-        uart->intr_works = 1;
-        stop_timer(&uart->timer);
-    }
+    uart->intr_works = 1;
 
     while ( !(ns_read_reg(uart, IIR) & IIR_NOINT) )
     {
@@ -155,30 +150,26 @@
     }
 }
 
-/* Safe: ns16550_poll() runs in softirq context so not reentrant on a given CPU. */
+/* Safe: ns16550_poll() runs as softirq so not reentrant on a given CPU. */
 static DEFINE_PER_CPU(struct serial_port *, poll_port);
 
 static void __ns16550_poll(struct cpu_user_regs *regs)
 {
     struct serial_port *port = this_cpu(poll_port);
     struct ns16550 *uart = port->uart;
+    char lsr;
 
     if ( uart->intr_works )
         return; /* Interrupts work - no more polling */
 
-    if ( uart->probing )
+    while ( (lsr = ns_read_reg(uart, LSR)) & (LSR_DR|LSR_THRE) )
     {
-        uart->probing = 0;
-        if ( (ns_read_reg(uart, LSR) & 0xff) == 0xff )
-            return; /* All bits set - probably no UART present */
+        if ( lsr & LSR_THRE )
+            serial_tx_interrupt(port, regs);
+        if ( lsr & LSR_DR )
+            serial_rx_interrupt(port, regs);
     }
 
-    while ( ns_read_reg(uart, LSR) & LSR_DR )
-        serial_rx_interrupt(port, regs);
-
-    if ( ns_read_reg(uart, LSR) & LSR_THRE )
-        serial_tx_interrupt(port, regs);
-
     set_timer(&uart->timer, NOW() + MILLISECS(uart->timeout_ms));
 }
 
@@ -235,6 +226,8 @@
     unsigned char lcr;
     unsigned int  divisor;
 
+    uart->intr_works = 0;
+
     pci_serial_early_init(uart);
 
     lcr = (uart->data_bits - 5) | ((uart->stop_bits - 1) << 2) | uart->parity;
@@ -292,11 +285,6 @@
 
         /* Enable receive and transmit interrupts. */
         ns_write_reg(uart, IER, IER_ERDAI | IER_ETHREI);
-
-        /* Do a timed write to make sure we are getting interrupts. */
-        uart->probing = 1;
-        uart->intr_works = 0;
-        ns_write_reg(uart, THR, 0xff);
     }
 
     if ( uart->irq >= 0 )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Mon Sep 05 12:34:09 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 05 Sep 2011 12:34:09 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R0evp-0004IM-LE; Mon, 05 Sep 2011 12:34:09 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R0euu-0003w6-IU
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 12:33:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1315251168!47388804!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16590 invoked from network); 5 Sep 2011 19:32:48 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Sep 2011 19:32:48 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R0eur-0006WQ-6I
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 20:33:09 +0100
Message-Id: <E1R0eur-0006WQ-6I@xenbits.xen.org>
Date: Mon, 05 Sep 2011 20:33:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen,
	vtd: Fix device check for devices behind PCIe-to-PCI bridges
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1315231246 -3600
# Node ID 5535d7ce2673e54cbd19685f9ed875d42f6f3a5f
# Parent  32814ad7458dc842a7c588eee13e5c4ee11709a3
xen, vtd: Fix device check for devices behind PCIe-to-PCI bridges

On some systems, requests devices behind a PCIe-to-PCI bridge all
appear to the IOMMU as though they come from from slot 0, function 0
on that device; so the mapping code much punch a hole for X:0.0 in the
IOMMU for such devices.  When punching the hole, if that device has
already been mapped once, we simply need to check ownership to make
sure it's legal.  To do so, domain_context_mapping_one() will look up
the device for the mapping with pci_get_pdev() and look for the owner.

However, if there is no device in X:0.0, this look up will fail.

Rather than returning -ENODEV in this situation (causing a failure in
mapping the device), try to get the domain ownership from the iommu
context mapping itself.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
---


diff -r 32814ad7458d -r 5535d7ce2673 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Mon Sep 05 15:00:15 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Mon Sep 05 15:00:46 2011 +0100
@@ -113,6 +113,27 @@
     return 0;
 }
 
+static int context_get_domain_id(struct context_entry *context,
+                                 struct iommu *iommu)
+{
+    unsigned long dom_index, nr_dom;
+    int domid = -1;
+
+    if (iommu && context)
+    {
+        nr_dom = cap_ndoms(iommu->cap);
+
+        dom_index = context_domain_id(*context);
+
+        if ( dom_index < nr_dom && iommu->domid_map)
+            domid = iommu->domid_map[dom_index];
+        else
+            dprintk(XENLOG_DEBUG VTDPREFIX, "%s: dom_index %lu exceeds nr_dom %lu or iommu has no domid_map\n",
+                    __func__, dom_index, nr_dom);
+    }
+    return domid;
+}
+
 static struct intel_iommu *__init alloc_intel_iommu(void)
 {
     struct intel_iommu *intel;
@@ -1237,7 +1258,6 @@
     struct hvm_iommu *hd = domain_hvm_iommu(domain);
     struct context_entry *context, *context_entries;
     u64 maddr, pgd_maddr;
-    struct pci_dev *pdev = NULL;
     int agaw;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
@@ -1249,12 +1269,45 @@
     if ( context_present(*context) )
     {
         int res = 0;
+        struct pci_dev *pdev = NULL;
 
+        /* First try to get domain ownership from device structure.  If that's
+         * not available, try to read it from the context itself. */
         pdev = pci_get_pdev(bus, devfn);
-        if (!pdev)
-            res = -ENODEV;
-        else if (pdev->domain != domain)
-            res = -EINVAL;
+        if ( pdev )
+        {
+            if ( pdev->domain != domain )
+            {
+                dprintk(XENLOG_INFO VTDPREFIX, "d%d: bdf = %x:%x.%x owned by d%d!",
+                        domain->domain_id, 
+                        bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                        (pdev->domain)
+                        ? pdev->domain->domain_id : -1);
+                res = -EINVAL;
+            }
+        }
+        else
+        {
+            int cdomain;
+            cdomain = context_get_domain_id(context, iommu);
+            
+            if ( cdomain < 0 )
+            {
+                dprintk(VTDPREFIX, "d%d: bdf = %x:%x.%x mapped, but can't find owner!\n",
+                        domain->domain_id, 
+                        bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                res = -EINVAL;
+            }
+            else if ( cdomain != domain->domain_id )
+            {
+                dprintk(XENLOG_INFO VTDPREFIX, "d%d: bdf = %x:%x.%x already mapped to d%d!",
+                        domain->domain_id, 
+                        bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                        cdomain);
+                res = -EINVAL;
+            }
+        }
+
         unmap_vtd_domain_page(context_entries);
         spin_unlock(&iommu->lock);
         return res;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Mon Sep 05 12:34:31 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 05 Sep 2011 12:34:31 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R0ewB-0004Lz-62; Mon, 05 Sep 2011 12:34:31 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R0euu-0003w3-E7
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 12:33:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-21.messagelabs.com!1315251183!47764795!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31214 invoked from network); 5 Sep 2011 19:33:04 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Sep 2011 19:33:04 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R0euq-0006WB-L1
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 20:33:08 +0100
Message-Id: <E1R0euq-0006WB-L1@xenbits.xen.org>
Date: Mon, 05 Sep 2011 20:33:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Add global irq_vector_map
	option, set if using AMD global intremap tables
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1315231215 -3600
# Node ID 32814ad7458dc842a7c588eee13e5c4ee11709a3
# Parent  f1349a968a5ac5577d67ad4a3f3490c580dbe264
xen: Add global irq_vector_map option, set if using AMD global intremap tables

As mentioned in previous changesets, AMD IOMMU interrupt
remapping tables only look at the vector, not the destination
id of an interrupt.  This means that all IRQs going through
the same interrupt remapping table need to *not* share vectors.

The irq "vector map" functionality was originally introduced
after a patch which disabled global AMD IOMMUs entirely.  That
patch has since been reverted, meaning that AMD intremap tables
can either be per-device or global.

This patch therefore introduces a global irq vector map option,
and enables it if we're using an AMD IOMMU with a global
interrupt remapping table.

This patch removes the "irq-perdev-vector-map" boolean
command-line optino and replaces it with "irq_vector_map",
which can have one of three values: none, global, or per-device.

Setting the irq_vector_map to any value will override the
default that the AMD code sets.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
---


diff -r f1349a968a5a -r 32814ad7458d docs/src/user.tex
--- a/docs/src/user.tex	Fri Sep 02 14:56:26 2011 +0100
+++ b/docs/src/user.tex	Mon Sep 05 15:00:15 2011 +0100
@@ -2280,6 +2280,10 @@
 \item [ vcpu\_migration\_delay=$<$minimum\_time$>$] Set minimum time of 
   vcpu migration in microseconds (default 0). This parameter avoids agressive
   vcpu migration. For example, the linux kernel uses 0.5ms by default.
+\item [ irq_vector_map=xxx ] Enable irq vector non-sharing maps.  Setting 'global' 
+  will ensure that no  IRQs will share vectors.  Setting 'per-device' will ensure 
+  that no IRQs from the same device will share vectors.  Setting to 'none' will
+  disable it entirely, overriding any defaults the IOMMU code may set.
 \end{description}
 
 In addition, the following options may be specified on the Xen command
diff -r f1349a968a5a -r 32814ad7458d xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Fri Sep 02 14:56:26 2011 +0100
+++ b/xen/arch/x86/irq.c	Mon Sep 05 15:00:15 2011 +0100
@@ -24,6 +24,8 @@
 #include <asm/mach-generic/mach_apic.h>
 #include <public/physdev.h>
 
+static void parse_irq_vector_map_param(char *s);
+
 /* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
 bool_t __read_mostly opt_noirqbalance = 0;
 boolean_param("noirqbalance", opt_noirqbalance);
@@ -33,8 +35,10 @@
 integer_param("nr_irqs", nr_irqs);
 
 /* This default may be changed by the AMD IOMMU code */
-bool_t __read_mostly opt_irq_perdev_vector_map = 0;
-boolean_param("irq-perdev-vector-map", opt_irq_perdev_vector_map);
+int __read_mostly opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_DEFAULT;
+custom_param("irq_vector_map", parse_irq_vector_map_param);
+
+vmask_t global_used_vector_map;
 
 u8 __read_mostly *irq_vector;
 struct irq_desc __read_mostly *irq_desc = NULL;
@@ -64,6 +68,26 @@
 static unsigned int __read_mostly irq_ratelimit_threshold = 10000;
 integer_param("irq_ratelimit", irq_ratelimit_threshold);
 
+static void __init parse_irq_vector_map_param(char *s)
+{
+    char *ss;
+
+    do {
+        ss = strchr(s, ',');
+        if ( ss )
+            *ss = '\0';
+
+        if ( !strcmp(s, "none"))
+            opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_NONE;
+        else if ( !strcmp(s, "global"))
+            opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_GLOBAL;
+        else if ( !strcmp(s, "per-device"))
+            opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_PERDEV;
+
+        s = ss + 1;
+    } while ( ss );
+}
+
 /* Must be called when irq disabled */
 void lock_vector_lock(void)
 {
@@ -365,6 +389,41 @@
     end_none
 };
 
+static vmask_t *irq_get_used_vector_mask(int irq)
+{
+    vmask_t *ret = NULL;
+
+    if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_GLOBAL )
+    {
+        struct irq_desc *desc = irq_to_desc(irq);
+
+        ret = &global_used_vector_map;
+
+        if ( desc->chip_data->used_vectors )
+        {
+            printk(XENLOG_INFO "%s: Strange, unassigned irq %d already has used_vectors!\n",
+                   __func__, irq);
+        }
+        else
+        {
+            int vector;
+            
+            vector = irq_to_vector(irq);
+            if ( vector > 0 )
+            {
+                printk(XENLOG_INFO "%s: Strange, irq %d already assigned vector %d!\n",
+                       __func__, irq, vector);
+                
+                ASSERT(!test_bit(vector, ret));
+
+                set_bit(vector, ret);
+            }
+        }
+    }
+
+    return ret;
+}
+
 int __assign_irq_vector(int irq, struct irq_cfg *cfg, const cpumask_t *mask)
 {
     /*
@@ -383,6 +442,7 @@
     int cpu, err;
     unsigned long flags;
     cpumask_t tmp_mask;
+    vmask_t *irq_used_vectors = NULL;
 
     old_vector = irq_to_vector(irq);
     if (old_vector) {
@@ -397,6 +457,17 @@
         return -EAGAIN;
 
     err = -ENOSPC;
+
+    /* This is the only place normal IRQs are ever marked
+     * as "in use".  If they're not in use yet, check to see
+     * if we need to assign a global vector mask. */
+    if ( irq_status[irq] == IRQ_USED )
+    {
+        irq_used_vectors = cfg->used_vectors;
+    }
+    else
+        irq_used_vectors = irq_get_used_vector_mask(irq);
+
     for_each_cpu_mask(cpu, *mask) {
         int new_cpu;
         int vector, offset;
@@ -422,8 +493,8 @@
         if (test_bit(vector, used_vectors))
             goto next;
 
-        if (cfg->used_vectors
-            && test_bit(vector, cfg->used_vectors) )
+        if (irq_used_vectors
+            && test_bit(vector, irq_used_vectors) )
             goto next;
 
         for_each_cpu_mask(new_cpu, tmp_mask)
@@ -442,15 +513,22 @@
             per_cpu(vector_irq, new_cpu)[vector] = irq;
         cfg->vector = vector;
         cpus_copy(cfg->cpu_mask, tmp_mask);
+
+        irq_status[irq] = IRQ_USED;
+        ASSERT((cfg->used_vectors == NULL)
+               || (cfg->used_vectors == irq_used_vectors));
+        cfg->used_vectors = irq_used_vectors;
+
+        if (IO_APIC_IRQ(irq))
+            irq_vector[irq] = vector;
+
         if ( cfg->used_vectors )
         {
             ASSERT(!test_bit(vector, cfg->used_vectors));
+
             set_bit(vector, cfg->used_vectors);
         }
 
-        irq_status[irq] = IRQ_USED;
-            if (IO_APIC_IRQ(irq))
-                    irq_vector[irq] = vector;
         err = 0;
         local_irq_restore(flags);
         break;
@@ -1621,7 +1699,7 @@
 
     if ( !IS_PRIV(current->domain) &&
          !(IS_PRIV_FOR(current->domain, d) &&
-          irq_access_permitted(current->domain, pirq)))
+           irq_access_permitted(current->domain, pirq)))
         return -EPERM;
 
     if ( pirq < 0 || pirq >= d->nr_pirqs || irq < 0 || irq >= nr_irqs )
@@ -1673,11 +1751,22 @@
 
         if ( desc->handler != &no_irq_type )
             dprintk(XENLOG_G_ERR, "dom%d: irq %d in use\n",
-              d->domain_id, irq);
+                    d->domain_id, irq);
         desc->handler = &pci_msi_type;
-        if ( opt_irq_perdev_vector_map
+
+        if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_PERDEV
              && !desc->chip_data->used_vectors )
+        {
             desc->chip_data->used_vectors = &pdev->info.used_vectors;
+            if ( desc->chip_data->vector != IRQ_VECTOR_UNASSIGNED )
+            {
+                int vector = desc->chip_data->vector;
+                ASSERT(!test_bit(vector, desc->chip_data->used_vectors));
+
+                set_bit(vector, desc->chip_data->used_vectors);
+            }
+        }
+
         set_domain_irq_pirq(d, irq, info);
         setup_msi_irq(msi_desc, irq);
         spin_unlock_irqrestore(&desc->lock, flags);
@@ -1687,9 +1776,12 @@
         spin_lock_irqsave(&desc->lock, flags);
         set_domain_irq_pirq(d, irq, info);
         spin_unlock_irqrestore(&desc->lock, flags);
+
+        if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_PERDEV )
+            printk(XENLOG_INFO "Per-device vector maps for GSIs not implemented yet.\n");
     }
 
- done:
+done:
     if ( ret )
         cleanup_domain_irq_pirq(d, irq, info);
     return ret;
diff -r f1349a968a5a -r 32814ad7458d xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Fri Sep 02 14:56:26 2011 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Mon Sep 05 15:00:15 2011 +0100
@@ -167,18 +167,35 @@
         return -ENODEV;
     }
 
-    /* Enable use of per-device vector map unless otherwise
-     * specified */
-    if ( iommu_amd_perdev_vector_map )
+    /*
+     * AMD IOMMUs don't distinguish between vectors destined for
+     * different cpus when doing interrupt remapping.  This means
+     * that interrupts going through the same intremap table
+     * can't share the same vector.
+     *
+     * If irq_vector_map isn't specified, choose a sensible default:
+     * - If we're using per-device interemap tables, per-device
+     *   vector non-sharing maps
+     * - If we're using a global interemap table, global vector
+     *   non-sharing map
+     */
+    if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_DEFAULT )
     {
-        printk("AMD-Vi: Enabling per-device vector maps\n");
-        opt_irq_perdev_vector_map=1;
+        if ( amd_iommu_perdev_intremap )
+        {
+            printk("AMD-Vi: Enabling per-device vector maps\n");
+            opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_PERDEV;
+        }
+        else
+        {
+            printk("AMD-Vi: Enabling global vector map\n");
+            opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_GLOBAL;
+        }
     }
     else
     {
-        printk("AMD-Vi: WARNING - not enabling per-device vector maps\n");
+        printk("AMD-Vi: Not overriding irq_vector_map setting\n");
     }
-
     return scan_pci_devices();
 }
 
diff -r f1349a968a5a -r 32814ad7458d xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Fri Sep 02 14:56:26 2011 +0100
+++ b/xen/include/asm-x86/irq.h	Mon Sep 05 15:00:15 2011 +0100
@@ -46,6 +46,13 @@
 
 extern bool_t opt_noirqbalance;
 
+#define OPT_IRQ_VECTOR_MAP_DEFAULT 0 /* Do the default thing  */
+#define OPT_IRQ_VECTOR_MAP_NONE    1 /* None */ 
+#define OPT_IRQ_VECTOR_MAP_GLOBAL  2 /* One global vector map (no vector sharing) */ 
+#define OPT_IRQ_VECTOR_MAP_PERDEV  3 /* Per-device vetor map (no vector sharing w/in a device) */
+
+extern int opt_irq_vector_map;
+
 /*
  * Per-cpu current frame pointer - the location of the last exception frame on
  * the stack

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Mon Sep 05 12:34:39 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 05 Sep 2011 12:34:39 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R0ewI-0004Oq-To; Mon, 05 Sep 2011 12:34:39 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R0euv-0003ws-V8
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 12:33:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1315251190!17129941!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8543 invoked from network); 5 Sep 2011 19:33:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Sep 2011 19:33:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R0eus-0006X9-Lm
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 20:33:10 +0100
Message-Id: <E1R0eus-0006X9-Lm@xenbits.xen.org>
Date: Mon, 05 Sep 2011 20:33:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IRQ: Introduce old_vector to irq_cfg
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1315231764 -3600
# Node ID 7f357e1ef60adf1e43fad97d58721cc2c5309c42
# Parent  9fa77d26a813867ad4c1ac4a78216f27c39f952b
IRQ: Introduce old_vector to irq_cfg

Introduce old_vector to irq_cfg with the same principle as
old_cpu_mask.  This removes a brute force loop from
__clear_irq_vector(), and paves the way to correct bitrotten logic
elsewhere in the irq code.

Signed-off-by Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r 9fa77d26a813 -r 7f357e1ef60a xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Mon Sep 05 15:08:38 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Mon Sep 05 15:09:24 2011 +0100
@@ -488,11 +488,16 @@
         __get_cpu_var(vector_irq)[vector] = -1;
         cfg->move_cleanup_count--;
 
-        if ( cfg->move_cleanup_count == 0 
-             &&  cfg->used_vectors )
+        if ( cfg->move_cleanup_count == 0 )
         {
-            ASSERT(test_bit(vector, cfg->used_vectors));
-            clear_bit(vector, cfg->used_vectors);
+            cfg->old_vector = IRQ_VECTOR_UNASSIGNED;
+            cpus_clear(cfg->old_cpu_mask);
+
+            if ( cfg->used_vectors )
+            {
+                ASSERT(test_bit(vector, cfg->used_vectors));
+                clear_bit(vector, cfg->used_vectors);
+            }
         }
 unlock:
         spin_unlock(&desc->lock);
diff -r 9fa77d26a813 -r 7f357e1ef60a xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Mon Sep 05 15:08:38 2011 +0100
+++ b/xen/arch/x86/irq.c	Mon Sep 05 15:09:24 2011 +0100
@@ -43,8 +43,6 @@
 u8 __read_mostly *irq_vector;
 struct irq_desc __read_mostly *irq_desc = NULL;
 
-#define IRQ_VECTOR_UNASSIGNED (0)
-
 static DECLARE_BITMAP(used_vectors, NR_VECTORS);
 
 struct irq_cfg __read_mostly *irq_cfg = NULL;
@@ -235,15 +233,9 @@
 
     cpus_and(tmp_mask, cfg->old_cpu_mask, cpu_online_map);
     for_each_cpu_mask(cpu, tmp_mask) {
-        for (vector = FIRST_DYNAMIC_VECTOR; vector <= LAST_DYNAMIC_VECTOR;
-                                vector++) {
-            if (per_cpu(vector_irq, cpu)[vector] != irq)
-                continue;
-            TRACE_3D(TRC_HW_IRQ_MOVE_FINISH,
-                     irq, vector, cpu);
-            per_cpu(vector_irq, cpu)[vector] = -1;
-             break;
-        }
+        ASSERT( per_cpu(vector_irq, cpu)[cfg->old_vector] == irq );
+        TRACE_3D(TRC_HW_IRQ_MOVE_FINISH, irq, vector, cpu);
+        per_cpu(vector_irq, cpu)[cfg->old_vector] = -1;
      }
 
     if ( cfg->used_vectors )
@@ -253,6 +245,8 @@
     }
 
     cfg->move_in_progress = 0;
+    cfg->old_vector = IRQ_VECTOR_UNASSIGNED;
+    cpus_clear(cfg->old_cpu_mask);
 }
 
 void clear_irq_vector(int irq)
@@ -303,6 +297,7 @@
 static void __init init_one_irq_cfg(struct irq_cfg *cfg)
 {
     cfg->vector = IRQ_VECTOR_UNASSIGNED;
+    cfg->old_vector = IRQ_VECTOR_UNASSIGNED;
     cpus_clear(cfg->cpu_mask);
     cpus_clear(cfg->old_cpu_mask);
     cfg->used_vectors = NULL;
@@ -491,6 +486,7 @@
         if (old_vector) {
             cfg->move_in_progress = 1;
             cpus_copy(cfg->old_cpu_mask, cfg->cpu_mask);
+            cfg->old_vector = cfg->vector;
         }
         trace_irq_mask(TRC_HW_IRQ_ASSIGN_VECTOR, irq, vector, &tmp_mask);
         for_each_cpu_mask(new_cpu, tmp_mask)
diff -r 9fa77d26a813 -r 7f357e1ef60a xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Mon Sep 05 15:08:38 2011 +0100
+++ b/xen/include/asm-x86/irq.h	Mon Sep 05 15:09:24 2011 +0100
@@ -28,7 +28,8 @@
 } vmask_t;
 
 struct irq_cfg {
-        int  vector;
+        s16 vector;                  /* vector itself is only 8 bits, */
+        s16 old_vector;              /* but we use -1 for unassigned  */
         cpumask_t cpu_mask;
         cpumask_t old_cpu_mask;
         unsigned move_cleanup_count;
@@ -41,6 +42,8 @@
 #define IRQ_UNUSED      (0)
 #define IRQ_USED        (1)
 
+#define IRQ_VECTOR_UNASSIGNED (-1)
+
 extern struct irq_cfg *irq_cfg;
 
 typedef int vector_irq_t[NR_VECTORS];

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Mon Sep 05 12:34:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 05 Sep 2011 12:34:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R0ewQ-0004S1-AG; Mon, 05 Sep 2011 12:34:46 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R0euu-0003wJ-VH
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 12:33:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1315251189!30341843!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10450 invoked from network); 5 Sep 2011 19:33:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Sep 2011 19:33:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R0eur-0006Wf-MQ
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 20:33:09 +0100
Message-Id: <E1R0eur-0006Wf-MQ@xenbits.xen.org>
Date: Mon, 05 Sep 2011 20:33:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IRQ: Remove bit-rotten code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1315231331 -3600
# Node ID fe44efb1f592c8cbbe924a5aa4858c34ab3f9963
# Parent  5535d7ce2673e54cbd19685f9ed875d42f6f3a5f
IRQ: Remove bit-rotten code

irq_desc.depth is a write only variable.
LEGACY_IRQ_FROM_VECTOR(vec) is never referenced.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
---


diff -r 5535d7ce2673 -r fe44efb1f592 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Mon Sep 05 15:00:46 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Mon Sep 05 15:02:11 2011 +0100
@@ -1967,7 +1967,6 @@
     if ((ret = bind_irq_vector(0, vector, mask_all)))
         printk(KERN_ERR"..IRQ0 is not set correctly with ioapic!!!, err:%d\n", ret);
     
-    irq_desc[0].depth  = 0;
     irq_desc[0].status &= ~IRQ_DISABLED;
 
     /*
diff -r 5535d7ce2673 -r fe44efb1f592 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Mon Sep 05 15:00:46 2011 +0100
+++ b/xen/arch/x86/irq.c	Mon Sep 05 15:02:11 2011 +0100
@@ -202,7 +202,6 @@
     desc->handler->shutdown(irq);
     action = desc->action;
     desc->action  = NULL;
-    desc->depth   = 1;
     desc->msi_desc = NULL;
     desc->handler = &no_irq_type;
     desc->chip_data->used_vectors=NULL;
@@ -302,7 +301,6 @@
     desc->status  = IRQ_DISABLED;
     desc->handler = &no_irq_type;
     desc->action  = NULL;
-    desc->depth   = 1;
     desc->msi_desc = NULL;
     spin_lock_init(&desc->lock);
     cpus_setall(desc->affinity);
@@ -817,7 +815,6 @@
     spin_lock_irqsave(&desc->lock,flags);
     action = desc->action;
     desc->action  = NULL;
-    desc->depth   = 1;
     desc->status |= IRQ_DISABLED;
     desc->handler->shutdown(irq);
     spin_unlock_irqrestore(&desc->lock,flags);
@@ -845,7 +842,6 @@
     }
 
     desc->action  = new;
-    desc->depth   = 0;
     desc->status &= ~IRQ_DISABLED;
     desc->handler->startup(irq);
 
@@ -1424,7 +1420,6 @@
         cpus_clear(action->cpu_eoi_map);
         init_timer(&action->eoi_timer, irq_guest_eoi_timer_fn, desc, 0);
 
-        desc->depth = 0;
         desc->status |= IRQ_GUEST;
         desc->status &= ~IRQ_DISABLED;
         desc->handler->startup(irq);
@@ -1540,7 +1535,6 @@
     BUG_ON(action->in_flight != 0);
 
     /* Disabling IRQ before releasing the desc_lock avoids an IRQ storm. */
-    desc->depth   = 1;
     desc->status |= IRQ_DISABLED;
     desc->handler->disable(irq);
 
diff -r 5535d7ce2673 -r fe44efb1f592 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Mon Sep 05 15:00:46 2011 +0100
+++ b/xen/include/asm-x86/irq.h	Mon Sep 05 15:02:11 2011 +0100
@@ -19,7 +19,6 @@
 #define MSI_IRQ(irq)       ((irq) >= nr_irqs_gsi && (irq) < nr_irqs)
 
 #define LEGACY_VECTOR(irq)          ((irq) + FIRST_LEGACY_VECTOR)
-#define LEGACY_IRQ_FROM_VECTOR(vec) ((vec) - FIRST_LEGACY_VECTOR)
 
 #define irq_to_desc(irq)    (&irq_desc[irq])
 #define irq_cfg(irq)        (&irq_cfg[irq])
diff -r 5535d7ce2673 -r fe44efb1f592 xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Mon Sep 05 15:00:46 2011 +0100
+++ b/xen/include/xen/irq.h	Mon Sep 05 15:02:11 2011 +0100
@@ -72,7 +72,6 @@
     hw_irq_controller *handler;
     struct msi_desc   *msi_desc;
     struct irqaction *action;	/* IRQ action list */
-    unsigned int depth;		/* nested irq disables */
     struct irq_cfg *chip_data;
     int irq;
     spinlock_t lock;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Mon Sep 05 12:34:52 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 05 Sep 2011 12:34:52 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R0ewW-0004VA-PZ; Mon, 05 Sep 2011 12:34:52 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R0euv-0003wY-AH
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 12:33:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1315251190!9578645!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31799 invoked from network); 5 Sep 2011 19:33:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Sep 2011 19:33:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R0eus-0006Wu-5w
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 20:33:10 +0100
Message-Id: <E1R0eus-0006Wu-5w@xenbits.xen.org>
Date: Mon, 05 Sep 2011 20:33:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IRQ: Fold irq_status into irq_cfg
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1315231718 -3600
# Node ID 9fa77d26a813867ad4c1ac4a78216f27c39f952b
# Parent  fe44efb1f592c8cbbe924a5aa4858c34ab3f9963
IRQ: Fold irq_status into irq_cfg

irq_status is an int for each of nr_irqs which represents a single
boolean variable.  Fold it into the bitfield in irq_cfg, which saves
768 bytes per CPU with per-cpu IDTs in use.

Signed-off-by Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r fe44efb1f592 -r 9fa77d26a813 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Mon Sep 05 15:02:11 2011 +0100
+++ b/xen/arch/x86/irq.c	Mon Sep 05 15:08:38 2011 +0100
@@ -43,11 +43,6 @@
 u8 __read_mostly *irq_vector;
 struct irq_desc __read_mostly *irq_desc = NULL;
 
-int __read_mostly *irq_status = NULL;
-#define IRQ_UNUSED      (0)
-#define IRQ_USED        (1)
-#define IRQ_RSVD        (2)
-
 #define IRQ_VECTOR_UNASSIGNED (0)
 
 static DECLARE_BITMAP(used_vectors, NR_VECTORS);
@@ -141,7 +136,7 @@
         ASSERT(!test_bit(vector, cfg->used_vectors));
         set_bit(vector, cfg->used_vectors);
     }
-    irq_status[irq] = IRQ_USED;
+    cfg->used = IRQ_USED;
     if (IO_APIC_IRQ(irq))
         irq_vector[irq] = vector;
     return 0;
@@ -163,7 +158,7 @@
     int irq;
 
     for (irq = nr_irqs_gsi; irq < nr_irqs; irq++)
-        if (irq_status[irq] == IRQ_UNUSED)
+        if (irq_cfg[irq].used == IRQ_UNUSED)
             return irq;
     return -ENOSPC;
 }
@@ -215,8 +210,6 @@
         xfree(action);
 }
 
-static void init_one_irq_status(int irq);
-
 static void __clear_irq_vector(int irq)
 {
     int cpu, vector;
@@ -235,7 +228,7 @@
 
     cfg->vector = IRQ_VECTOR_UNASSIGNED;
     cpus_clear(cfg->cpu_mask);
-    init_one_irq_status(irq);
+    cfg->used = IRQ_UNUSED;
 
     if (likely(!cfg->move_in_progress))
         return;
@@ -307,17 +300,13 @@
     INIT_LIST_HEAD(&desc->rl_link);
 }
 
-static void init_one_irq_status(int irq)
-{
-    irq_status[irq] = IRQ_UNUSED;
-}
-
 static void __init init_one_irq_cfg(struct irq_cfg *cfg)
 {
     cfg->vector = IRQ_VECTOR_UNASSIGNED;
     cpus_clear(cfg->cpu_mask);
     cpus_clear(cfg->old_cpu_mask);
     cfg->used_vectors = NULL;
+    cfg->used = IRQ_UNUSED;
 }
 
 int __init init_irq_data(void)
@@ -331,15 +320,13 @@
 
     irq_desc = xmalloc_array(struct irq_desc, nr_irqs);
     irq_cfg = xmalloc_array(struct irq_cfg, nr_irqs);
-    irq_status = xmalloc_array(int, nr_irqs);
     irq_vector = xmalloc_array(u8, nr_irqs_gsi);
     
-    if ( !irq_desc || !irq_cfg || !irq_status ||! irq_vector )
+    if ( !irq_desc || !irq_cfg ||! irq_vector )
         return -ENOMEM;
 
     memset(irq_desc, 0,  nr_irqs * sizeof(*irq_desc));
     memset(irq_cfg, 0,  nr_irqs * sizeof(*irq_cfg));
-    memset(irq_status, 0,  nr_irqs * sizeof(*irq_status));
     memset(irq_vector, 0, nr_irqs_gsi * sizeof(*irq_vector));
     
     for (irq = 0; irq < nr_irqs; irq++) {
@@ -349,7 +336,6 @@
         desc->chip_data = cfg;
         init_one_irq_desc(desc);
         init_one_irq_cfg(cfg);
-        init_one_irq_status(irq);
     }
 
     /* Never allocate the hypercall vector or Linux/BSD fast-trap vector. */
@@ -459,7 +445,7 @@
     /* This is the only place normal IRQs are ever marked
      * as "in use".  If they're not in use yet, check to see
      * if we need to assign a global vector mask. */
-    if ( irq_status[irq] == IRQ_USED )
+    if ( cfg->used == IRQ_USED )
     {
         irq_used_vectors = cfg->used_vectors;
     }
@@ -512,7 +498,7 @@
         cfg->vector = vector;
         cpus_copy(cfg->cpu_mask, tmp_mask);
 
-        irq_status[irq] = IRQ_USED;
+        cfg->used = IRQ_USED;
         ASSERT((cfg->used_vectors == NULL)
                || (cfg->used_vectors == irq_used_vectors));
         cfg->used_vectors = irq_used_vectors;
diff -r fe44efb1f592 -r 9fa77d26a813 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Mon Sep 05 15:02:11 2011 +0100
+++ b/xen/include/asm-x86/irq.h	Mon Sep 05 15:08:38 2011 +0100
@@ -34,8 +34,13 @@
         unsigned move_cleanup_count;
         vmask_t *used_vectors;
         u8 move_in_progress : 1;
+        u8 used: 1;
 };
 
+/* For use with irq_cfg.used */
+#define IRQ_UNUSED      (0)
+#define IRQ_USED        (1)
+
 extern struct irq_cfg *irq_cfg;
 
 typedef int vector_irq_t[NR_VECTORS];

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Mon Sep 05 12:34:58 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 05 Sep 2011 12:34:58 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R0ewc-0004YJ-FY; Mon, 05 Sep 2011 12:34:58 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R0euw-0003x5-DY
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 12:33:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1315251191!30335313!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22178 invoked from network); 5 Sep 2011 19:33:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Sep 2011 19:33:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R0eut-0006XO-5U
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 20:33:11 +0100
Message-Id: <E1R0eut-0006XO-5U@xenbits.xen.org>
Date: Mon, 05 Sep 2011 20:33:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mem_event: add ref counting for free
	requestslots
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1315231809 -3600
# Node ID 083f10851dd85cf436eb4c26ac9afe78997b2bca
# Parent  7f357e1ef60adf1e43fad97d58721cc2c5309c42
mem_event: add ref counting for free requestslots

If mem_event_check_ring() is called by many vcpus at the same time
before any of them called also mem_event_put_request(), all of the
callers must assume there are enough free slots available in the ring.

Record the number of request producers in mem_event_check_ring() to
keep track of available free slots.

Add a new mem_event_put_req_producers() function to release a request
attempt made in mem_event_check_ring(). Its required for
p2m_mem_paging_populate() because that function can only modify the
p2m type if there are free request slots. But in some cases
p2m_mem_paging_populate() does not actually have to produce another
request when it is known that the same request was already made
earlier by a different vcpu.

mem_event_check_ring() can not return a reference to a free request
slot because there could be multiple references for different vcpus
and the order of mem_event_put_request() calls is not known. As a
result, incomplete requests could be consumed by the ring user.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---


diff -r 7f357e1ef60a -r 083f10851dd8 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Mon Sep 05 15:09:24 2011 +0100
+++ b/xen/arch/x86/mm/mem_event.c	Mon Sep 05 15:10:09 2011 +0100
@@ -37,8 +37,6 @@
 #define mem_event_ring_lock(_d)       spin_lock(&(_d)->mem_event.ring_lock)
 #define mem_event_ring_unlock(_d)     spin_unlock(&(_d)->mem_event.ring_lock)
 
-#define MEM_EVENT_RING_THRESHOLD 4
-
 static int mem_event_enable(struct domain *d, mfn_t ring_mfn, mfn_t shared_mfn)
 {
     int rc;
@@ -109,6 +107,7 @@
     req_prod++;
 
     /* Update ring */
+    d->mem_event.req_producers--;
     front_ring->req_prod_pvt = req_prod;
     RING_PUSH_REQUESTS(front_ring);
 
@@ -153,11 +152,18 @@
     vcpu_sleep_nosync(v);
 }
 
+void mem_event_put_req_producers(struct domain *d)
+{
+    mem_event_ring_lock(d);
+    d->mem_event.req_producers--;
+    mem_event_ring_unlock(d);
+}
+
 int mem_event_check_ring(struct domain *d)
 {
     struct vcpu *curr = current;
     int free_requests;
-    int ring_full;
+    int ring_full = 1;
 
     if ( !d->mem_event.ring_page )
         return -1;
@@ -165,12 +171,11 @@
     mem_event_ring_lock(d);
 
     free_requests = RING_FREE_REQUESTS(&d->mem_event.front_ring);
-    if ( unlikely(free_requests < 2) )
+    if ( d->mem_event.req_producers < free_requests )
     {
-        gdprintk(XENLOG_INFO, "free request slots: %d\n", free_requests);
-        WARN_ON(free_requests == 0);
+        d->mem_event.req_producers++;
+        ring_full = 0;
     }
-    ring_full = free_requests < MEM_EVENT_RING_THRESHOLD ? 1 : 0;
 
     if ( (curr->domain->domain_id == d->domain_id) && ring_full )
     {
diff -r 7f357e1ef60a -r 083f10851dd8 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Mon Sep 05 15:09:24 2011 +0100
+++ b/xen/arch/x86/mm/mem_sharing.c	Mon Sep 05 15:10:09 2011 +0100
@@ -281,7 +281,6 @@
     vcpu_pause_nosync(v);
     req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
 
-    /* XXX: Need to reserve a request, not just check the ring! */
     if(mem_event_check_ring(d)) return page;
 
     req.gfn = gfn;
diff -r 7f357e1ef60a -r 083f10851dd8 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Mon Sep 05 15:09:24 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Mon Sep 05 15:10:09 2011 +0100
@@ -803,6 +803,7 @@
     else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
     {
         /* gfn is already on its way back and vcpu is not paused */
+        mem_event_put_req_producers(d);
         return;
     }
 
diff -r 7f357e1ef60a -r 083f10851dd8 xen/include/asm-x86/mem_event.h
--- a/xen/include/asm-x86/mem_event.h	Mon Sep 05 15:09:24 2011 +0100
+++ b/xen/include/asm-x86/mem_event.h	Mon Sep 05 15:10:09 2011 +0100
@@ -27,6 +27,7 @@
 /* Pauses VCPU while marking pause flag for mem event */
 void mem_event_mark_and_pause(struct vcpu *v);
 int mem_event_check_ring(struct domain *d);
+void mem_event_put_req_producers(struct domain *d);
 void mem_event_put_request(struct domain *d, mem_event_request_t *req);
 void mem_event_get_response(struct domain *d, mem_event_response_t *rsp);
 void mem_event_unpause_vcpus(struct domain *d);
diff -r 7f357e1ef60a -r 083f10851dd8 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h	Mon Sep 05 15:09:24 2011 +0100
+++ b/xen/include/xen/sched.h	Mon Sep 05 15:10:09 2011 +0100
@@ -183,6 +183,7 @@
 {
     /* ring lock */
     spinlock_t ring_lock;
+    unsigned int req_producers;
     /* shared page */
     mem_event_shared_page_t *shared_page;
     /* shared ring page */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Mon Sep 05 12:35:10 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 05 Sep 2011 12:35:10 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R0ewn-0004cl-Pk; Mon, 05 Sep 2011 12:35:09 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R0euw-0003xH-ND
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 12:33:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1315251191!32940035!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20479 invoked from network); 5 Sep 2011 19:33:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Sep 2011 19:33:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R0eut-0006Xd-KW
	for xen-changelog@lists.xensource.com; Mon, 05 Sep 2011 20:33:11 +0100
Message-Id: <E1R0eut-0006Xd-KW@xenbits.xen.org>
Date: Mon, 05 Sep 2011 20:33:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mem_event: use
	mem_event_mark_and_pause() in mem_event_check_ring()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1315231828 -3600
# Node ID 0268e73809532a4a3ca18a075efcee3c62caf458
# Parent  083f10851dd85cf436eb4c26ac9afe78997b2bca
mem_event: use mem_event_mark_and_pause() in mem_event_check_ring()

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---


diff -r 083f10851dd8 -r 0268e7380953 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Mon Sep 05 15:10:09 2011 +0100
+++ b/xen/arch/x86/mm/mem_event.c	Mon Sep 05 15:10:28 2011 +0100
@@ -178,10 +178,7 @@
     }
 
     if ( (curr->domain->domain_id == d->domain_id) && ring_full )
-    {
-        set_bit(_VPF_mem_event, &curr->pause_flags);
-        vcpu_sleep_nosync(curr);
-    }
+        mem_event_mark_and_pause(curr);
 
     mem_event_ring_unlock(d);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 06 12:34:38 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 06 Sep 2011 12:34:38 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R11Pq-0000i9-5y; Tue, 06 Sep 2011 12:34:38 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R11OT-0000E1-Nk
	for xen-changelog@lists.xensource.com; Tue, 06 Sep 2011 12:33:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1315337568!53855277!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14186 invoked from network); 6 Sep 2011 19:32:48 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Sep 2011 19:32:48 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R11OP-0005ym-RD
	for xen-changelog@lists.xensource.com; Tue, 06 Sep 2011 20:33:09 +0100
Message-Id: <E1R11OP-0005ym-RD@xenbits.xen.org>
Date: Tue, 06 Sep 2011 20:33:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Fix 'make docs'
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1315320580 -3600
# Node ID 5fe770c8a8a35c58893816ee6335a90ed43f3bbd
# Parent  0268e73809532a4a3ca18a075efcee3c62caf458
docs: Fix 'make docs'

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 0268e7380953 -r 5fe770c8a8a3 docs/src/user.tex
--- a/docs/src/user.tex	Mon Sep 05 15:10:28 2011 +0100
+++ b/docs/src/user.tex	Tue Sep 06 15:49:40 2011 +0100
@@ -2280,7 +2280,7 @@
 \item [ vcpu\_migration\_delay=$<$minimum\_time$>$] Set minimum time of 
   vcpu migration in microseconds (default 0). This parameter avoids agressive
   vcpu migration. For example, the linux kernel uses 0.5ms by default.
-\item [ irq_vector_map=xxx ] Enable irq vector non-sharing maps.  Setting 'global' 
+\item [ irq\_vector\_map=xxx ] Enable irq vector non-sharing maps.  Setting 'global' 
   will ensure that no  IRQs will share vectors.  Setting 'per-device' will ensure 
   that no IRQs from the same device will share vectors.  Setting to 'none' will
   disable it entirely, overriding any defaults the IOMMU code may set.

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 07 13:44:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 07 Sep 2011 13:44:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1Oym-000777-Mj; Wed, 07 Sep 2011 13:44:16 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1Oyi-00076S-Rh
	for xen-changelog@lists.xensource.com; Wed, 07 Sep 2011 13:44:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1315428249!24581549!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27554 invoked from network); 7 Sep 2011 20:44:09 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Sep 2011 20:44:09 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1Oyf-0004H4-5A
	for xen-changelog@lists.xensource.com; Wed, 07 Sep 2011 21:44:09 +0100
Message-Id: <E1R1Oyf-0004H4-5A@xenbits.xen.org>
Date: Wed, 07 Sep 2011 21:44:08 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] bitmap_scnlistprintf() should
	always zero-terminate its output buffer
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1315388399 -3600
# Node ID c4172ba1a98bdc75e99bb2e50ea956adbf9fdbe7
# Parent  6239209bb560b4931d4d97456c82c1a5ca4bd10a
bitmap_scnlistprintf() should always zero-terminate its output buffer

... as long as it has non-zero size. So far this would not happen if
the passed in CPU mask was empty.

Also fix the comment describing the return value to actually match
reality.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen-unstable changeset:   23820:ba75234a6f56
xen-unstable date:        Wed Sep 07 10:36:55 2011 +0100
---


diff -r 6239209bb560 -r c4172ba1a98b xen/common/bitmap.c
--- a/xen/common/bitmap.c	Wed Aug 31 15:32:47 2011 +0100
+++ b/xen/common/bitmap.c	Wed Sep 07 10:39:59 2011 +0100
@@ -363,9 +363,8 @@
  * the range.  Output format is compatible with the format
  * accepted as input by bitmap_parselist().
  *
- * The return value is the number of characters which would be
- * generated for the given input, excluding the trailing '\0', as
- * per ISO C99.
+ * The return value is the number of characters which were output,
+ * excluding the trailing '\0'.
  */
 int bitmap_scnlistprintf(char *buf, unsigned int buflen,
 	const unsigned long *maskp, int nmaskbits)
@@ -383,6 +382,8 @@
 			rbot = cur;
 		}
 	}
+	if (!len && buflen)
+		*buf = 0;
 	return len;
 }
 EXPORT_SYMBOL(bitmap_scnlistprintf);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 07 13:44:25 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 07 Sep 2011 13:44:25 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1Oyv-0007AG-KM; Wed, 07 Sep 2011 13:44:25 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1Oyj-00076T-2w
	for xen-changelog@lists.xensource.com; Wed, 07 Sep 2011 13:44:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1315428249!17445728!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13230 invoked from network); 7 Sep 2011 20:44:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Sep 2011 20:44:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1Oyf-0004HJ-MD
	for xen-changelog@lists.xensource.com; Wed, 07 Sep 2011 21:44:09 +0100
Message-Id: <E1R1Oyf-0004HJ-MD@xenbits.xen.org>
Date: Wed, 07 Sep 2011 21:44:09 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Update Xen version to 4.1.2-rc2
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1315388442 -3600
# Node ID 3e6a3bf83935cc2460707b94ef2801bb6f19d581
# Parent  c4172ba1a98bdc75e99bb2e50ea956adbf9fdbe7
Update Xen version to 4.1.2-rc2
---


diff -r c4172ba1a98b -r 3e6a3bf83935 xen/Makefile
--- a/xen/Makefile	Wed Sep 07 10:39:59 2011 +0100
+++ b/xen/Makefile	Wed Sep 07 10:40:42 2011 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 1
-export XEN_EXTRAVERSION ?= .2-rc2-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2-rc2$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 07 13:44:35 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 07 Sep 2011 13:44:35 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1Oz5-0007Dc-Cp; Wed, 07 Sep 2011 13:44:35 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1Oyj-00076U-OV
	for xen-changelog@lists.xensource.com; Wed, 07 Sep 2011 13:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1315428250!24264588!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25861 invoked from network); 7 Sep 2011 20:44:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Sep 2011 20:44:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1Oyg-0004HY-6H
	for xen-changelog@lists.xensource.com; Wed, 07 Sep 2011 21:44:10 +0100
Message-Id: <E1R1Oyg-0004HY-6H@xenbits.xen.org>
Date: Wed, 07 Sep 2011 21:44:09 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Added tag 4.1.2-rc2 for changeset
	3e6a3bf83935
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1315388451 -3600
# Node ID be0040eb0a360dba8010be4d95712a0c64a40537
# Parent  3e6a3bf83935cc2460707b94ef2801bb6f19d581
Added tag 4.1.2-rc2 for changeset 3e6a3bf83935
---


diff -r 3e6a3bf83935 -r be0040eb0a36 .hgtags
--- a/.hgtags	Wed Sep 07 10:40:42 2011 +0100
+++ b/.hgtags	Wed Sep 07 10:40:51 2011 +0100
@@ -59,3 +59,4 @@
 e302291362a41edc294344addda9ed0685485c06 4.1.1-rc2
 ab0e3dac2c63434cd88466bdd4e89ad0075fdec4 RELEASE-4.1.1
 1f21da33dea4acb2dbfb988bcd1b7898e019316c 4.1.2-rc1
+3e6a3bf83935cc2460707b94ef2801bb6f19d581 4.1.2-rc2

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 07 13:44:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 07 Sep 2011 13:44:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1OzG-0007Gq-2V; Wed, 07 Sep 2011 13:44:46 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1Oyj-00076V-Se
	for xen-changelog@lists.xensource.com; Wed, 07 Sep 2011 13:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1315428250!12472328!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32538 invoked from network); 7 Sep 2011 20:44:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Sep 2011 20:44:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1Oyg-0004Hn-Kp
	for xen-changelog@lists.xensource.com; Wed, 07 Sep 2011 21:44:10 +0100
Message-Id: <E1R1Oyg-0004Hn-Kp@xenbits.xen.org>
Date: Wed, 07 Sep 2011 21:44:10 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Added signature for changeset
	3e6a3bf83935
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1315388461 -3600
# Node ID 2376070f6685cf7967ab5f1e2a0fb4b069a4124b
# Parent  be0040eb0a360dba8010be4d95712a0c64a40537
Added signature for changeset 3e6a3bf83935
---


diff -r be0040eb0a36 -r 2376070f6685 .hgsigs
--- a/.hgsigs	Wed Sep 07 10:40:51 2011 +0100
+++ b/.hgsigs	Wed Sep 07 10:41:01 2011 +0100
@@ -12,3 +12,4 @@
 e302291362a41edc294344addda9ed0685485c06 0 iQEcBAABAgAGBQJN6J2ZAAoJEIP+FMlX6CvZpI4H/ArKY+yNmSShbjDWZOyqmNvdOlZb37UgONPmrt41OoF5F2ZNo23kY4Kur69O/zz4BdQCkNpR5oEaABY5UwBg648nwTCbkBlRpZY2bZmgT5KCBKlaleMdTm3KkRXr3yxwa45GkYgnmg5L7UDYCKRuHW3pom1PQpo9X2VXNcPCdc2hf2deWLf0PlHrG4BDBzPVZ306PfumEb3ZCWulff8eM2D63pd520NqWf0eJh8HyEFPaKX/3EvrkguP8WnhOV/HpLwMt983q0LBUEQiauBl+BwhpnMOKQSY0DQSchF/Tlk1Lq1wA2mfQ/Th6Zx6zSjIdQ9sb+dbnKkLfBRmx/VTuBI=
 ab0e3dac2c63434cd88466bdd4e89ad0075fdec4 0 iQEcBAABAgAGBQJN91v3AAoJEIP+FMlX6CvZqDkIAK34QbQOOWaOVNI0xnDW2tj3Uu7sJZ5NqSfwg7FiFnL+lb7N/jJnjL4AIn22UIJnpf5GxjmFII4Aw2xc1dHRlznxaXFPNrh6ZTL7GhRuZvQi7/kR/bgc2Io9B+Gcu9gZaRzakU5kOYt5Sv5JmVz4eJcIxblNrh6+mdzkGLjUERuC9/Ovd2fGvXYtCkOsSkyXAUyJGGui+kDAqowFMzZuxRukislO94x4P9dkVpIaX/5n67/sCo5P9DeyDrkHtAShX8DOIFhujilgRDjcB54NESRixoLntFYrqce1OWKlEG4ssE5s6wtrrPgADx92PIkqMfWrUIXx6YVd0GWjzj1Q4TU=
 1f21da33dea4acb2dbfb988bcd1b7898e019316c 0 iQEcBAABAgAGBQJOViYyAAoJEIP+FMlX6CvZew0IAKJ/gjTWVmD9cBEN6XJYYW+z831Hsm4Msk9QBskJiV2cVFcaF9/SzexnC6waU1BpxMCLWNusaPl18Uc2knF0kYyXAjeWDZNcRZtcZIS/kDzPBIAGkq4wI+DA4nfFCnYNsFk9dy5aqkvVOVpvn7E6fUcOtWQC+IfuOrMo6mRjew4dPlv3xhwYgf2oQf9I1YLoJ6UVh0o1g0jHeXhYZu8Fqm/a4O0kdbvUDHuViVT0qHhGIi6dLkD0w/ih+o7S3FAMXLpLVBdt23bVBti4jwFMnMEgy2wkP4lbfM++1Io//Bn7tg4CZcNHYt6a7ENmhL+lmTbh0GyteZ9sgbfricSFkGc=
+3e6a3bf83935cc2460707b94ef2801bb6f19d581 0 iQEcBAABAgAGBQJOZzwsAAoJEIP+FMlX6CvZXBIIAJFb+nUaqTCQRT5cE1mn4n5lEdtBY7L/ar4/rzWAiavQYkaoP93HyOdo0sf2SdwcpTNCXw0TDUmZU3xMqBiwWwp2MX3AFM/0dnPv2CoIH/k3vXr26eBJo15w2dFu2dF8OZ/Tn0NTdXdPd+qa7ugqVqT0PYgyQ8+euQJfcdYAY6YCjGD4v5cX529oB2aqoFKBBsHMnW6uD3OYf3sdvj85wgVpip7nw+5OZWrYP2lK/RXzlo42B/l+fNPJjsM8uU928ETNevJGPK28EJDaNwrEktTJQJYNa6K1oal/kpNP6FM1pOOdel69NSGbMw4Obv0eZ/kZahBLONfCLw4kYVggmWg=

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 07 18:34:08 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 07 Sep 2011 18:34:08 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1TVH-00052h-Ei; Wed, 07 Sep 2011 18:34:07 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1TUe-0004kv-HC
	for xen-changelog@lists.xensource.com; Wed, 07 Sep 2011 18:33:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1315445605!17320052!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13345 invoked from network); 8 Sep 2011 01:33:25 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 01:33:25 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1TUa-00022C-9S
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 02:33:24 +0100
Message-Id: <E1R1TUa-00022C-9S@xenbits.xen.org>
Date: Thu, 08 Sep 2011 02:33:23 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Update Xen version to 4.0.3-rc2
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1315388495 -3600
# Node ID 8d012bc20d3063d76b851d9909da6f9fa8ef469c
# Parent  0383662ea34cb24314ff614a6abed8294e6c14c3
Update Xen version to 4.0.3-rc2
---


diff -r 0383662ea34c -r 8d012bc20d30 xen/Makefile
--- a/xen/Makefile	Wed Aug 31 15:37:57 2011 +0100
+++ b/xen/Makefile	Wed Sep 07 10:41:35 2011 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 0
-export XEN_EXTRAVERSION ?= .3-rc2-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .3-rc2$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 07 18:34:13 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 07 Sep 2011 18:34:13 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1TVN-00055f-Kk; Wed, 07 Sep 2011 18:34:13 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1TUe-0004ky-KC
	for xen-changelog@lists.xensource.com; Wed, 07 Sep 2011 18:33:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1315445605!30626841!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29485 invoked from network); 8 Sep 2011 01:33:25 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 01:33:25 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1TUb-000235-1E
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 02:33:25 +0100
Message-Id: <E1R1TUb-000235-1E@xenbits.xen.org>
Date: Thu, 08 Sep 2011 02:33:24 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Added tag 4.0.3-rc2 for changeset
	8d012bc20d30
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1315388501 -3600
# Node ID b7b51fd533d3f85e9b72dc5de1caa34c736e81fc
# Parent  8d012bc20d3063d76b851d9909da6f9fa8ef469c
Added tag 4.0.3-rc2 for changeset 8d012bc20d30
---


diff -r 8d012bc20d30 -r b7b51fd533d3 .hgtags
--- a/.hgtags	Wed Sep 07 10:41:35 2011 +0100
+++ b/.hgtags	Wed Sep 07 10:41:41 2011 +0100
@@ -61,3 +61,4 @@
 4c39fa80900da554a16ac7a6c053288bc53a99b0 4.0.2-rc6
 e7ec1f3ebed8ddc28ec5e80ac520c8b9abdae132 RELEASE-4.0.2
 47f9c9648fe7b531e41575a2bf0b0234037985b4 4.0.3-rc1
+8d012bc20d3063d76b851d9909da6f9fa8ef469c 4.0.3-rc2

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 07 18:34:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 07 Sep 2011 18:34:21 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1TVU-000597-Ti; Wed, 07 Sep 2011 18:34:20 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1TUf-0004lK-6q
	for xen-changelog@lists.xensource.com; Wed, 07 Sep 2011 18:33:30 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1315445605!30629855!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13286 invoked from network); 8 Sep 2011 01:33:26 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 01:33:26 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1TUb-00023Y-OR
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 02:33:25 +0100
Message-Id: <E1R1TUb-00023Y-OR@xenbits.xen.org>
Date: Thu, 08 Sep 2011 02:33:25 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Added signature for changeset
	8d012bc20d30
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1315388509 -3600
# Node ID b44346a6975c772853a36c9b8d86ecf7897ec4cd
# Parent  b7b51fd533d3f85e9b72dc5de1caa34c736e81fc
Added signature for changeset 8d012bc20d30
---


diff -r b7b51fd533d3 -r b44346a6975c .hgsigs
--- a/.hgsigs	Wed Sep 07 10:41:41 2011 +0100
+++ b/.hgsigs	Wed Sep 07 10:41:49 2011 +0100
@@ -14,3 +14,4 @@
 4c39fa80900da554a16ac7a6c053288bc53a99b0 0 iQEcBAABAgAGBQJN6J6dAAoJEIP+FMlX6CvZl5gIAKrbajO5/HY1rfF2l74WUoS6SxgsWkK+NYyE/rR2QnBkoTBpk1J2QFuWRVAs3LgU3GAICRWwWAoKQoXfj4QJJvzTXgmwNkKXcYJ+YGn7skMqoQC05srNcSkWABsv3/dFWFrj4pPvYcxgHlQKE72zkr6mDkVH2MAXTvNBn8tmf+tsczt60p5X7p5khXDj1+TsXkcAAueeI2sbgzeZ83gumnFYcEk/8LyzJoK8JNhb3KSfY8YG8R9ET8q6PkmekA8W8ZWtue03pnCc8fchNks83TvQaxvSFWdbd9FWuOh1IkGLowYLYp+lE/sP93lyIuPqlnhtbbbmFgjaYLeJ0CIUFno=
 e7ec1f3ebed8ddc28ec5e80ac520c8b9abdae132 0 iQEcBAABAgAGBQJN91w/AAoJEIP+FMlX6CvZygEH/R2nEvUKTT1c9TAWZsw8H3twG8o3Ka7w6M9QP3kGLQllIxkpPh5mWZoQaBVWx5JO5KlxRO55PlGKLukSks21M6gi8qCMwUaO/EZjpP2ciYIRxoovyfxp0rNID31mxWJBela4aVNy9LZ+klFKyV16wycBLQTNxfp29ZGtE2/ex7XMv4LWihAOqUqRXo35SKZuolbCYY0qmBXcvjD8iwgkucFLFPVDOq2YmW47flQREF2IOKzeHBwfDoB4nNVJW8MA5snJ7Wg+IJlvnRFF4Ks/Y784Nhkbw0mfYVNij0eovbI9Tfs1FXcz/YlZXFdsadV9N+c1ABJsBBX3ZNbvEKl4bJ8=
 47f9c9648fe7b531e41575a2bf0b0234037985b4 0 iQEcBAABAgAGBQJOViZ/AAoJEIP+FMlX6CvZovAH/2C6X/PU9h9Q8Way8NTGmZsJroS0OlPpiYoBQ/BAgha0NxO6pKiuCcuGwApcvMnDTly3UyJzrh5uf5E2Qfl5N3Zwg0fRNvpzArN8JjTZQI3yr0iDc1FioVRpllPQCKVrFkB5UUuAkXRlOJLkPc78PNaWdYvEl9lPQdyXwg1GwGsSjomH4HI4UmB1uWsx0TgNaywN1l7FZ77Ny1u7VVOczSSBFlhI1shXqCXgbMRW2pxMCNkiV6kozYuHKFzwK/ZAFSrw1d9bgVjTsSrjkAuaMTnSIFoVSpOsv0zJZnIlhKe0ChpbU90OcM2Pol3CoJIdvHZOL2Gi2T04Js+iKW25nV8=
+8d012bc20d3063d76b851d9909da6f9fa8ef469c 0 iQEcBAABAgAGBQJOZzxcAAoJEIP+FMlX6CvZtR4H+wS6lQUaNK71V/mXuiPz4Y30pKv3w419IfW9ICA6unfxm+IkCbR4QEtO/6aZkU7Q1ZYSDfIyzA60E/rHcU5ZJ27lCvaedrYa4A8W9Ry7+e31MYvG+fvZAO2ZIPRks+HAg79joU10xUKQirTQi436viBL5NrN1R12Y5B75ue6YHhkuhI0XUv9l5MbO4utsTki3YqKTmsZbPCvzymZr0dXG8t7U7AWxbXTfzyKxsoCg7HdYzEPufhIe903xEhQaiSXSSUz78wUCN4KxXGubejEu2/09L4SRzoxV6Mw1K39EqtrisZVazsuy+aEobK5B9U/JGzjGK/CNlw+LobkW2qvMrE=

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 08 06:33:14 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 08 Sep 2011 06:33:14 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1ejC-0007Xb-OT; Thu, 08 Sep 2011 06:33:14 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1ejA-0007Wy-Fa
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 06:33:12 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1315488757!47372481!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28633 invoked from network); 8 Sep 2011 13:32:37 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 13:32:37 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1ej7-0007ef-BL
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 14:33:09 +0100
Message-Id: <E1R1ej7-0007ef-BL@xenbits.xen.org>
Date: Thu, 08 Sep 2011 14:33:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: remove unnecessary indirection
	from irq_complete_move()'s sole parameter
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1315388240 -3600
# Node ID 88065fb8d0aa214d032d76bd4480aa9ba5578b15
# Parent  ba75234a6f56ec349af46edec5dfae2fbb998976
x86: remove unnecessary indirection from irq_complete_move()'s sole parameter

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r ba75234a6f56 -r 88065fb8d0aa xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Wed Sep 07 10:36:55 2011 +0100
+++ b/xen/arch/x86/hpet.c	Wed Sep 07 10:37:20 2011 +0100
@@ -296,7 +296,7 @@
 {
     struct irq_desc *desc = irq_to_desc(irq);
 
-    irq_complete_move(&desc);
+    irq_complete_move(desc);
     move_native_irq(irq);
     ack_APIC_irq();
 }
diff -r ba75234a6f56 -r 88065fb8d0aa xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Wed Sep 07 10:36:55 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Wed Sep 07 10:37:20 2011 +0100
@@ -518,9 +518,8 @@
     cfg->move_in_progress = 0;
 }
 
-void irq_complete_move(struct irq_desc **descp)
+void irq_complete_move(struct irq_desc *desc)
 {
-    struct irq_desc *desc = *descp;
     struct irq_cfg *cfg = desc->chip_data;
     unsigned vector, me;
 
@@ -1569,7 +1568,7 @@
 {
     struct irq_desc *desc = irq_to_desc(irq);
     
-    irq_complete_move(&desc);
+    irq_complete_move(desc);
     move_native_irq(irq);
 
     if ((desc->status & (IRQ_PENDING | IRQ_DISABLED))
@@ -1648,7 +1647,7 @@
     int i;
     struct irq_desc *desc = irq_to_desc(irq);
 
-    irq_complete_move(&desc);
+    irq_complete_move(desc);
 
     if ( ioapic_ack_new )
         return;
@@ -1821,7 +1820,7 @@
 {
     struct irq_desc *desc = irq_to_desc(irq);
 
-    irq_complete_move(&desc);
+    irq_complete_move(desc);
     move_native_irq(irq);
 
     if ( msi_maskable_irq(desc->msi_desc) )
diff -r ba75234a6f56 -r 88065fb8d0aa xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Wed Sep 07 10:36:55 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Wed Sep 07 10:37:20 2011 +0100
@@ -424,7 +424,7 @@
     struct amd_iommu *iommu = irq_to_iommu[irq];
     struct irq_desc *desc = irq_to_desc(irq);
 
-    irq_complete_move(&desc);
+    irq_complete_move(desc);
 
     /* FIXME: do not support mask bits at the moment */
     if ( iommu->maskbit )
diff -r ba75234a6f56 -r 88065fb8d0aa xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Wed Sep 07 10:36:55 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Sep 07 10:37:20 2011 +0100
@@ -978,7 +978,7 @@
     struct iommu *iommu = irq_to_iommu[irq];
     struct irq_desc *desc = irq_to_desc(irq);
 
-    irq_complete_move(&desc);
+    irq_complete_move(desc);
 
     /* mask it */
     spin_lock_irqsave(&iommu->register_lock, flags);
diff -r ba75234a6f56 -r 88065fb8d0aa xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Wed Sep 07 10:36:55 2011 +0100
+++ b/xen/include/asm-x86/irq.h	Wed Sep 07 10:37:20 2011 +0100
@@ -162,7 +162,7 @@
 void destroy_irq(unsigned int irq);
 
 struct irq_desc;
-extern void irq_complete_move(struct irq_desc **descp);
+extern void irq_complete_move(struct irq_desc *);
 
 extern struct irq_desc *irq_desc;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 08 06:33:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 08 Sep 2011 06:33:21 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1ejJ-0007aT-FZ; Thu, 08 Sep 2011 06:33:21 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1ejA-0007Wz-Qr
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 06:33:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1315488761!54103102!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14870 invoked from network); 8 Sep 2011 13:32:41 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 13:32:41 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1ej7-0007eu-Qj
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 14:33:09 +0100
Message-Id: <E1R1ej7-0007eu-Qj@xenbits.xen.org>
Date: Thu, 08 Sep 2011 14:33:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] p2m-ept: remove map_domain_page check
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1315388268 -3600
# Node ID bdd19847ae63b5dfb036e228cb16ec3ae678e995
# Parent  88065fb8d0aa214d032d76bd4480aa9ba5578b15
p2m-ept: remove map_domain_page check

map_domain_page() can not fail, remove ASSERT in ept_set_entry().

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---


diff -r 88065fb8d0aa -r bdd19847ae63 xen/arch/x86/mm/p2m-ept.c
--- a/xen/arch/x86/mm/p2m-ept.c	Wed Sep 07 10:37:20 2011 +0100
+++ b/xen/arch/x86/mm/p2m-ept.c	Wed Sep 07 10:37:48 2011 +0100
@@ -332,8 +332,6 @@
 
     table = map_domain_page(ept_get_asr(d));
 
-    ASSERT(table != NULL);
-
     for ( i = ept_get_wl(d); i > target; i-- )
     {
         ret = ept_next_level(p2m, 0, &table, &gfn_remainder, i);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 08 06:33:30 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 08 Sep 2011 06:33:30 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1ejR-0007dd-Qb; Thu, 08 Sep 2011 06:33:29 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1ejE-0007XB-DY
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 06:33:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1315488789!24370299!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 778 invoked from network); 8 Sep 2011 13:33:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 13:33:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1ej6-0007eQ-Qu
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 14:33:08 +0100
Message-Id: <E1R1ej6-0007eQ-Qu@xenbits.xen.org>
Date: Thu, 08 Sep 2011 14:33:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] bitmap_scnlistprintf() should always
	zero-terminate its output buffer
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1315388215 -3600
# Node ID ba75234a6f56ec349af46edec5dfae2fbb998976
# Parent  5fe770c8a8a35c58893816ee6335a90ed43f3bbd
bitmap_scnlistprintf() should always zero-terminate its output buffer

... as long as it has non-zero size. So far this would not happen if
the passed in CPU mask was empty.

Also fix the comment describing the return value to actually match
reality.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 5fe770c8a8a3 -r ba75234a6f56 xen/common/bitmap.c
--- a/xen/common/bitmap.c	Tue Sep 06 15:49:40 2011 +0100
+++ b/xen/common/bitmap.c	Wed Sep 07 10:36:55 2011 +0100
@@ -363,9 +363,8 @@
  * the range.  Output format is compatible with the format
  * accepted as input by bitmap_parselist().
  *
- * The return value is the number of characters which would be
- * generated for the given input, excluding the trailing '\0', as
- * per ISO C99.
+ * The return value is the number of characters which were output,
+ * excluding the trailing '\0'.
  */
 int bitmap_scnlistprintf(char *buf, unsigned int buflen,
 	const unsigned long *maskp, int nmaskbits)
@@ -383,6 +382,8 @@
 			rbot = cur;
 		}
 	}
+	if (!len && buflen)
+		*buf = 0;
 	return len;
 }
 EXPORT_SYMBOL(bitmap_scnlistprintf);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 08 10:45:27 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 08 Sep 2011 10:45:27 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1ifH-0001tS-6X; Thu, 08 Sep 2011 10:45:27 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1ie5-0001Iv-QJ
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 10:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1315503850!17455362!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8296 invoked from network); 8 Sep 2011 17:44:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 17:44:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1ie2-0007Fy-IU
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 18:44:10 +0100
Message-Id: <E1R1ie2-0007Fy-IU@xenbits.xen.org>
Date: Thu, 08 Sep 2011 18:44:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: adjust paging interface to
	return superpage sizes
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1315491186 -3600
# Node ID ac33d68e89767d49113824e5661c49a5465a18e7
# Parent  04e2fd7379d07cc0d2da9dc9da50a2b54c198f13
x86/mm: adjust paging interface to return superpage sizes
to the caller of paging_ga_to_gfn_cr3()

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 04e2fd7379d0 -r ac33d68e8976 xen/arch/x86/mm/hap/guest_walk.c
--- a/xen/arch/x86/mm/hap/guest_walk.c	Thu Sep 08 15:13:06 2011 +0100
+++ b/xen/arch/x86/mm/hap/guest_walk.c	Thu Sep 08 15:13:06 2011 +0100
@@ -43,12 +43,12 @@
     struct vcpu *v, struct p2m_domain *p2m, unsigned long gva, uint32_t *pfec)
 {
     unsigned long cr3 = v->arch.hvm_vcpu.guest_cr[3];
-    return hap_p2m_ga_to_gfn(GUEST_PAGING_LEVELS)(v, p2m, cr3, gva, pfec);
+    return hap_p2m_ga_to_gfn(GUEST_PAGING_LEVELS)(v, p2m, cr3, gva, pfec, NULL);
 }
 
 unsigned long hap_p2m_ga_to_gfn(GUEST_PAGING_LEVELS)(
     struct vcpu *v, struct p2m_domain *p2m, unsigned long cr3,
-    paddr_t ga, uint32_t *pfec)
+    paddr_t ga, uint32_t *pfec, unsigned int *page_order)
 {
     uint32_t missing;
     mfn_t top_mfn;
@@ -107,6 +107,9 @@
             return INVALID_GFN;
         }
 
+        if ( page_order )
+            *page_order = guest_walk_to_page_order(&gw);
+
         return gfn_x(gfn);
     }
 
diff -r 04e2fd7379d0 -r ac33d68e8976 xen/arch/x86/mm/hap/hap.c
--- a/xen/arch/x86/mm/hap/hap.c	Thu Sep 08 15:13:06 2011 +0100
+++ b/xen/arch/x86/mm/hap/hap.c	Thu Sep 08 15:13:06 2011 +0100
@@ -897,8 +897,10 @@
 
 static unsigned long hap_p2m_ga_to_gfn_real_mode(
     struct vcpu *v, struct p2m_domain *p2m, unsigned long cr3,
-    paddr_t ga, uint32_t *pfec)
+    paddr_t ga, uint32_t *pfec, unsigned int *page_order)
 {
+    if ( page_order )
+        *page_order = PAGE_ORDER_4K;
     return (ga >> PAGE_SHIFT);
 }
 
diff -r 04e2fd7379d0 -r ac33d68e8976 xen/arch/x86/mm/hap/nested_hap.c
--- a/xen/arch/x86/mm/hap/nested_hap.c	Thu Sep 08 15:13:06 2011 +0100
+++ b/xen/arch/x86/mm/hap/nested_hap.c	Thu Sep 08 15:13:06 2011 +0100
@@ -162,7 +162,7 @@
     nested_cr3 = nhvm_vcpu_hostcr3(v);
 
     /* Walk the guest-supplied NPT table, just as if it were a pagetable */
-    gfn = paging_ga_to_gfn_cr3(v, nested_cr3, L2_gpa, &pfec);
+    gfn = paging_ga_to_gfn_cr3(v, nested_cr3, L2_gpa, &pfec, NULL);
 
     if ( gfn == INVALID_GFN ) 
         return NESTEDHVM_PAGEFAULT_INJECT;
diff -r 04e2fd7379d0 -r ac33d68e8976 xen/arch/x86/mm/hap/private.h
--- a/xen/arch/x86/mm/hap/private.h	Thu Sep 08 15:13:06 2011 +0100
+++ b/xen/arch/x86/mm/hap/private.h	Thu Sep 08 15:13:06 2011 +0100
@@ -40,12 +40,12 @@
 
 unsigned long hap_p2m_ga_to_gfn_2_levels(struct vcpu *v,
     struct p2m_domain *p2m, unsigned long cr3,
-    paddr_t ga, uint32_t *pfec);
+    paddr_t ga, uint32_t *pfec, unsigned int *page_order);
 unsigned long hap_p2m_ga_to_gfn_3_levels(struct vcpu *v,
     struct p2m_domain *p2m, unsigned long cr3,
-    paddr_t ga, uint32_t *pfec);
+    paddr_t ga, uint32_t *pfec, unsigned int *page_order);
 unsigned long hap_p2m_ga_to_gfn_4_levels(struct vcpu *v,
     struct p2m_domain *p2m, unsigned long cr3,
-    paddr_t ga, uint32_t *pfec);
+    paddr_t ga, uint32_t *pfec, unsigned int *page_order);
 
 #endif /* __HAP_PRIVATE_H__ */
diff -r 04e2fd7379d0 -r ac33d68e8976 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Sep 08 15:13:06 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Sep 08 15:13:06 2011 +0100
@@ -1206,7 +1206,7 @@
 
         /* translate l2 guest gfn into l1 guest gfn */
         return hostmode->p2m_ga_to_gfn(v, hostp2m, ncr3,
-            gfn << PAGE_SHIFT, pfec);
+                                       gfn << PAGE_SHIFT, pfec, NULL);
     }
 
     return hostmode->gva_to_gfn(v, hostp2m, va, pfec);
diff -r 04e2fd7379d0 -r ac33d68e8976 xen/include/asm-x86/guest_pt.h
--- a/xen/include/asm-x86/guest_pt.h	Thu Sep 08 15:13:06 2011 +0100
+++ b/xen/include/asm-x86/guest_pt.h	Thu Sep 08 15:13:06 2011 +0100
@@ -272,6 +272,24 @@
     return guest_l1e_get_paddr(gw->l1e) + (gw->va & ~PAGE_MASK);
 }
 
+/* Given a walk_t from a successful walk, return the page-order of the 
+ * page or superpage that the virtual address is in. */
+static inline unsigned int 
+guest_walk_to_page_order(walk_t *gw)
+{
+    /* This is only valid for successful walks - otherwise the 
+     * PSE bits might be invalid. */
+    ASSERT(guest_l1e_get_flags(gw->l1e) & _PAGE_PRESENT);
+#if GUEST_PAGING_LEVELS >= 3
+    if ( guest_l3e_get_flags(gw->l3e) & _PAGE_PSE )
+        return GUEST_L3_PAGETABLE_SHIFT - PAGE_SHIFT;
+#endif
+    if ( guest_l2e_get_flags(gw->l2e) & _PAGE_PSE )
+        return GUEST_L2_PAGETABLE_SHIFT - PAGE_SHIFT;
+    return GUEST_L1_PAGETABLE_SHIFT - PAGE_SHIFT;
+}
+
+
 /* Walk the guest pagetables, after the manner of a hardware walker. 
  *
  * Inputs: a vcpu, a virtual address, a walk_t to fill, a 
diff -r 04e2fd7379d0 -r ac33d68e8976 xen/include/asm-x86/paging.h
--- a/xen/include/asm-x86/paging.h	Thu Sep 08 15:13:06 2011 +0100
+++ b/xen/include/asm-x86/paging.h	Thu Sep 08 15:13:06 2011 +0100
@@ -115,7 +115,8 @@
     unsigned long (*p2m_ga_to_gfn         )(struct vcpu *v,
                                             struct p2m_domain *p2m,
                                             unsigned long cr3,
-                                            paddr_t ga, uint32_t *pfec);
+                                            paddr_t ga, uint32_t *pfec,
+                                            unsigned int *page_order);
     void          (*update_cr3            )(struct vcpu *v, int do_locking);
     void          (*update_paging_modes   )(struct vcpu *v);
     void          (*write_p2m_entry       )(struct vcpu *v, unsigned long gfn,
@@ -270,15 +271,18 @@
  * to by nested HAP code, to walk the guest-supplied NPT tables as if
  * they were pagetables.
  * Use 'paddr_t' for the guest address so it won't overflow when
- * guest or nested guest is in 32bit PAE mode.
- */
+ * l1 or l2 guest is in 32bit PAE mode.
+ * If the GFN returned is not INVALID_GFN, *page_order gives
+ * the size of the superpage (if any) it was found in. */
 static inline unsigned long paging_ga_to_gfn_cr3(struct vcpu *v,
                                                  unsigned long cr3,
                                                  paddr_t ga,
-                                                 uint32_t *pfec)
+                                                 uint32_t *pfec,
+                                                 unsigned int *page_order)
 {
     struct p2m_domain *p2m = v->domain->arch.p2m;
-    return paging_get_hostmode(v)->p2m_ga_to_gfn(v, p2m, cr3, ga, pfec);
+    return paging_get_hostmode(v)->p2m_ga_to_gfn(v, p2m, cr3, ga, pfec,
+        page_order);
 }
 
 /* Update all the things that are derived from the guest's CR3.

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 08 10:45:35 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 08 Sep 2011 10:45:35 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1ifP-0001wh-Kf; Thu, 08 Sep 2011 10:45:35 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1ie5-0001Io-Ky
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 10:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1315503850!30732922!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15620 invoked from network); 8 Sep 2011 17:44:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 17:44:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1ie1-0007Ex-V6
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 18:44:10 +0100
Message-Id: <E1R1ie1-0007Ex-V6@xenbits.xen.org>
Date: Thu, 08 Sep 2011 18:44:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: adjust p2m interface to
	return superpage sizes
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1315491186 -3600
# Node ID 04e2fd7379d07cc0d2da9dc9da50a2b54c198f13
# Parent  bdd19847ae63b5dfb036e228cb16ec3ae678e995
x86/mm: adjust p2m interface to return superpage sizes

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r bdd19847ae63 -r 04e2fd7379d0 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Wed Sep 07 10:37:48 2011 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Thu Sep 08 15:13:06 2011 +0100
@@ -1216,7 +1216,7 @@
     }
 
     p2m = p2m_get_hostp2m(v->domain);
-    mfn = gfn_to_mfn_type_p2m(p2m, gfn, &p2mt, &p2ma, p2m_guest);
+    mfn = gfn_to_mfn_type_p2m(p2m, gfn, &p2mt, &p2ma, p2m_guest, NULL);
 
     /* Check access permissions first, then handle faults */
     if ( access_valid && (mfn_x(mfn) != INVALID_MFN) )
diff -r bdd19847ae63 -r 04e2fd7379d0 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Wed Sep 07 10:37:48 2011 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Thu Sep 08 15:13:06 2011 +0100
@@ -1160,7 +1160,7 @@
         p2m = p2m_get_p2m(v);
         _d.gpa = gpa;
         _d.qualification = 0;
-        _d.mfn = mfn_x(gfn_to_mfn_type_p2m(p2m, gfn, &_d.p2mt, &p2ma, p2m_query));
+        _d.mfn = mfn_x(gfn_to_mfn_type_p2m(p2m, gfn, &_d.p2mt, &p2ma, p2m_query, NULL));
         
         __trace_var(TRC_HVM_NPF, 0, sizeof(_d), &_d);
     }
@@ -1180,7 +1180,7 @@
     if ( p2m == NULL )
         p2m = p2m_get_p2m(v);
     /* Everything else is an error. */
-    mfn = gfn_to_mfn_type_p2m(p2m, gfn, &p2mt, &p2ma, p2m_guest);
+    mfn = gfn_to_mfn_type_p2m(p2m, gfn, &p2mt, &p2ma, p2m_guest, NULL);
     gdprintk(XENLOG_ERR,
          "SVM violation gpa %#"PRIpaddr", mfn %#lx, type %i\n",
          gpa, mfn_x(mfn), p2mt);
diff -r bdd19847ae63 -r 04e2fd7379d0 xen/arch/x86/mm/guest_walk.c
--- a/xen/arch/x86/mm/guest_walk.c	Wed Sep 07 10:37:48 2011 +0100
+++ b/xen/arch/x86/mm/guest_walk.c	Thu Sep 08 15:13:06 2011 +0100
@@ -95,7 +95,7 @@
     p2m_access_t a;
 
     /* Translate the gfn, unsharing if shared */
-    *mfn = gfn_to_mfn_type_p2m(p2m, gfn_x(gfn), p2mt, &a, p2m_unshare);
+    *mfn = gfn_to_mfn_type_p2m(p2m, gfn_x(gfn), p2mt, &a, p2m_unshare, NULL);
     if ( p2m_is_paging(*p2mt) )
     {
         ASSERT(!p2m_is_nestedp2m(p2m));
diff -r bdd19847ae63 -r 04e2fd7379d0 xen/arch/x86/mm/hap/guest_walk.c
--- a/xen/arch/x86/mm/hap/guest_walk.c	Wed Sep 07 10:37:48 2011 +0100
+++ b/xen/arch/x86/mm/hap/guest_walk.c	Thu Sep 08 15:13:06 2011 +0100
@@ -59,7 +59,7 @@
 
     /* Get the top-level table's MFN */
     top_mfn = gfn_to_mfn_type_p2m(p2m, cr3 >> PAGE_SHIFT, 
-                                  &p2mt, &p2ma, p2m_unshare);
+                                  &p2mt, &p2ma, p2m_unshare, NULL);
     if ( p2m_is_paging(p2mt) )
     {
         ASSERT(!p2m_is_nestedp2m(p2m));
@@ -92,7 +92,7 @@
     if ( missing == 0 )
     {
         gfn_t gfn = guest_l1e_get_gfn(gw.l1e);
-        gfn_to_mfn_type_p2m(p2m, gfn_x(gfn), &p2mt, &p2ma, p2m_unshare);
+        gfn_to_mfn_type_p2m(p2m, gfn_x(gfn), &p2mt, &p2ma, p2m_unshare, NULL);
         if ( p2m_is_paging(p2mt) )
         {
             ASSERT(!p2m_is_nestedp2m(p2m));
diff -r bdd19847ae63 -r 04e2fd7379d0 xen/arch/x86/mm/hap/nested_hap.c
--- a/xen/arch/x86/mm/hap/nested_hap.c	Wed Sep 07 10:37:48 2011 +0100
+++ b/xen/arch/x86/mm/hap/nested_hap.c	Thu Sep 08 15:13:06 2011 +0100
@@ -136,7 +136,8 @@
     p2m_access_t p2ma;
 
     /* walk L0 P2M table */
-    mfn = gfn_to_mfn_type_p2m(p2m, L1_gpa >> PAGE_SHIFT, &p2mt, &p2ma, p2m_query);
+    mfn = gfn_to_mfn_type_p2m(p2m, L1_gpa >> PAGE_SHIFT, &p2mt, &p2ma, 
+                              p2m_query, NULL);
 
     if ( p2m_is_paging(p2mt) || p2m_is_shared(p2mt) || !p2m_is_ram(p2mt) )
         return NESTEDHVM_PAGEFAULT_ERROR;
diff -r bdd19847ae63 -r 04e2fd7379d0 xen/arch/x86/mm/p2m-ept.c
--- a/xen/arch/x86/mm/p2m-ept.c	Wed Sep 07 10:37:48 2011 +0100
+++ b/xen/arch/x86/mm/p2m-ept.c	Thu Sep 08 15:13:06 2011 +0100
@@ -507,7 +507,7 @@
 /* Read ept p2m entries */
 static mfn_t ept_get_entry(struct p2m_domain *p2m,
                            unsigned long gfn, p2m_type_t *t, p2m_access_t* a,
-                           p2m_query_t q)
+                           p2m_query_t q, unsigned int *page_order)
 {
     struct domain *d = p2m->domain;
     ept_entry_t *table = map_domain_page(ept_get_asr(d));
@@ -594,6 +594,9 @@
                  ((1 << (i * EPT_TABLE_ORDER)) - 1));
             mfn = _mfn(split_mfn);
         }
+
+        if ( page_order )
+            *page_order = i * EPT_TABLE_ORDER;
     }
 
 out:
diff -r bdd19847ae63 -r 04e2fd7379d0 xen/arch/x86/mm/p2m-pt.c
--- a/xen/arch/x86/mm/p2m-pt.c	Wed Sep 07 10:37:48 2011 +0100
+++ b/xen/arch/x86/mm/p2m-pt.c	Thu Sep 08 15:13:06 2011 +0100
@@ -503,7 +503,8 @@
 /* Read the current domain's p2m table (through the linear mapping). */
 static mfn_t p2m_gfn_to_mfn_current(struct p2m_domain *p2m, 
                                     unsigned long gfn, p2m_type_t *t, 
-                                    p2m_access_t *a, p2m_query_t q)
+                                    p2m_access_t *a, p2m_query_t q,
+                                    unsigned int *page_order)
 {
     mfn_t mfn = _mfn(INVALID_MFN);
     p2m_type_t p2mt = p2m_mmio_dm;
@@ -567,6 +568,8 @@
         else
             p2mt = p2m_mmio_dm;
             
+        if ( page_order )
+            *page_order = PAGE_ORDER_1G;
         goto out;
     }
 #endif
@@ -620,6 +623,8 @@
         else
             p2mt = p2m_mmio_dm;
 
+        if ( page_order )
+            *page_order = PAGE_ORDER_2M;
         goto out;
     }
 
@@ -669,6 +674,8 @@
             p2mt = p2m_mmio_dm;
     }
     
+    if ( page_order )
+        *page_order = PAGE_ORDER_4K;
 out:
     *t = p2mt;
     return mfn;
@@ -676,7 +683,8 @@
 
 static mfn_t
 p2m_gfn_to_mfn(struct p2m_domain *p2m, unsigned long gfn, 
-               p2m_type_t *t, p2m_access_t *a, p2m_query_t q)
+               p2m_type_t *t, p2m_access_t *a, p2m_query_t q,
+               unsigned int *page_order)
 {
     mfn_t mfn;
     paddr_t addr = ((paddr_t)gfn) << PAGE_SHIFT;
@@ -699,7 +707,7 @@
 
     /* Use the fast path with the linear mapping if we can */
     if ( p2m == p2m_get_hostp2m(current->domain) )
-        return p2m_gfn_to_mfn_current(p2m, gfn, t, a, q);
+        return p2m_gfn_to_mfn_current(p2m, gfn, t, a, q, page_order);
 
     mfn = pagetable_get_mfn(p2m_get_pagetable(p2m));
 
@@ -753,6 +761,8 @@
             unmap_domain_page(l3e);
 
             ASSERT(mfn_valid(mfn) || !p2m_is_ram(*t));
+            if ( page_order )
+                *page_order = PAGE_ORDER_1G;
             return (p2m_is_valid(*t)) ? mfn : _mfn(INVALID_MFN);
         }
 
@@ -787,6 +797,8 @@
         unmap_domain_page(l2e);
         
         ASSERT(mfn_valid(mfn) || !p2m_is_ram(*t));
+        if ( page_order )
+            *page_order = PAGE_ORDER_2M;
         return (p2m_is_valid(*t)) ? mfn : _mfn(INVALID_MFN);
     }
 
@@ -817,6 +829,8 @@
     unmap_domain_page(l1e);
 
     ASSERT(mfn_valid(mfn) || !p2m_is_ram(*t));
+    if ( page_order )
+        *page_order = PAGE_ORDER_4K;
     return (p2m_is_valid(*t) || p2m_is_grant(*t)) ? mfn : _mfn(INVALID_MFN);
 }
 
diff -r bdd19847ae63 -r 04e2fd7379d0 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Sep 07 10:37:48 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Sep 08 15:13:06 2011 +0100
@@ -307,7 +307,7 @@
 #ifdef __x86_64__
     for ( gfn=0; gfn < p2m->max_mapped_pfn; gfn++ )
     {
-        mfn = gfn_to_mfn_type_p2m(p2m, gfn, &t, &a, p2m_query);
+        mfn = gfn_to_mfn_type_p2m(p2m, gfn, &t, &a, p2m_query, NULL);
         if ( mfn_valid(mfn) && (t == p2m_ram_shared) )
         {
             ASSERT(!p2m_is_nestedp2m(p2m));
@@ -372,7 +372,7 @@
     {
         for ( i = 0; i < (1UL << page_order); i++ )
         {
-            mfn_return = p2m->get_entry(p2m, gfn + i, &t, &a, p2m_query);
+            mfn_return = p2m->get_entry(p2m, gfn + i, &t, &a, p2m_query, NULL);
             if ( !p2m_is_grant(t) )
                 set_gpfn_from_mfn(mfn+i, INVALID_M2P_ENTRY);
             ASSERT( !p2m_is_valid(t) || mfn + i == mfn_x(mfn_return) );
@@ -878,7 +878,7 @@
     
     /* First, handle rx2rw conversion automatically */
     p2m_lock(p2m);
-    mfn = p2m->get_entry(p2m, gfn, &p2mt, &p2ma, p2m_query);
+    mfn = p2m->get_entry(p2m, gfn, &p2mt, &p2ma, p2m_query, NULL);
 
     if ( access_w && p2ma == p2m_access_rx2rw ) 
     {
@@ -1036,7 +1036,7 @@
         return 0;
     }
 
-    mfn = p2m->get_entry(p2m, pfn, &t, &a, p2m_query);
+    mfn = p2m->get_entry(p2m, pfn, &t, &a, p2m_query, NULL);
     if ( mfn_x(mfn) == INVALID_MFN )
         return -ESRCH;
     
diff -r bdd19847ae63 -r 04e2fd7379d0 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Wed Sep 07 10:37:48 2011 +0100
+++ b/xen/include/asm-x86/p2m.h	Thu Sep 08 15:13:06 2011 +0100
@@ -233,7 +233,8 @@
                                        unsigned long gfn,
                                        p2m_type_t *p2mt,
                                        p2m_access_t *p2ma,
-                                       p2m_query_t q);
+                                       p2m_query_t q,
+                                       unsigned int *page_order);
     void               (*change_entry_type_global)(struct p2m_domain *p2m,
                                                    p2m_type_t ot,
                                                    p2m_type_t nt);
@@ -303,10 +304,14 @@
 /* Read a particular P2M table, mapping pages as we go.  Most callers
  * should _not_ call this directly; use the other gfn_to_mfn_* functions
  * below unless you know you want to walk a p2m that isn't a domain's
- * main one. */
+ * main one.
+ * If the lookup succeeds, the return value is != INVALID_MFN and 
+ * *page_order is filled in with the order of the superpage (if any) that
+ * the entry was found in.  */
 static inline mfn_t
 gfn_to_mfn_type_p2m(struct p2m_domain *p2m, unsigned long gfn,
-                    p2m_type_t *t, p2m_access_t *a, p2m_query_t q)
+                    p2m_type_t *t, p2m_access_t *a, p2m_query_t q,
+                    unsigned int *page_order)
 {
     mfn_t mfn;
 
@@ -318,14 +323,14 @@
         return _mfn(gfn);
     }
 
-    mfn = p2m->get_entry(p2m, gfn, t, a, q);
+    mfn = p2m->get_entry(p2m, gfn, t, a, q, page_order);
 
 #ifdef __x86_64__
     if ( q == p2m_unshare && p2m_is_shared(*t) )
     {
         ASSERT(!p2m_is_nestedp2m(p2m));
         mem_sharing_unshare_page(p2m->domain, gfn, 0);
-        mfn = p2m->get_entry(p2m, gfn, t, a, q);
+        mfn = p2m->get_entry(p2m, gfn, t, a, q, page_order);
     }
 #endif
 
@@ -349,7 +354,7 @@
                                     p2m_query_t q)
 {
     p2m_access_t a;
-    return gfn_to_mfn_type_p2m(p2m_get_hostp2m(d), gfn, t, &a, q);
+    return gfn_to_mfn_type_p2m(p2m_get_hostp2m(d), gfn, t, &a, q, NULL);
 }
 
 /* Syntactic sugar: most callers will use one of these. 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 08 10:45:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 08 Sep 2011 10:45:41 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1ifV-0001zW-Cx; Thu, 08 Sep 2011 10:45:41 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1ie6-0001J5-BL
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 10:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1315503851!30745734!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31866 invoked from network); 8 Sep 2011 17:44:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 17:44:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1ie3-0007Gm-2v
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 18:44:11 +0100
Message-Id: <E1R1ie3-0007Gm-2v@xenbits.xen.org>
Date: Thu, 08 Sep 2011 18:44:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: use new page-order
	interfaces in nested HAP code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1315491186 -3600
# Node ID 0312575dc35e4294eb50e365b2c10078914daca8
# Parent  ac33d68e89767d49113824e5661c49a5465a18e7
x86/mm: use new page-order interfaces in nested HAP code
to make 2M and 1G mappings in the nested p2m tables.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r ac33d68e8976 -r 0312575dc35e xen/arch/x86/mm/hap/nested_hap.c
--- a/xen/arch/x86/mm/hap/nested_hap.c	Thu Sep 08 15:13:06 2011 +0100
+++ b/xen/arch/x86/mm/hap/nested_hap.c	Thu Sep 08 15:13:06 2011 +0100
@@ -99,7 +99,7 @@
 static void
 nestedhap_fix_p2m(struct vcpu *v, struct p2m_domain *p2m, 
                   paddr_t L2_gpa, paddr_t L0_gpa,
-                  p2m_type_t p2mt, p2m_access_t p2ma)
+                  unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma)
 {
     int rv = 1;
     ASSERT(p2m);
@@ -111,9 +111,20 @@
      * leave it alone.  We'll pick up the right one as we try to 
      * vmenter the guest. */
     if ( p2m->cr3 == nhvm_vcpu_hostcr3(v) )
-         rv = set_p2m_entry(p2m, L2_gpa >> PAGE_SHIFT,
-                            page_to_mfn(maddr_to_page(L0_gpa)),
-                            0 /*4K*/, p2mt, p2ma);
+    {
+        unsigned long gfn, mask;
+        mfn_t mfn;
+
+        /* If this is a superpage mapping, round down both addresses
+         * to the start of the superpage. */
+        mask = ~((1UL << page_order) - 1);
+
+        gfn = (L2_gpa >> PAGE_SHIFT) & mask;
+        mfn = _mfn((L0_gpa >> PAGE_SHIFT) & mask);
+
+        rv = set_p2m_entry(p2m, gfn, mfn, page_order, p2mt, p2ma);
+    }
+
     p2m_unlock(p2m);
 
     if (rv == 0) {
@@ -129,7 +140,8 @@
  * value tells the upper level what to do.
  */
 static int
-nestedhap_walk_L0_p2m(struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_gpa)
+nestedhap_walk_L0_p2m(struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_gpa,
+                      unsigned int *page_order)
 {
     mfn_t mfn;
     p2m_type_t p2mt;
@@ -137,7 +149,7 @@
 
     /* walk L0 P2M table */
     mfn = gfn_to_mfn_type_p2m(p2m, L1_gpa >> PAGE_SHIFT, &p2mt, &p2ma, 
-                              p2m_query, NULL);
+                              p2m_query, page_order);
 
     if ( p2m_is_paging(p2mt) || p2m_is_shared(p2mt) || !p2m_is_ram(p2mt) )
         return NESTEDHVM_PAGEFAULT_ERROR;
@@ -154,7 +166,8 @@
  * L1_gpa. The result value tells what to do next.
  */
 static int
-nestedhap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa)
+nestedhap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
+                      unsigned int *page_order)
 {
     uint32_t pfec;
     unsigned long nested_cr3, gfn;
@@ -162,7 +175,7 @@
     nested_cr3 = nhvm_vcpu_hostcr3(v);
 
     /* Walk the guest-supplied NPT table, just as if it were a pagetable */
-    gfn = paging_ga_to_gfn_cr3(v, nested_cr3, L2_gpa, &pfec, NULL);
+    gfn = paging_ga_to_gfn_cr3(v, nested_cr3, L2_gpa, &pfec, page_order);
 
     if ( gfn == INVALID_GFN ) 
         return NESTEDHVM_PAGEFAULT_INJECT;
@@ -183,12 +196,13 @@
     paddr_t L1_gpa, L0_gpa;
     struct domain *d = v->domain;
     struct p2m_domain *p2m, *nested_p2m;
+    unsigned int page_order_21, page_order_10, page_order_20;
 
     p2m = p2m_get_hostp2m(d); /* L0 p2m */
     nested_p2m = p2m_get_nestedp2m(v, nhvm_vcpu_hostcr3(v));
 
     /* walk the L1 P2M table */
-    rv = nestedhap_walk_L1_p2m(v, L2_gpa, &L1_gpa);
+    rv = nestedhap_walk_L1_p2m(v, L2_gpa, &L1_gpa, &page_order_21);
 
     /* let caller to handle these two cases */
     switch (rv) {
@@ -204,7 +218,7 @@
     }
 
     /* ==> we have to walk L0 P2M */
-    rv = nestedhap_walk_L0_p2m(p2m, L1_gpa, &L0_gpa);
+    rv = nestedhap_walk_L0_p2m(p2m, L1_gpa, &L0_gpa, &page_order_10);
 
     /* let upper level caller to handle these two cases */
     switch (rv) {
@@ -219,8 +233,10 @@
         break;
     }
 
+    page_order_20 = min(page_order_21, page_order_10);
+
     /* fix p2m_get_pagetable(nested_p2m) */
-    nestedhap_fix_p2m(v, nested_p2m, L2_gpa, L0_gpa,
+    nestedhap_fix_p2m(v, nested_p2m, L2_gpa, L0_gpa, page_order_20,
         p2m_ram_rw,
         p2m_access_rwx /* FIXME: Should use same permission as l1 guest */);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 08 11:45:13 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 08 Sep 2011 11:45:13 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1jb5-0001XW-TE; Thu, 08 Sep 2011 11:45:12 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1ja9-00018C-9B
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 11:44:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1315507449!30753064!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18690 invoked from network); 8 Sep 2011 18:44:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 18:44:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1ja5-0005yU-EG
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 19:44:09 +0100
Message-Id: <E1R1ja5-0005yU-EG@xenbits.xen.org>
Date: Thu, 08 Sep 2011 19:44:08 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Update Xen version to
	4.1.2-rc3-pre
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1315481075 -3600
# Node ID 78d8c5227bb1b575e299ef76fcbe97676bd2a4fb
# Parent  2376070f6685cf7967ab5f1e2a0fb4b069a4124b
Update Xen version to 4.1.2-rc3-pre
---


diff -r 2376070f6685 -r 78d8c5227bb1 xen/Makefile
--- a/xen/Makefile	Wed Sep 07 10:41:01 2011 +0100
+++ b/xen/Makefile	Thu Sep 08 12:24:35 2011 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 1
-export XEN_EXTRAVERSION ?= .2-rc2$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2-rc3-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 08 11:45:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 08 Sep 2011 11:45:21 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1jbF-0001b6-PV; Thu, 08 Sep 2011 11:45:21 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1jaF-0001B9-6S
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 11:44:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1315507437!34966436!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26770 invoked from network); 8 Sep 2011 18:43:58 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 18:43:58 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1jaC-0005zQ-27
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 19:44:16 +0100
Message-Id: <E1R1jaC-0005zQ-27@xenbits.xen.org>
Date: Thu, 08 Sep 2011 19:44:15 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Update Xen version to
	4.0.3-rc3-pre
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1315481002 -3600
# Node ID 2906ef107e9708e3bbca2aa58c0baa10c13d33ce
# Parent  b44346a6975c772853a36c9b8d86ecf7897ec4cd
Update Xen version to 4.0.3-rc3-pre
---


diff -r b44346a6975c -r 2906ef107e97 xen/Makefile
--- a/xen/Makefile	Wed Sep 07 10:41:49 2011 +0100
+++ b/xen/Makefile	Thu Sep 08 12:23:22 2011 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 0
-export XEN_EXTRAVERSION ?= .3-rc2$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .3-rc3-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 08 11:45:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 08 Sep 2011 11:45:28 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R1jbM-0001e9-LA; Thu, 08 Sep 2011 11:45:28 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R1jaF-0001BM-IG
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 11:44:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-216.messagelabs.com!1315507456!17576091!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32167 invoked from network); 8 Sep 2011 18:44:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Sep 2011 18:44:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R1jaC-0005zf-GX
	for xen-changelog@lists.xensource.com; Thu, 08 Sep 2011 19:44:16 +0100
Message-Id: <E1R1jaC-0005zf-GX@xenbits.xen.org>
Date: Thu, 08 Sep 2011 19:44:16 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Passthrough: disable
	bus-mastering on any card that causes an IOMMU fault.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1315481032 -3600
# Node ID 789ff1a462b80b8eb055715dd69d70f7ab9480be
# Parent  2906ef107e9708e3bbca2aa58c0baa10c13d33ce
Passthrough: disable bus-mastering on any card that causes an IOMMU fault.

This stops the card from raising back-to-back faults and live-locking
the CPU that handles them.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Wei Wang2 <wei.wang2@amd.com>
Acked-by: Allen M Kay <allen.m.kay@intel.com>
xen-unstable changeset:   23762:537ed3b74b3f
xen-unstable date:        Fri Aug 12 11:29:24 2011 +0100
---


diff -r 2906ef107e97 -r 789ff1a462b8 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Thu Sep 08 12:23:22 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Thu Sep 08 12:23:52 2011 +0100
@@ -457,7 +457,7 @@
 
 static void parse_event_log_entry(u32 entry[])
 {
-    u16 domain_id, device_id;
+    u16 domain_id, device_id, bdf, cword;
     u32 code;
     u64 *addr;
     char * event_str[] = {"ILLEGAL_DEV_TABLE_ENTRY",
@@ -491,6 +491,18 @@
         printk(XENLOG_ERR "AMD_IOV: "
             "%s: domain:%d, device id:0x%x, fault address:0x%"PRIx64"\n",
             event_str[code-1], domain_id, device_id, *addr);
+
+        /* Tell the device to stop DMAing; we can't rely on the guest to
+         * control it for us. */
+        for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
+            if ( get_dma_requestor_id(bdf) == device_id ) 
+            {
+                cword = pci_conf_read16(PCI_BUS(bdf), PCI_SLOT(bdf), 
+                                PCI_FUNC(bdf), PCI_COMMAND);
+                pci_conf_write16(PCI_BUS(bdf), PCI_SLOT(bdf), 
+                                 PCI_FUNC(bdf), PCI_COMMAND, 
+                                 cword & ~PCI_COMMAND_MASTER);
+            }
     }
 }
 
diff -r 2906ef107e97 -r 789ff1a462b8 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Thu Sep 08 12:23:22 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Sep 08 12:23:52 2011 +0100
@@ -888,7 +888,7 @@
     while (1)
     {
         u8 fault_reason;
-        u16 source_id;
+        u16 source_id, cword;
         u32 data;
         u64 guest_addr;
         int type;
@@ -921,6 +921,14 @@
         iommu_page_fault_do_one(iommu, type, fault_reason,
                                 source_id, guest_addr);
 
+        /* Tell the device to stop DMAing; we can't rely on the guest to
+         * control it for us. */
+        cword = pci_conf_read16(PCI_BUS(source_id), PCI_SLOT(source_id), 
+                                PCI_FUNC(source_id), PCI_COMMAND);
+        pci_conf_write16(PCI_BUS(source_id), PCI_SLOT(source_id), 
+                         PCI_FUNC(source_id), PCI_COMMAND, 
+                         cword & ~PCI_COMMAND_MASTER);
+
         fault_index++;
         if ( fault_index > cap_num_fault_regs(iommu->cap) )
             fault_index = 0;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 13 04:22:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 13 Sep 2011 04:22:24 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3R4J-00057o-VO; Tue, 13 Sep 2011 04:22:24 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3R4E-00056m-NC
	for xen-changelog@lists.xensource.com; Tue, 13 Sep 2011 04:22:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1315912916!35525685!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31011 invoked from network); 13 Sep 2011 11:21:56 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Sep 2011 11:21:56 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3R4A-0004Vc-6M
	for xen-changelog@lists.xensource.com; Tue, 13 Sep 2011 12:22:14 +0100
Message-Id: <E1R3R4A-0004Vc-6M@xenbits.xen.org>
Date: Tue, 13 Sep 2011 12:22:13 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] bitmap_scnlistprintf() should
	always zero-terminate its output buffer
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1315906927 -3600
# Node ID 487d9e6505847c195aa38b637a80a4c39523691c
# Parent  95f9d131207322f3e3373a55a3e22ece8c24493a
bitmap_scnlistprintf() should always zero-terminate its output buffer

... as long as it has non-zero size. So far this would not happen if
the passed in CPU mask was empty.

Also fix the comment describing the return value to actually match
reality.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen-unstable changeset:   23820:ba75234a6f56
xen-unstable date:        Wed Sep 07 10:36:55 2011 +0100
---


diff -r 95f9d1312073 -r 487d9e650584 xen/common/bitmap.c
--- a/xen/common/bitmap.c	Tue Sep 13 10:39:25 2011 +0100
+++ b/xen/common/bitmap.c	Tue Sep 13 10:42:07 2011 +0100
@@ -363,9 +363,8 @@
  * the range.  Output format is compatible with the format
  * accepted as input by bitmap_parselist().
  *
- * The return value is the number of characters which would be
- * generated for the given input, excluding the trailing '\0', as
- * per ISO C99.
+ * The return value is the number of characters which were output,
+ * excluding the trailing '\0'.
  */
 int bitmap_scnlistprintf(char *buf, unsigned int buflen,
 	const unsigned long *maskp, int nmaskbits)
@@ -383,6 +382,8 @@
 			rbot = cur;
 		}
 	}
+	if (!len && buflen)
+		*buf = 0;
 	return len;
 }
 EXPORT_SYMBOL(bitmap_scnlistprintf);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 13 04:24:48 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 13 Sep 2011 04:24:48 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3R6d-0005Z6-MF; Tue, 13 Sep 2011 04:24:47 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3R6G-0005RJ-JO
	for xen-changelog@lists.xensource.com; Tue, 13 Sep 2011 04:24:25 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1315912934!31233515!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16432 invoked from network); 13 Sep 2011 11:22:37 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Sep 2011 11:22:37 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3R48-0004VN-4m
	for xen-changelog@lists.xensource.com; Tue, 13 Sep 2011 12:22:12 +0100
Message-Id: <E1R3R48-0004VN-4m@xenbits.xen.org>
Date: Tue, 13 Sep 2011 12:22:11 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] IRQ: IO-APIC support End Of
	Interrupt for older IO-APICs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1315906765 -3600
# Node ID 95f9d131207322f3e3373a55a3e22ece8c24493a
# Parent  789ff1a462b80b8eb055715dd69d70f7ab9480be
IRQ: IO-APIC support End Of Interrupt for older IO-APICs

The old io_apic_eoi() function using the EOI register only works for
IO-APICs with a version of 0x20.  Older IO-APICs do not have an EOI
register so line level interrupts have to be EOI'd by flipping the
mode to edge and back, which clears the IRR and Delivery Status bits.

This patch replaces the current io_apic_eoi() function with one which
takes into account the version of the IO-APIC and EOI's
appropriately.

v2: make recursive call to __io_apic_eoi() to reduce code size.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen-unstable changeset:   23833:ffe8e65f6687
xen-unstable date:        Tue Sep 13 10:33:10 2011 +0100
---


diff -r 789ff1a462b8 -r 95f9d1312073 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Thu Sep 08 12:23:52 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Tue Sep 13 10:39:25 2011 +0100
@@ -70,6 +70,13 @@
 #define MAX_PLUS_SHARED_IRQS nr_irqs_gsi
 #define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + nr_irqs_gsi)
 
+
+#define ioapic_has_eoi_reg(apic) (mp_ioapics[(apic)].mpc_apicver >= 0x20)
+
+#define io_apic_eoi_vector(apic, vector) io_apic_eoi((apic), (vector), -1)
+#define io_apic_eoi_pin(apic, pin) io_apic_eoi((apic), -1, (pin))
+
+
 /*
  * This is performance-critical, we want to do it O(1)
  *
@@ -205,6 +212,105 @@
     spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
+/* EOI an IO-APIC entry.  One of vector or pin may be -1, indicating that
+ * it should be worked out using the other.  This function expect that the
+ * ioapic_lock is taken, and interrupts are disabled (or there is a good reason
+ * not to), and that if both pin and vector are passed, that they refer to the
+ * same redirection entry in the IO-APIC. */
+static void __io_apic_eoi(unsigned int apic, unsigned int vector, unsigned int pin)
+{
+    /* Ensure some useful information is passed in */
+    BUG_ON( (vector == -1 && pin == -1) );
+    
+    /* Prefer the use of the EOI register if available */
+    if ( ioapic_has_eoi_reg(apic) )
+    {
+        /* If vector is unknown, read it from the IO-APIC */
+        if ( vector == -1 )
+            vector = __ioapic_read_entry(apic, pin, TRUE).vector;
+
+        *(IO_APIC_BASE(apic)+16) = vector;
+    }
+    else
+    {
+        /* Else fake an EOI by switching to edge triggered mode
+         * and back */
+        struct IO_APIC_route_entry entry;
+        bool_t need_to_unmask = 0;
+
+        /* If pin is unknown, search for it */
+        if ( pin == -1 )
+        {
+            unsigned int p;
+            for ( p = 0; p < nr_ioapic_registers[apic]; ++p )
+            {
+                entry = __ioapic_read_entry(apic, p, TRUE);
+                if ( entry.vector == vector )
+                {
+                    pin = p;
+                    /* break; */
+
+                    /* Here should be a break out of the loop, but at the 
+                     * Xen code doesn't actually prevent multiple IO-APIC
+                     * entries being assigned the same vector, so EOI all
+                     * pins which have the correct vector.
+                     *
+                     * Remove the following code when the above assertion
+                     * is fulfilled. */
+                    __io_apic_eoi(apic, vector, p);
+                }
+            }
+            
+            /* If search fails, nothing to do */
+
+            /* if ( pin == -1 ) */
+
+            /* Because the loop wasn't broken out of (see comment above),
+             * all relevant pins have been EOI, so we can always return.
+             * 
+             * Re-instate the if statement above when the Xen logic has been
+             * fixed.*/
+
+            return;
+        }
+
+        entry = __ioapic_read_entry(apic, pin, TRUE);
+
+        if ( ! entry.mask )
+        {
+            /* If entry is not currently masked, mask it and make
+             * a note to unmask it later */
+            entry.mask = 1;
+            __ioapic_write_entry(apic, pin, TRUE, entry);
+            need_to_unmask = 1;
+        }
+
+        /* Flip the trigger mode to edge and back */
+        entry.trigger = 0;
+        __ioapic_write_entry(apic, pin, TRUE, entry);
+        entry.trigger = 1;
+        __ioapic_write_entry(apic, pin, TRUE, entry);
+
+        if ( need_to_unmask )
+        {
+            /* Unmask if neccesary */
+            entry.mask = 0;
+            __ioapic_write_entry(apic, pin, TRUE, entry);
+        }
+    }
+}
+
+/* EOI an IO-APIC entry.  One of vector or pin may be -1, indicating that
+ * it should be worked out using the other.  This function disables interrupts
+ * and takes the ioapic_lock */
+static void io_apic_eoi(unsigned int apic, unsigned int vector, unsigned int pin)
+{
+    unsigned int flags;
+    spin_lock_irqsave(&ioapic_lock, flags);
+    __io_apic_eoi(apic, vector, pin);
+    spin_unlock_irqrestore(&ioapic_lock, flags);
+}
+
 /*
  * Saves all the IO-APIC RTE's
  */
@@ -354,7 +460,7 @@
         pin = entry->pin;
         if (pin == -1)
             break;
-        io_apic_eoi(entry->apic, vector);
+        __io_apic_eoi(entry->apic, vector, pin);
         if (!entry->next)
             break;
         entry = irq_2_pin + entry->next;
@@ -1705,7 +1811,7 @@
     {
         int ioapic;
         for (ioapic = 0; ioapic < nr_ioapics; ioapic++)
-            io_apic_eoi(ioapic, i);
+            io_apic_eoi_vector(ioapic, i);
     }
 
     v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
@@ -2559,3 +2665,4 @@
     if (nr_irqs > MAX_NR_IRQS)
         nr_irqs = MAX_NR_IRQS;
 }
+
diff -r 789ff1a462b8 -r 95f9d1312073 xen/include/asm-x86/io_apic.h
--- a/xen/include/asm-x86/io_apic.h	Thu Sep 08 12:23:52 2011 +0100
+++ b/xen/include/asm-x86/io_apic.h	Tue Sep 13 10:39:25 2011 +0100
@@ -157,11 +157,6 @@
 	__io_apic_write(apic, reg, value);
 }
 
-static inline void io_apic_eoi(unsigned int apic, unsigned int vector)
-{
-	*(IO_APIC_BASE(apic)+16) = vector;
-}
-
 /*
  * Re-write a value: to be used for read-modify-write
  * cycles where the read already set up the index register.

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 13 04:33:14 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 13 Sep 2011 04:33:14 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3REo-0006EQ-Og; Tue, 13 Sep 2011 04:33:14 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3REm-0006Do-M8
	for xen-changelog@lists.xensource.com; Tue, 13 Sep 2011 04:33:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1315913589!17974569!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22876 invoked from network); 13 Sep 2011 11:33:09 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Sep 2011 11:33:09 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3REj-0004ew-EM
	for xen-changelog@lists.xensource.com; Tue, 13 Sep 2011 12:33:09 +0100
Message-Id: <E1R3REj-0004ew-EM@xenbits.xen.org>
Date: Tue, 13 Sep 2011 12:33:08 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xen: if mapping GSIs we run out
	of pirq < nr_irqs_gsi, use the others
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1315906544 -3600
# Node ID 08568ad1140addd33566b2ec51230459efd96629
# Parent  78d8c5227bb1b575e299ef76fcbe97676bd2a4fb
xen: if mapping GSIs we run out of pirq < nr_irqs_gsi, use the others

PV on HVM guests can have more GSIs than the host, in that case we
could run out of pirq < nr_irqs_gsi. When that happens use pirq >=
nr_irqs_gsi rather than returning an error.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Benjamin Schweikert <b.schweikert@googlemail.com>
xen-unstable changeset:   23832:ad3b4bb097cb
xen-unstable date:        Tue Sep 13 10:32:24 2011 +0100
---


diff -r 78d8c5227bb1 -r 08568ad1140a xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Thu Sep 08 12:24:35 2011 +0100
+++ b/xen/arch/x86/irq.c	Tue Sep 13 10:35:44 2011 +0100
@@ -1463,24 +1463,18 @@
             {
                 if ( !is_hvm_domain(d) ||
                         d->arch.pirq_emuirq[i] == IRQ_UNBOUND )
-                    break;
+                    return i;
             }
-        if ( i == nr_irqs_gsi )
-            return -ENOSPC;
     }
-    else
-    {
-        for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- )
-            if ( !d->arch.pirq_irq[i] )
-            {
-                if ( !is_hvm_domain(d) ||
-                        d->arch.pirq_emuirq[i] == IRQ_UNBOUND )
-                    break;
-            }
-        if ( i < nr_irqs_gsi )
-            return -ENOSPC;
-    }
-
+    for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- )
+        if ( !d->arch.pirq_irq[i] )
+        {
+            if ( !is_hvm_domain(d) ||
+                    d->arch.pirq_emuirq[i] == IRQ_UNBOUND )
+                break;
+        }
+    if ( i < nr_irqs_gsi )
+        return -ENOSPC;
     return i;
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 13 04:33:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 13 Sep 2011 04:33:24 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3REy-0006Hl-60; Tue, 13 Sep 2011 04:33:24 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3REn-0006Dq-AB
	for xen-changelog@lists.xensource.com; Tue, 13 Sep 2011 04:33:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1315913589!13151164!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.3.6; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13461 invoked from network); 13 Sep 2011 11:33:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Sep 2011 11:33:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3REj-0004fB-TQ
	for xen-changelog@lists.xensource.com; Tue, 13 Sep 2011 12:33:09 +0100
Message-Id: <E1R3REj-0004fB-TQ@xenbits.xen.org>
Date: Tue, 13 Sep 2011 12:33:09 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] IRQ: IO-APIC support End Of
	Interrupt for older IO-APICs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1315906714 -3600
# Node ID 829c4fd73b10967259a202eb19d78fc6762555f7
# Parent  08568ad1140addd33566b2ec51230459efd96629
IRQ: IO-APIC support End Of Interrupt for older IO-APICs

The old io_apic_eoi() function using the EOI register only works for
IO-APICs with a version of 0x20.  Older IO-APICs do not have an EOI
register so line level interrupts have to be EOI'd by flipping the
mode to edge and back, which clears the IRR and Delivery Status bits.

This patch replaces the current io_apic_eoi() function with one which
takes into account the version of the IO-APIC and EOI's
appropriately.

v2: make recursive call to __io_apic_eoi() to reduce code size.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen-unstable changeset:   23833:ffe8e65f6687
xen-unstable date:        Tue Sep 13 10:33:10 2011 +0100
---


diff -r 08568ad1140a -r 829c4fd73b10 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Tue Sep 13 10:35:44 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Tue Sep 13 10:38:34 2011 +0100
@@ -66,6 +66,13 @@
 #define MAX_PLUS_SHARED_IRQS nr_irqs_gsi
 #define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + nr_irqs_gsi)
 
+
+#define ioapic_has_eoi_reg(apic) (mp_ioapics[(apic)].mpc_apicver >= 0x20)
+
+#define io_apic_eoi_vector(apic, vector) io_apic_eoi((apic), (vector), -1)
+#define io_apic_eoi_pin(apic, pin) io_apic_eoi((apic), -1, (pin))
+
+
 /*
  * This is performance-critical, we want to do it O(1)
  *
@@ -201,6 +208,105 @@
     spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
+/* EOI an IO-APIC entry.  One of vector or pin may be -1, indicating that
+ * it should be worked out using the other.  This function expect that the
+ * ioapic_lock is taken, and interrupts are disabled (or there is a good reason
+ * not to), and that if both pin and vector are passed, that they refer to the
+ * same redirection entry in the IO-APIC. */
+static void __io_apic_eoi(unsigned int apic, unsigned int vector, unsigned int pin)
+{
+    /* Ensure some useful information is passed in */
+    BUG_ON( (vector == -1 && pin == -1) );
+    
+    /* Prefer the use of the EOI register if available */
+    if ( ioapic_has_eoi_reg(apic) )
+    {
+        /* If vector is unknown, read it from the IO-APIC */
+        if ( vector == -1 )
+            vector = __ioapic_read_entry(apic, pin, TRUE).vector;
+
+        *(IO_APIC_BASE(apic)+16) = vector;
+    }
+    else
+    {
+        /* Else fake an EOI by switching to edge triggered mode
+         * and back */
+        struct IO_APIC_route_entry entry;
+        bool_t need_to_unmask = 0;
+
+        /* If pin is unknown, search for it */
+        if ( pin == -1 )
+        {
+            unsigned int p;
+            for ( p = 0; p < nr_ioapic_registers[apic]; ++p )
+            {
+                entry = __ioapic_read_entry(apic, p, TRUE);
+                if ( entry.vector == vector )
+                {
+                    pin = p;
+                    /* break; */
+
+                    /* Here should be a break out of the loop, but at the 
+                     * Xen code doesn't actually prevent multiple IO-APIC
+                     * entries being assigned the same vector, so EOI all
+                     * pins which have the correct vector.
+                     *
+                     * Remove the following code when the above assertion
+                     * is fulfilled. */
+                    __io_apic_eoi(apic, vector, p);
+                }
+            }
+            
+            /* If search fails, nothing to do */
+
+            /* if ( pin == -1 ) */
+
+            /* Because the loop wasn't broken out of (see comment above),
+             * all relevant pins have been EOI, so we can always return.
+             * 
+             * Re-instate the if statement above when the Xen logic has been
+             * fixed.*/
+
+            return;
+        }
+
+        entry = __ioapic_read_entry(apic, pin, TRUE);
+
+        if ( ! entry.mask )
+        {
+            /* If entry is not currently masked, mask it and make
+             * a note to unmask it later */
+            entry.mask = 1;
+            __ioapic_write_entry(apic, pin, TRUE, entry);
+            need_to_unmask = 1;
+        }
+
+        /* Flip the trigger mode to edge and back */
+        entry.trigger = 0;
+        __ioapic_write_entry(apic, pin, TRUE, entry);
+        entry.trigger = 1;
+        __ioapic_write_entry(apic, pin, TRUE, entry);
+
+        if ( need_to_unmask )
+        {
+            /* Unmask if neccesary */
+            entry.mask = 0;
+            __ioapic_write_entry(apic, pin, TRUE, entry);
+        }
+    }
+}
+
+/* EOI an IO-APIC entry.  One of vector or pin may be -1, indicating that
+ * it should be worked out using the other.  This function disables interrupts
+ * and takes the ioapic_lock */
+static void io_apic_eoi(unsigned int apic, unsigned int vector, unsigned int pin)
+{
+    unsigned int flags;
+    spin_lock_irqsave(&ioapic_lock, flags);
+    __io_apic_eoi(apic, vector, pin);
+    spin_unlock_irqrestore(&ioapic_lock, flags);
+}
+
 /*
  * Saves all the IO-APIC RTE's
  */
@@ -350,7 +456,7 @@
         pin = entry->pin;
         if (pin == -1)
             break;
-        io_apic_eoi(entry->apic, vector);
+        __io_apic_eoi(entry->apic, vector, pin);
         if (!entry->next)
             break;
         entry = irq_2_pin + entry->next;
@@ -1699,7 +1805,7 @@
     {
         int ioapic;
         for (ioapic = 0; ioapic < nr_ioapics; ioapic++)
-            io_apic_eoi(ioapic, i);
+            io_apic_eoi_vector(ioapic, i);
     }
 
     v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
@@ -2572,3 +2678,4 @@
     printk(XENLOG_INFO "IRQ limits: %u GSI, %u MSI/MSI-X\n",
            nr_irqs_gsi, nr_irqs - nr_irqs_gsi);
 }
+
diff -r 08568ad1140a -r 829c4fd73b10 xen/include/asm-x86/io_apic.h
--- a/xen/include/asm-x86/io_apic.h	Tue Sep 13 10:35:44 2011 +0100
+++ b/xen/include/asm-x86/io_apic.h	Tue Sep 13 10:38:34 2011 +0100
@@ -157,11 +157,6 @@
 	__io_apic_write(apic, reg, value);
 }
 
-static inline void io_apic_eoi(unsigned int apic, unsigned int vector)
-{
-	*(IO_APIC_BASE(apic)+16) = vector;
-}
-
 /*
  * Re-write a value: to be used for read-modify-write
  * cycles where the read already set up the index register.

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 10:56:37 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 10:56:37 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3thM-00015l-Ro; Wed, 14 Sep 2011 10:56:36 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg1-0000bV-Bh
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1316022892!44885175!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8286 invoked from network); 14 Sep 2011 17:54:52 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:54:52 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tfy-0005d5-19
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:10 +0100
Message-Id: <E1R3tfy-0005d5-19@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: don't clear acpi_info
	after filling in some fields
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1315905723 -3600
# Node ID ad958e87db79549165661d50b9b77526f22b0f03
# Parent  0312575dc35e4294eb50e365b2c10078914daca8
hvmloader: don't clear acpi_info after filling in some fields

In particular the madt_lapic0_addr and madt_csum_addr fields are
filled in while building the tables.

This fixes a bluescreen on shutdown with certain versions of Windows.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reported-by: Christoph Egger <Christoph.Egger@amd.com>
Tested-and-acked-by: Christoph Egger <Christoph.Egger@amd.com>
---


diff -r 0312575dc35e -r ad958e87db79 tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c	Thu Sep 08 15:13:06 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/build.c	Tue Sep 13 10:22:03 2011 +0100
@@ -277,6 +277,8 @@
     unsigned long        secondary_tables[16];
     int                  nr_secondaries, i;
 
+    memset(acpi_info, 0, sizeof(*acpi_info));
+
     /*
      * Fill in high-memory data structures, starting at @buf.
      */
@@ -375,7 +377,6 @@
                  offsetof(struct acpi_20_rsdp, extended_checksum),
                  sizeof(struct acpi_20_rsdp));
 
-    memset(acpi_info, 0, sizeof(*acpi_info));
     acpi_info->com1_present = uart_exists(0x3f8);
     acpi_info->com2_present = uart_exists(0x2f8);
     acpi_info->lpt1_present = lpt_exists(0x378);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 10:56:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 10:56:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3thW-00019H-Aj; Wed, 14 Sep 2011 10:56:46 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg1-0000bi-UP
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1316022910!17360313!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15148 invoked from network); 14 Sep 2011 17:55:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:55:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tfy-0005eJ-K3
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:10 +0100
Message-Id: <E1R3tfy-0005eJ-K3@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: use batch of pages during
	final page-in
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1315905932 -3600
# Node ID d1d6abc1db2077d2d4f1c7a441399d07c0c05471
# Parent  ad958e87db79549165661d50b9b77526f22b0f03
xenpaging: use batch of pages during final page-in

Map up to RING_SIZE pages in exit path to fill the ring instead of
populating one page at a time.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---


diff -r ad958e87db79 -r d1d6abc1db20 tools/xenpaging/pagein.c
--- a/tools/xenpaging/pagein.c	Tue Sep 13 10:22:03 2011 +0100
+++ b/tools/xenpaging/pagein.c	Tue Sep 13 10:25:32 2011 +0100
@@ -1,14 +1,16 @@
 /* Trigger a page-in in a separate thread-of-execution to avoid deadlock */
 #include <pthread.h>
-#include "xc_private.h"
+#include <xc_private.h>
+#include "xenpaging.h"
 
 struct page_in_args {
     domid_t dom;
+    unsigned long *pagein_queue;
     xc_interface *xch;
 };
 
 static struct page_in_args page_in_args;
-static unsigned long page_in_gfn;
+static unsigned long page_in_request;
 static unsigned int page_in_possible;
 
 static pthread_t page_in_thread;
@@ -19,19 +21,28 @@
 {
     struct page_in_args *pia = arg;
     void *page;
-    xen_pfn_t gfn;
+    int i, num;
+    xen_pfn_t gfns[XENPAGING_PAGEIN_QUEUE_SIZE];
 
     while (1)
     {
         pthread_mutex_lock(&page_in_mutex);
-        while (!page_in_gfn)
+        while (!page_in_request)
             pthread_cond_wait(&page_in_cond, &page_in_mutex);
-        gfn = page_in_gfn;
-        page_in_gfn = 0;
+        num = 0;
+        for (i = 0; i < XENPAGING_PAGEIN_QUEUE_SIZE; i++)
+        {
+            if (!pia->pagein_queue[i])
+               continue;
+            gfns[num] = pia->pagein_queue[i];
+            pia->pagein_queue[i] = 0;
+            num++;
+        }
+        page_in_request = 0;
         pthread_mutex_unlock(&page_in_mutex);
 
         /* Ignore errors */
-        page = xc_map_foreign_pages(pia->xch, pia->dom, PROT_READ, &gfn, 1);
+        page = xc_map_foreign_pages(pia->xch, pia->dom, PROT_READ, gfns, num);
         if (page)
             munmap(page, PAGE_SIZE);
     }
@@ -39,21 +50,22 @@
     pthread_exit(NULL);
 }
 
-void page_in_trigger(unsigned long gfn)
+void page_in_trigger(void)
 {
     if (!page_in_possible)
         return;
 
     pthread_mutex_lock(&page_in_mutex);
-    page_in_gfn = gfn;
+    page_in_request = 1;
     pthread_mutex_unlock(&page_in_mutex);
     pthread_cond_signal(&page_in_cond);
 }
 
-void create_page_in_thread(domid_t domain_id, xc_interface *xch)
+void create_page_in_thread(xenpaging_t *paging)
 {
-    page_in_args.dom = domain_id;
-    page_in_args.xch = xch;
+    page_in_args.dom = paging->mem_event.domain_id;
+    page_in_args.pagein_queue = paging->pagein_queue;
+    page_in_args.xch = paging->xc_handle;
     if (pthread_create(&page_in_thread, NULL, page_in, &page_in_args) == 0)
         page_in_possible = 1;
 }
diff -r ad958e87db79 -r d1d6abc1db20 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Tue Sep 13 10:22:03 2011 +0100
+++ b/tools/xenpaging/xenpaging.c	Tue Sep 13 10:25:32 2011 +0100
@@ -648,7 +648,7 @@
     sigaction(SIGALRM, &act, NULL);
 
     /* listen for page-in events to stop pager */
-    create_page_in_thread(paging->mem_event.domain_id, xch);
+    create_page_in_thread(paging);
 
     /* Evict pages */
     for ( i = 0; i < paging->num_pages; i++ )
@@ -764,16 +764,24 @@
         /* Write all pages back into the guest */
         if ( interrupted == SIGTERM || interrupted == SIGINT )
         {
+            int num = 0;
             for ( i = 0; i < paging->domain_info->max_pages; i++ )
             {
                 if ( test_bit(i, paging->bitmap) )
                 {
-                    page_in_trigger(i);
-                    break;
+                    paging->pagein_queue[num] = i;
+                    num++;
+                    if ( num == XENPAGING_PAGEIN_QUEUE_SIZE )
+                        break;
                 }
             }
-            /* If no more pages to process, exit loop */
-            if ( i == paging->domain_info->max_pages )
+            /*
+             * One more round if there are still pages to process.
+             * If no more pages to process, exit loop.
+             */
+            if ( num )
+                page_in_trigger();
+            else if ( i == paging->domain_info->max_pages )
                 break;
         }
         else
diff -r ad958e87db79 -r d1d6abc1db20 tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h	Tue Sep 13 10:22:03 2011 +0100
+++ b/tools/xenpaging/xenpaging.h	Tue Sep 13 10:25:32 2011 +0100
@@ -29,6 +29,8 @@
 #include <xen/event_channel.h>
 #include <xen/mem_event.h>
 
+#define XENPAGING_PAGEIN_QUEUE_SIZE 64
+
 typedef struct mem_event {
     domid_t domain_id;
     xc_evtchn *xce_handle;
@@ -49,6 +51,7 @@
     mem_event_t mem_event;
     int num_pages;
     int policy_mru_size;
+    unsigned long pagein_queue[XENPAGING_PAGEIN_QUEUE_SIZE];
 } xenpaging_t;
 
 
@@ -58,8 +61,8 @@
 } xenpaging_victim_t;
 
 
-extern void create_page_in_thread(domid_t domain_id, xc_interface *xch);
-extern void page_in_trigger(unsigned long gfn);
+extern void create_page_in_thread(xenpaging_t *paging);
+extern void page_in_trigger(void);
 
 #endif // __XEN_PAGING_H__
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 10:56:53 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 10:56:53 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3thc-0001CP-W0; Wed, 14 Sep 2011 10:56:53 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg2-0000bp-Be
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1316022867!48428710!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1380 invoked from network); 14 Sep 2011 17:54:27 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:54:27 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tfz-0005f1-43
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:11 +0100
Message-Id: <E1R3tfz-0005f1-43@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Move the ioemu-dir-find shell script
	to an external file
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1315906040 -3600
# Node ID 0d21b68f528b5772942a8501de32e1493352a62e
# Parent  d1d6abc1db2077d2d4f1c7a441399d07c0c05471
Move the ioemu-dir-find shell script to an external file

Add support for configuring upstream qemu and rename ioemu-remote
ioemu-dir-remote.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r d1d6abc1db20 -r 0d21b68f528b .hgignore
--- a/.hgignore	Tue Sep 13 10:25:32 2011 +0100
+++ b/.hgignore	Tue Sep 13 10:27:20 2011 +0100
@@ -291,7 +291,7 @@
 ^tools/xm-test/lib/XmTestLib/config.py$
 ^tools/xm-test/lib/XmTestReport/xmtest.py$
 ^tools/xm-test/tests/.*\.test$
-^tools/ioemu-remote
+^tools/ioemu-dir-remote
 ^tools/ioemu-dir$
 ^tools/ocaml/.*/.*\.annot$
 ^tools/ocaml/.*/.*\.cmx?a$
diff -r d1d6abc1db20 -r 0d21b68f528b scripts/git-checkout.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/git-checkout.sh	Tue Sep 13 10:27:20 2011 +0100
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+TREE=$1
+TAG=$2
+DIR=$3
+
+
+if test -d $TREE; then
+	mkdir -p $DIR
+	ROOT=$TREE
+else
+	if test \! -d $DIR-remote; then
+		rm -rf $DIR-remote $DIR-remote.tmp;
+		mkdir $DIR-remote.tmp; rmdir $DIR-remote.tmp;
+		git clone $TREE $DIR-remote.tmp;
+		if test "$TAG" ; then
+			cd $DIR-remote.tmp
+			git branch -D dummy >/dev/null 2>&1 ||:
+			git checkout -b dummy $TAG
+			cd ..
+		fi
+		mv $DIR-remote.tmp $DIR-remote
+	fi
+	rm -f $DIR
+	ln -sf $DIR-remote $DIR
+	ROOT=.
+fi
+
+set -e
+cd $DIR
+# is this qemu-xen-traditional?
+if test -f $ROOT/xen-setup; then
+	$ROOT/xen-setup $IOEMU_CONFIGURE_CROSS
+# is this qemu-xen?
+elif test -f $ROOT/configure; then
+	cd $ROOT
+	./configure --enable-xen --target-list=i386-softmmu \
+		--extra-cflags="-I$XEN_ROOT/tools/include \
+		-I$XEN_ROOT/tools/libxc \
+		-I$XEN_ROOT/tools/xenstore" \
+		--extra-ldflags="-L$XEN_ROOT/tools/libxc \
+		-L$XEN_ROOT/tools/libxenstore" \
+		--bindir=/usr/lib/xen/bin \
+		--disable-kvm \
+		$IOEMU_CONFIGURE_CROSS
+fi
diff -r d1d6abc1db20 -r 0d21b68f528b tools/Makefile
--- a/tools/Makefile	Tue Sep 13 10:25:32 2011 +0100
+++ b/tools/Makefile	Tue Sep 13 10:27:20 2011 +0100
@@ -70,7 +70,7 @@
 
 .PHONY: distclean
 distclean: subdirs-distclean
-	rm -rf ioemu-dir ioemu-remote
+	rm -rf ioemu-dir ioemu-dir-remote
 
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
@@ -78,41 +78,14 @@
 			 --interp-prefix=$(CROSS_SYS_ROOT)
 endif
 
-QEMU_ROOT := $(shell if [ -d "$(CONFIG_QEMU)" ]; then echo "$(CONFIG_QEMU)"; else echo .; fi)
-ifneq ($(QEMU_ROOT),.)
-export QEMU_ROOT
-endif
-
 ioemu-dir-find:
-	set -ex; \
-	if test -d $(CONFIG_QEMU); then \
-		mkdir -p ioemu-dir; \
-	else \
-		if [ ! -d ioemu-remote ]; then \
-			rm -rf ioemu-remote ioemu-remote.tmp; \
-			mkdir ioemu-remote.tmp; rmdir ioemu-remote.tmp; \
-			$(GIT) clone $(CONFIG_QEMU) ioemu-remote.tmp; \
-			if [ "$(QEMU_TAG)" ]; then			\
-				cd ioemu-remote.tmp;			\
-				$(GIT) branch -D dummy >/dev/null 2>&1 ||:; \
-				$(GIT) checkout -b dummy $(QEMU_TAG);	\
-				cd ..;					\
-			fi;						\
-			mv ioemu-remote.tmp ioemu-remote; \
-		fi; \
-		rm -f ioemu-dir; \
-		ln -sf ioemu-remote ioemu-dir; \
-	fi
-	set -e; \
-		$(buildmakevars2shellvars); \
-		cd ioemu-dir; \
-		$(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS)
-
+	$(XEN_ROOT)/scripts/git-checkout.sh $(CONFIG_QEMU) $(QEMU_TAG) ioemu-dir
+	
 .PHONY: ioemu-dir-force-update
 ioemu-dir-force-update:
 	set -ex; \
 	if [ "$(QEMU_TAG)" ]; then \
-		cd ioemu-remote; \
+		cd ioemu-dir-remote; \
 		$(GIT) fetch origin; \
 		$(GIT) reset --hard $(QEMU_TAG); \
 	fi

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 10:57:02 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 10:57:02 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3thk-0001FS-J3; Wed, 14 Sep 2011 10:57:01 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg3-0000c4-5p
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1316022877!60228542!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32526 invoked from network); 14 Sep 2011 17:54:37 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:54:37 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tg0-0005gb-5Z
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:12 +0100
Message-Id: <E1R3tg0-0005gb-5Z@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Clone and build upstream Qemu by
	default
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1315906154 -3600
# Node ID 1b80eaeeba7bceac981316b7383bc7cefab1ecce
# Parent  9a541243aeaf37eac1d471efc3b0aa62f800d5cc
Clone and build upstream Qemu by default

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r 9a541243aeaf -r 1b80eaeeba7b .hgignore
--- a/.hgignore	Tue Sep 13 10:27:53 2011 +0100
+++ b/.hgignore	Tue Sep 13 10:29:14 2011 +0100
@@ -293,6 +293,8 @@
 ^tools/xm-test/tests/.*\.test$
 ^tools/qemu-xen-traditional-dir-remote
 ^tools/qemu-xen-traditional-dir$
+^tools/qemu-xen-dir-remote
+^tools/qemu-xen-dir$
 ^tools/ocaml/.*/.*\.annot$
 ^tools/ocaml/.*/.*\.cmx?a$
 ^tools/ocaml/.*/META$
diff -r 9a541243aeaf -r 1b80eaeeba7b Config.mk
--- a/Config.mk	Tue Sep 13 10:27:53 2011 +0100
+++ b/Config.mk	Tue Sep 13 10:29:14 2011 +0100
@@ -192,6 +192,10 @@
 QEMU_REMOTE=git://xenbits.xensource.com/qemu-xen-unstable.git
 endif
 
+# Only available through the git protocol at the moment
+QEMU_UPSTREAM_URL ?= git://xenbits.xen.org/people/sstabellini/qemu-dm.git
+QEMU_UPSTREAM_TAG ?= origin/xen-stable-0.15
+
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
diff -r 9a541243aeaf -r 1b80eaeeba7b Makefile
--- a/Makefile	Tue Sep 13 10:27:53 2011 +0100
+++ b/Makefile	Tue Sep 13 10:29:14 2011 +0100
@@ -70,7 +70,7 @@
 	$(MAKE) -C tools install
 
 ifeq ($(CONFIG_IOEMU),y)
-install-tools: tools/qemu-xen-traditional-dir
+install-tools: tools/qemu-xen-traditional-dir tools/qemu-xen-dir
 endif
 
 .PHONY: install-kernels
@@ -91,6 +91,9 @@
 tools/qemu-xen-traditional-dir-force-update:
 	$(MAKE) -C tools qemu-xen-traditional-dir-force-update
 
+tools/qemu-xen-dir:
+	$(MAKE) -C tools qemu-xen-dir-find
+
 .PHONY: install-docs
 install-docs:
 	sh ./docs/check_pkgs && $(MAKE) -C docs install || true
diff -r 9a541243aeaf -r 1b80eaeeba7b tools/Makefile
--- a/tools/Makefile	Tue Sep 13 10:27:53 2011 +0100
+++ b/tools/Makefile	Tue Sep 13 10:29:14 2011 +0100
@@ -31,6 +31,7 @@
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
 SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-traditional-dir
+SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-dir
 endif
 
 SUBDIRS-y += xenpmd
@@ -71,6 +72,7 @@
 .PHONY: distclean
 distclean: subdirs-distclean
 	rm -rf qemu-xen-traditional-dir qemu-xen-traditional-dir-remote
+	rm -rf qemu-xen-dir qemu-xen-dir-remote
 
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
@@ -81,6 +83,9 @@
 qemu-xen-traditional-dir-find:
 	$(XEN_ROOT)/scripts/git-checkout.sh $(CONFIG_QEMU) $(QEMU_TAG) qemu-xen-traditional-dir
 	
+qemu-xen-dir-find:
+	$(XEN_ROOT)/scripts/git-checkout.sh $(QEMU_UPSTREAM_URL) $(QEMU_UPSTREAM_TAG) qemu-xen-dir
+	
 .PHONY: qemu-xen-traditional-dir-force-update
 qemu-xen-traditional-dir-force-update:
 	set -ex; \
@@ -98,6 +103,14 @@
 		$(MAKE) -C qemu-xen-traditional-dir clean; \
 	fi
 
+subdir-all-qemu-xen-dir subdir-install-qemu-xen-dir: qemu-xen-dir-find
+
+subdir-clean-qemu-xen-dir:
+	set -e; if test -d qemu-xen-dir/.; then \
+		$(buildmakevars2shellvars); \
+		$(MAKE) -C qemu-xen-dir clean; \
+	fi
+
 subdir-clean-debugger/gdbsx subdir-distclean-debugger/gdbsx: .phony
 	$(MAKE) -C debugger/gdbsx clean
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 10:57:13 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 10:57:13 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3thw-0001K1-QC; Wed, 14 Sep 2011 10:57:12 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg2-0000bq-MF
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1316022900!40050350!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29175 invoked from network); 14 Sep 2011 17:55:00 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:55:00 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tfz-0005fn-Ki
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:11 +0100
Message-Id: <E1R3tfz-0005fn-Ki@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Rename ioemu-dir as
	qemu-xen-traditional-dir
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1315906073 -3600
# Node ID 9a541243aeaf37eac1d471efc3b0aa62f800d5cc
# Parent  0d21b68f528b5772942a8501de32e1493352a62e
Rename ioemu-dir as qemu-xen-traditional-dir

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r 0d21b68f528b -r 9a541243aeaf .hgignore
--- a/.hgignore	Tue Sep 13 10:27:20 2011 +0100
+++ b/.hgignore	Tue Sep 13 10:27:53 2011 +0100
@@ -291,8 +291,8 @@
 ^tools/xm-test/lib/XmTestLib/config.py$
 ^tools/xm-test/lib/XmTestReport/xmtest.py$
 ^tools/xm-test/tests/.*\.test$
-^tools/ioemu-dir-remote
-^tools/ioemu-dir$
+^tools/qemu-xen-traditional-dir-remote
+^tools/qemu-xen-traditional-dir$
 ^tools/ocaml/.*/.*\.annot$
 ^tools/ocaml/.*/.*\.cmx?a$
 ^tools/ocaml/.*/META$
diff -r 0d21b68f528b -r 9a541243aeaf Makefile
--- a/Makefile	Tue Sep 13 10:27:20 2011 +0100
+++ b/Makefile	Tue Sep 13 10:27:53 2011 +0100
@@ -70,7 +70,7 @@
 	$(MAKE) -C tools install
 
 ifeq ($(CONFIG_IOEMU),y)
-install-tools: tools/ioemu-dir
+install-tools: tools/qemu-xen-traditional-dir
 endif
 
 .PHONY: install-kernels
@@ -78,18 +78,18 @@
 	for i in $(XKERNELS) ; do $(MAKE) $$i-install || exit 1; done
 
 .PHONY: install-stubdom
-install-stubdom: tools/ioemu-dir install-tools
+install-stubdom: tools/qemu-xen-traditional-dir install-tools
 	$(MAKE) -C stubdom install
 ifeq (x86_64,$(XEN_TARGET_ARCH))
 	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
 endif
 
-tools/ioemu-dir:
-	$(MAKE) -C tools ioemu-dir-find
+tools/qemu-xen-traditional-dir:
+	$(MAKE) -C tools qemu-xen-traditional-dir-find
 
-.PHONY: tools/ioemu-dir-force-update
-tools/ioemu-dir-force-update:
-	$(MAKE) -C tools ioemu-dir-force-update
+.PHONY: tools/qemu-xen-traditional-dir-force-update
+tools/qemu-xen-traditional-dir-force-update:
+	$(MAKE) -C tools qemu-xen-traditional-dir-force-update
 
 .PHONY: install-docs
 install-docs:
diff -r 0d21b68f528b -r 9a541243aeaf tools/Makefile
--- a/tools/Makefile	Tue Sep 13 10:27:20 2011 +0100
+++ b/tools/Makefile	Tue Sep 13 10:27:53 2011 +0100
@@ -30,7 +30,7 @@
 
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
-SUBDIRS-$(CONFIG_IOEMU) += ioemu-dir
+SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-traditional-dir
 endif
 
 SUBDIRS-y += xenpmd
@@ -70,7 +70,7 @@
 
 .PHONY: distclean
 distclean: subdirs-distclean
-	rm -rf ioemu-dir ioemu-dir-remote
+	rm -rf qemu-xen-traditional-dir qemu-xen-traditional-dir-remote
 
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
@@ -78,24 +78,24 @@
 			 --interp-prefix=$(CROSS_SYS_ROOT)
 endif
 
-ioemu-dir-find:
-	$(XEN_ROOT)/scripts/git-checkout.sh $(CONFIG_QEMU) $(QEMU_TAG) ioemu-dir
+qemu-xen-traditional-dir-find:
+	$(XEN_ROOT)/scripts/git-checkout.sh $(CONFIG_QEMU) $(QEMU_TAG) qemu-xen-traditional-dir
 	
-.PHONY: ioemu-dir-force-update
-ioemu-dir-force-update:
+.PHONY: qemu-xen-traditional-dir-force-update
+qemu-xen-traditional-dir-force-update:
 	set -ex; \
 	if [ "$(QEMU_TAG)" ]; then \
-		cd ioemu-dir-remote; \
+		cd qemu-xen-traditional-dir-remote; \
 		$(GIT) fetch origin; \
 		$(GIT) reset --hard $(QEMU_TAG); \
 	fi
 
-subdir-all-ioemu-dir subdir-install-ioemu-dir: ioemu-dir-find
+subdir-all-qemu-xen-traditional-dir subdir-install-qemu-xen-traditional-dir: qemu-xen-traditional-dir-find
 
-subdir-clean-ioemu-dir:
-	set -e; if test -d ioemu-dir/.; then \
+subdir-clean-qemu-xen-traditional-dir:
+	set -e; if test -d qemu-xen-traditional-dir/.; then \
 		$(buildmakevars2shellvars); \
-		$(MAKE) -C ioemu-dir clean; \
+		$(MAKE) -C qemu-xen-traditional-dir clean; \
 	fi
 
 subdir-clean-debugger/gdbsx subdir-distclean-debugger/gdbsx: .phony

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 10:57:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 10:57:24 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3ti8-0001Ov-Ck; Wed, 14 Sep 2011 10:57:24 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg4-0000cG-8v
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1316022912!10201758!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19182 invoked from network); 14 Sep 2011 17:55:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:55:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tg0-0005hQ-Mu
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:12 +0100
Message-Id: <E1R3tg0-0005hQ-Mu@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Clone and build Seabios by default
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1315906209 -3600
# Node ID 53416e7c05297978985bd943f8d179599829dbf7
# Parent  1b80eaeeba7bceac981316b7383bc7cefab1ecce
Clone and build Seabios by default

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r 1b80eaeeba7b -r 53416e7c0529 .hgignore
--- a/.hgignore	Tue Sep 13 10:29:14 2011 +0100
+++ b/.hgignore	Tue Sep 13 10:30:09 2011 +0100
@@ -295,6 +295,8 @@
 ^tools/qemu-xen-traditional-dir$
 ^tools/qemu-xen-dir-remote
 ^tools/qemu-xen-dir$
+^tools/tools/firmware/seabios-dir-remote
+^tools/tools/firmware/seabios-dir$
 ^tools/ocaml/.*/.*\.annot$
 ^tools/ocaml/.*/.*\.cmx?a$
 ^tools/ocaml/.*/META$
diff -r 1b80eaeeba7b -r 53416e7c0529 Config.mk
--- a/Config.mk	Tue Sep 13 10:29:14 2011 +0100
+++ b/Config.mk	Tue Sep 13 10:30:09 2011 +0100
@@ -195,6 +195,8 @@
 # Only available through the git protocol at the moment
 QEMU_UPSTREAM_URL ?= git://xenbits.xen.org/people/sstabellini/qemu-dm.git
 QEMU_UPSTREAM_TAG ?= origin/xen-stable-0.15
+SEABIOS_UPSTREAM_URL=git://git.qemu.org/seabios.git
+SEABIOS_UPSTREAM_TAG ?= 7fc039e9c262b4199fab497f3e12f4e425c37560
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
@@ -208,15 +210,6 @@
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.
 
-# SeaBIOS integration is a work in progress. Before enabling this
-# option you must clone git://git.qemu.org/seabios.git/, possibly add
-# some development patches and then build it yourself before pointing
-# this variable to it (using an absolute path).
-#
-# Note that using SeaBIOS requires the use the upstream qemu as the
-# device model.
-SEABIOS_DIR ?= 
-
 # Optional components
 XENSTAT_XENTOP     ?= y
 VTPM_TOOLS         ?= n
diff -r 1b80eaeeba7b -r 53416e7c0529 tools/firmware/Makefile
--- a/tools/firmware/Makefile	Tue Sep 13 10:29:14 2011 +0100
+++ b/tools/firmware/Makefile	Tue Sep 13 10:30:09 2011 +0100
@@ -6,13 +6,18 @@
 INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR)
 
 SUBDIRS :=
+SUBDIRS += seabios-dir
 SUBDIRS += rombios
 SUBDIRS += vgabios
 SUBDIRS += etherboot
 SUBDIRS += hvmloader
 
+seabios-dir:
+	$(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_TAG) seabios-dir
+	cp seabios-config seabios-dir/.config;
+
 .PHONY: all
-all:
+all: seabios-dir
 	@set -e; if [ $$((`( bcc -v 2>&1 | grep version || echo 0.0.0 ) | cut -d' ' -f 3 | awk -F. '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -lt $$((0x00100e)) ] ; then \
 	echo "==========================================================================="; \
 	echo "Require dev86 rpm or bin86 & bcc debs version >= 0.16.14 to build firmware!"; \
@@ -35,4 +40,7 @@
 distclean: subdirs-distclean
 
 subdir-distclean-etherboot: .phony
-	$(MAKE) -C etherboot distclean
\ No newline at end of file
+	$(MAKE) -C etherboot distclean
+
+subdir-distclean-seabios-dir: .phony
+	rm -rf seabios-dir seabios-dir-remote
diff -r 1b80eaeeba7b -r 53416e7c0529 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Tue Sep 13 10:29:14 2011 +0100
+++ b/tools/firmware/hvmloader/Makefile	Tue Sep 13 10:30:09 2011 +0100
@@ -44,6 +44,7 @@
 ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
 endif
 
+SEABIOS_DIR := ../seabios-dir
 ifneq ($(SEABIOS_DIR),)
 OBJS += seabios.o
 CFLAGS += -DENABLE_SEABIOS
diff -r 1b80eaeeba7b -r 53416e7c0529 tools/firmware/seabios-config
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/seabios-config	Tue Sep 13 10:30:09 2011 +0100
@@ -0,0 +1,73 @@
+#
+# Automatically generated make config: don't edit
+# SeaBIOS Configuration
+# Wed Sep  7 13:03:21 2011
+#
+
+#
+# General Features
+#
+# CONFIG_COREBOOT is not set
+CONFIG_XEN=y
+CONFIG_THREADS=y
+# CONFIG_THREAD_OPTIONROMS is not set
+CONFIG_RELOCATE_INIT=y
+CONFIG_BOOTMENU=y
+# CONFIG_BOOTSPLASH is not set
+CONFIG_BOOTORDER=y
+
+#
+# Hardware support
+#
+CONFIG_ATA=y
+CONFIG_ATA_DMA=y
+CONFIG_ATA_PIO32=y
+CONFIG_AHCI=y
+CONFIG_VIRTIO_BLK=y
+CONFIG_FLOPPY=y
+CONFIG_PS2PORT=y
+CONFIG_USB=y
+CONFIG_USB_UHCI=y
+CONFIG_USB_OHCI=y
+CONFIG_USB_EHCI=y
+CONFIG_USB_MSC=y
+CONFIG_USB_HUB=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_MOUSE=y
+CONFIG_SERIAL=y
+CONFIG_LPT=y
+# CONFIG_USE_SMM is not set
+CONFIG_MTRR_INIT=y
+
+#
+# BIOS interfaces
+#
+CONFIG_DRIVES=y
+CONFIG_CDROM_BOOT=y
+CONFIG_CDROM_EMU=y
+CONFIG_PCIBIOS=y
+CONFIG_APMBIOS=y
+CONFIG_PNPBIOS=y
+CONFIG_OPTIONROMS=y
+# CONFIG_OPTIONROMS_DEPLOYED is not set
+CONFIG_PMM=y
+CONFIG_BOOT=y
+CONFIG_KEYBOARD=y
+CONFIG_KBD_CALL_INT15_4F=y
+CONFIG_MOUSE=y
+CONFIG_S3_RESUME=y
+# CONFIG_DISABLE_A20 is not set
+
+#
+# BIOS Tables
+#
+CONFIG_PIRTABLE=y
+CONFIG_MPTABLE=y
+CONFIG_SMBIOS=y
+CONFIG_ACPI=y
+
+#
+# Debugging
+#
+CONFIG_DEBUG_LEVEL=1
+# CONFIG_DEBUG_SERIAL is not set

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 10:57:39 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 10:57:39 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3tiN-0001Rz-9s; Wed, 14 Sep 2011 10:57:39 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg4-0000cR-9w
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1316022897!58987163!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12901 invoked from network); 14 Sep 2011 17:54:57 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:54:57 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tg1-0005iJ-9l
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:13 +0100
Message-Id: <E1R3tg1-0005iJ-9l@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: if mapping GSIs we run out of
	pirq < nr_irqs_gsi, use the others
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1315906344 -3600
# Node ID ad3b4bb097cb6308f73e597c5412395ad783ea4a
# Parent  53416e7c05297978985bd943f8d179599829dbf7
xen: if mapping GSIs we run out of pirq < nr_irqs_gsi, use the others

PV on HVM guests can have more GSIs than the host, in that case we
could run out of pirq < nr_irqs_gsi. When that happens use pirq >=
nr_irqs_gsi rather than returning an error.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Benjamin Schweikert <b.schweikert@googlemail.com>
---


diff -r 53416e7c0529 -r ad3b4bb097cb xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Tue Sep 13 10:30:09 2011 +0100
+++ b/xen/arch/x86/irq.c	Tue Sep 13 10:32:24 2011 +0100
@@ -1646,15 +1646,12 @@
                 return i;
             }
     }
-    else
-    {
-        for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- )
-            if ( is_free_pirq(d, pirq_info(d, i)) )
-            {
-                pirq_get_info(d, i);
-                return i;
-            }
-    }
+    for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- )
+        if ( is_free_pirq(d, pirq_info(d, i)) )
+        {
+            pirq_get_info(d, i);
+            return i;
+        }
 
     return -ENOSPC;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 10:57:57 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 10:57:57 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3tif-0001Ve-GK; Wed, 14 Sep 2011 10:57:57 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg6-0000d3-Cd
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1316022880!60228546!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32588 invoked from network); 14 Sep 2011 17:54:40 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:54:40 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tg3-0005lW-D0
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:15 +0100
Message-Id: <E1R3tg3-0005lW-D0@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: fix permissions of
	git-checkout.sh
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1315921942 -3600
# Node ID e564f2f1b737bc756410b34d886a15711caa288a
# Parent  64aab9a077ea937b31fd678b02f755139b924184
tools: fix permissions of git-checkout.sh

23828:0d21b68f528b introduced a new scripts/git-checkout.sh, but it
had the wrong permissions.  chmod +x it, and add a blank line at the
end to make sure it actually gets updated.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 64aab9a077ea -r e564f2f1b737 scripts/git-checkout.sh
--- a/scripts/git-checkout.sh	Tue Sep 13 11:20:57 2011 +0100
+++ b/scripts/git-checkout.sh	Tue Sep 13 14:52:22 2011 +0100
@@ -44,3 +44,4 @@
 		--disable-kvm \
 		$IOEMU_CONFIGURE_CROSS
 fi
+

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 10:58:15 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 10:58:15 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3tiw-0001ZR-JG; Wed, 14 Sep 2011 10:58:14 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg6-0000d0-0d
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1316022914!17360318!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15339 invoked from network); 14 Sep 2011 17:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tg2-0005jw-C1
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:14 +0100
Message-Id: <E1R3tg2-0005jw-C1@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen,credit1: Add variable timeslice
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1315907023 -3600
# Node ID 1d40b27937230ba849c6e4743fc17eaf3727e35f
# Parent  ffe8e65f6687cde49b2cb2bf991bd3f5dff9c189
xen,credit1: Add variable timeslice

Add a xen command-line parameter, sched_credit_tslice_ms,
to set the timeslice of the credit1 scheduler.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
---


diff -r ffe8e65f6687 -r 1d40b2793723 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Tue Sep 13 10:33:10 2011 +0100
+++ b/xen/common/sched_credit.c	Tue Sep 13 10:43:43 2011 +0100
@@ -41,15 +41,9 @@
  */
 #define CSCHED_DEFAULT_WEIGHT       256
 #define CSCHED_TICKS_PER_TSLICE     3
-#define CSCHED_TICKS_PER_ACCT       3
-#define CSCHED_MSECS_PER_TICK       10
-#define CSCHED_MSECS_PER_TSLICE     \
-    (CSCHED_MSECS_PER_TICK * CSCHED_TICKS_PER_TSLICE)
+/* Default timeslice: 30ms */
+#define CSCHED_DEFAULT_TSLICE_MS    30
 #define CSCHED_CREDITS_PER_MSEC     10
-#define CSCHED_CREDITS_PER_TSLICE   \
-    (CSCHED_CREDITS_PER_MSEC * CSCHED_MSECS_PER_TSLICE)
-#define CSCHED_CREDITS_PER_ACCT     \
-    (CSCHED_CREDITS_PER_MSEC * CSCHED_MSECS_PER_TICK * CSCHED_TICKS_PER_ACCT)
 
 
 /*
@@ -113,6 +107,8 @@
  */
 static bool_t __read_mostly sched_credit_default_yield;
 boolean_param("sched_credit_default_yield", sched_credit_default_yield);
+static int __read_mostly sched_credit_tslice_ms = CSCHED_DEFAULT_TSLICE_MS;
+integer_param("sched_credit_tslice_ms", sched_credit_tslice_ms);
 
 /*
  * Physical CPU
@@ -176,6 +172,9 @@
     uint32_t credit;
     int credit_balance;
     uint32_t runq_sort;
+    /* Period of master and tick in milliseconds */
+    unsigned tslice_ms, tick_period_us, ticks_per_tslice;
+    unsigned credits_per_tslice;
 };
 
 static void csched_tick(void *_cpu);
@@ -326,7 +325,7 @@
 
     spin_lock_irqsave(&prv->lock, flags);
 
-    prv->credit -= CSCHED_CREDITS_PER_ACCT;
+    prv->credit -= prv->credits_per_tslice;
     prv->ncpus--;
     cpu_clear(cpu, prv->idlers);
     cpu_clear(cpu, prv->cpus);
@@ -360,19 +359,19 @@
     spin_lock_irqsave(&prv->lock, flags);
 
     /* Initialize/update system-wide config */
-    prv->credit += CSCHED_CREDITS_PER_ACCT;
+    prv->credit += prv->credits_per_tslice;
     prv->ncpus++;
     cpu_set(cpu, prv->cpus);
     if ( prv->ncpus == 1 )
     {
         prv->master = cpu;
         init_timer(&prv->master_ticker, csched_acct, prv, cpu);
-        set_timer(&prv->master_ticker, NOW() +
-                  MILLISECS(CSCHED_MSECS_PER_TICK) * CSCHED_TICKS_PER_ACCT);
+        set_timer(&prv->master_ticker,
+                  NOW() + MILLISECS(prv->tslice_ms));
     }
 
     init_timer(&spc->ticker, csched_tick, (void *)(unsigned long)cpu, cpu);
-    set_timer(&spc->ticker, NOW() + MILLISECS(CSCHED_MSECS_PER_TICK));
+    set_timer(&spc->ticker, NOW() + MICROSECS(prv->tick_period_us) );
 
     INIT_LIST_HEAD(&spc->runq);
     spc->runq_sort_last = prv->runq_sort;
@@ -1002,7 +1001,7 @@
          * for one full accounting period. We allow a domain to earn more
          * only when the system-wide credit balance is negative.
          */
-        credit_peak = sdom->active_vcpu_count * CSCHED_CREDITS_PER_ACCT;
+        credit_peak = sdom->active_vcpu_count * prv->credits_per_tslice;
         if ( prv->credit_balance < 0 )
         {
             credit_peak += ( ( -prv->credit_balance
@@ -1014,7 +1013,7 @@
 
         if ( sdom->cap != 0U )
         {
-            credit_cap = ((sdom->cap * CSCHED_CREDITS_PER_ACCT) + 99) / 100;
+            credit_cap = ((sdom->cap * prv->credits_per_tslice) + 99) / 100;
             if ( credit_cap < credit_peak )
                 credit_peak = credit_cap;
 
@@ -1092,10 +1091,10 @@
                 }
 
                 /* Lower bound on credits */
-                if ( credit < -CSCHED_CREDITS_PER_TSLICE )
+                if ( credit < -prv->credits_per_tslice )
                 {
                     CSCHED_STAT_CRANK(acct_min_credit);
-                    credit = -CSCHED_CREDITS_PER_TSLICE;
+                    credit = -prv->credits_per_tslice;
                     atomic_set(&svc->credit, credit);
                 }
             }
@@ -1117,7 +1116,7 @@
                 }
 
                 /* Upper bound on credits means VCPU stops earning */
-                if ( credit > CSCHED_CREDITS_PER_TSLICE )
+                if ( credit > prv->credits_per_tslice )
                 {
                     __csched_vcpu_acct_stop_locked(prv, svc);
                     /* Divide credits in half, so that when it starts
@@ -1141,8 +1140,8 @@
     prv->runq_sort++;
 
 out:
-    set_timer( &prv->master_ticker, NOW() +
-            MILLISECS(CSCHED_MSECS_PER_TICK) * CSCHED_TICKS_PER_ACCT );
+    set_timer( &prv->master_ticker,
+               NOW() + MILLISECS(prv->tslice_ms));
 }
 
 static void
@@ -1169,7 +1168,7 @@
      */
     csched_runq_sort(prv, cpu);
 
-    set_timer(&spc->ticker, NOW() + MILLISECS(CSCHED_MSECS_PER_TICK));
+    set_timer(&spc->ticker, NOW() + MICROSECS(prv->tick_period_us) );
 }
 
 static struct csched_vcpu *
@@ -1375,7 +1374,7 @@
      * Return task to run next...
      */
     ret.time = (is_idle_vcpu(snext->vcpu) ?
-                -1 : MILLISECS(CSCHED_MSECS_PER_TSLICE));
+                -1 : MILLISECS(prv->tslice_ms));
     ret.task = snext->vcpu;
 
     CSCHED_VCPU_CHECK(ret.task);
@@ -1469,10 +1468,9 @@
            "\tweight             = %u\n"
            "\trunq_sort          = %u\n"
            "\tdefault-weight     = %d\n"
-           "\tmsecs per tick     = %dms\n"
+           "\ttslice             = %dms\n"
            "\tcredits per msec   = %d\n"
            "\tticks per tslice   = %d\n"
-           "\tticks per acct     = %d\n"
            "\tmigration delay    = %uus\n",
            prv->ncpus,
            prv->master,
@@ -1481,10 +1479,9 @@
            prv->weight,
            prv->runq_sort,
            CSCHED_DEFAULT_WEIGHT,
-           CSCHED_MSECS_PER_TICK,
+           prv->tslice_ms,
            CSCHED_CREDITS_PER_MSEC,
-           CSCHED_TICKS_PER_TSLICE,
-           CSCHED_TICKS_PER_ACCT,
+           prv->ticks_per_tslice,
            vcpu_migration_delay);
 
     cpumask_scnprintf(idlers_buf, sizeof(idlers_buf), prv->idlers);
@@ -1526,6 +1523,13 @@
     INIT_LIST_HEAD(&prv->active_sdom);
     prv->master = UINT_MAX;
 
+    prv->tslice_ms = sched_credit_tslice_ms;
+    prv->ticks_per_tslice = CSCHED_TICKS_PER_TSLICE;
+    if ( prv->tslice_ms < prv->ticks_per_tslice )
+        prv->ticks_per_tslice = 1;
+    prv->tick_period_us = prv->tslice_ms * 1000 / prv->ticks_per_tslice;
+    prv->credits_per_tslice = CSCHED_CREDITS_PER_MSEC * prv->tslice_ms;
+
     return 0;
 }
 
@@ -1550,13 +1554,16 @@
 
 static void csched_tick_resume(const struct scheduler *ops, unsigned int cpu)
 {
+    struct csched_private *prv;
     struct csched_pcpu *spc;
     uint64_t now = NOW();
 
     spc = CSCHED_PCPU(cpu);
 
-    set_timer(&spc->ticker, now + MILLISECS(CSCHED_MSECS_PER_TICK)
-            - now % MILLISECS(CSCHED_MSECS_PER_TICK) );
+    prv = CSCHED_PRIV(ops);
+
+    set_timer(&spc->ticker, now + MICROSECS(prv->tick_period_us)
+            - now % MICROSECS(prv->tick_period_us) );
 }
 
 static struct csched_private _csched_priv;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 10:58:39 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 10:58:39 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3tjK-0001cg-B7; Wed, 14 Sep 2011 10:58:38 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg5-0000cm-6J
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1316022913!16748543!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10821 invoked from network); 14 Sep 2011 17:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tg1-0005j9-RS
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:13 +0100
Message-Id: <E1R3tg1-0005j9-RS@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IRQ: IO-APIC support End Of
	Interrupt for older IO-APICs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1315906390 -3600
# Node ID ffe8e65f6687cde49b2cb2bf991bd3f5dff9c189
# Parent  ad3b4bb097cb6308f73e597c5412395ad783ea4a
IRQ: IO-APIC support End Of Interrupt for older IO-APICs

The old io_apic_eoi() function using the EOI register only works for
IO-APICs with a version of 0x20.  Older IO-APICs do not have an EOI
register so line level interrupts have to be EOI'd by flipping the
mode to edge and back, which clears the IRR and Delivery Status bits.

This patch replaces the current io_apic_eoi() function with one which
takes into account the version of the IO-APIC and EOI's
appropriately.

v2: make recursive call to __io_apic_eoi() to reduce code size.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r ad3b4bb097cb -r ffe8e65f6687 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Tue Sep 13 10:32:24 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Tue Sep 13 10:33:10 2011 +0100
@@ -68,6 +68,13 @@
 #define MAX_PLUS_SHARED_IRQS nr_irqs_gsi
 #define PIN_MAP_SIZE (MAX_PLUS_SHARED_IRQS + nr_irqs_gsi)
 
+
+#define ioapic_has_eoi_reg(apic) (mp_ioapics[(apic)].mpc_apicver >= 0x20)
+
+#define io_apic_eoi_vector(apic, vector) io_apic_eoi((apic), (vector), -1)
+#define io_apic_eoi_pin(apic, pin) io_apic_eoi((apic), -1, (pin))
+
+
 /*
  * This is performance-critical, we want to do it O(1)
  *
@@ -208,6 +215,105 @@
     spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
+/* EOI an IO-APIC entry.  One of vector or pin may be -1, indicating that
+ * it should be worked out using the other.  This function expect that the
+ * ioapic_lock is taken, and interrupts are disabled (or there is a good reason
+ * not to), and that if both pin and vector are passed, that they refer to the
+ * same redirection entry in the IO-APIC. */
+static void __io_apic_eoi(unsigned int apic, unsigned int vector, unsigned int pin)
+{
+    /* Ensure some useful information is passed in */
+    BUG_ON( (vector == -1 && pin == -1) );
+    
+    /* Prefer the use of the EOI register if available */
+    if ( ioapic_has_eoi_reg(apic) )
+    {
+        /* If vector is unknown, read it from the IO-APIC */
+        if ( vector == -1 )
+            vector = __ioapic_read_entry(apic, pin, TRUE).vector;
+
+        *(IO_APIC_BASE(apic)+16) = vector;
+    }
+    else
+    {
+        /* Else fake an EOI by switching to edge triggered mode
+         * and back */
+        struct IO_APIC_route_entry entry;
+        bool_t need_to_unmask = 0;
+
+        /* If pin is unknown, search for it */
+        if ( pin == -1 )
+        {
+            unsigned int p;
+            for ( p = 0; p < nr_ioapic_registers[apic]; ++p )
+            {
+                entry = __ioapic_read_entry(apic, p, TRUE);
+                if ( entry.vector == vector )
+                {
+                    pin = p;
+                    /* break; */
+
+                    /* Here should be a break out of the loop, but at the 
+                     * Xen code doesn't actually prevent multiple IO-APIC
+                     * entries being assigned the same vector, so EOI all
+                     * pins which have the correct vector.
+                     *
+                     * Remove the following code when the above assertion
+                     * is fulfilled. */
+                    __io_apic_eoi(apic, vector, p);
+                }
+            }
+            
+            /* If search fails, nothing to do */
+
+            /* if ( pin == -1 ) */
+
+            /* Because the loop wasn't broken out of (see comment above),
+             * all relevant pins have been EOI, so we can always return.
+             * 
+             * Re-instate the if statement above when the Xen logic has been
+             * fixed.*/
+
+            return;
+        }
+
+        entry = __ioapic_read_entry(apic, pin, TRUE);
+
+        if ( ! entry.mask )
+        {
+            /* If entry is not currently masked, mask it and make
+             * a note to unmask it later */
+            entry.mask = 1;
+            __ioapic_write_entry(apic, pin, TRUE, entry);
+            need_to_unmask = 1;
+        }
+
+        /* Flip the trigger mode to edge and back */
+        entry.trigger = 0;
+        __ioapic_write_entry(apic, pin, TRUE, entry);
+        entry.trigger = 1;
+        __ioapic_write_entry(apic, pin, TRUE, entry);
+
+        if ( need_to_unmask )
+        {
+            /* Unmask if neccesary */
+            entry.mask = 0;
+            __ioapic_write_entry(apic, pin, TRUE, entry);
+        }
+    }
+}
+
+/* EOI an IO-APIC entry.  One of vector or pin may be -1, indicating that
+ * it should be worked out using the other.  This function disables interrupts
+ * and takes the ioapic_lock */
+static void io_apic_eoi(unsigned int apic, unsigned int vector, unsigned int pin)
+{
+    unsigned int flags;
+    spin_lock_irqsave(&ioapic_lock, flags);
+    __io_apic_eoi(apic, vector, pin);
+    spin_unlock_irqrestore(&ioapic_lock, flags);
+}
+
 /*
  * Saves all the IO-APIC RTE's
  */
@@ -357,7 +463,7 @@
         pin = entry->pin;
         if (pin == -1)
             break;
-        io_apic_eoi(entry->apic, vector);
+        __io_apic_eoi(entry->apic, vector, pin);
         if (!entry->next)
             break;
         entry = irq_2_pin + entry->next;
@@ -397,18 +503,7 @@
             entry.trigger = 1;
             __ioapic_write_entry(apic, pin, TRUE, entry);
         }
-        if (mp_ioapics[apic].mpc_apicver >= 0x20)
-            io_apic_eoi(apic, entry.vector);
-        else {
-            /*
-             * Mechanism by which we clear remoteIRR in this case is by
-             * changing the trigger mode to edge and back to level.
-             */
-            entry.trigger = 0;
-            __ioapic_write_entry(apic, pin, TRUE, entry);
-            entry.trigger = 1;
-            __ioapic_write_entry(apic, pin, TRUE, entry);
-        }
+        __io_apic_eoi(apic, entry.vector, pin);
     }
 
     /*
@@ -1749,7 +1844,7 @@
     {
         int ioapic;
         for (ioapic = 0; ioapic < nr_ioapics; ioapic++)
-            io_apic_eoi(ioapic, i);
+            io_apic_eoi_vector(ioapic, i);
     }
 
     v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
@@ -2621,3 +2716,4 @@
     printk(XENLOG_INFO "IRQ limits: %u GSI, %u MSI/MSI-X\n",
            nr_irqs_gsi, nr_irqs - nr_irqs_gsi);
 }
+
diff -r ad3b4bb097cb -r ffe8e65f6687 xen/include/asm-x86/io_apic.h
--- a/xen/include/asm-x86/io_apic.h	Tue Sep 13 10:32:24 2011 +0100
+++ b/xen/include/asm-x86/io_apic.h	Tue Sep 13 10:33:10 2011 +0100
@@ -157,11 +157,6 @@
 	__io_apic_write(apic, reg, value);
 }
 
-static inline void io_apic_eoi(unsigned int apic, unsigned int vector)
-{
-	*(IO_APIC_BASE(apic)+16) = vector;
-}
-
 /*
  * Re-write a value: to be used for read-modify-write
  * cycles where the read already set up the index register.

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 10:59:45 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 10:59:45 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3tkM-0001gz-Vu; Wed, 14 Sep 2011 10:59:43 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg5-0000d1-TP
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1316022914!34112233!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3371 invoked from network); 14 Sep 2011 17:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tg2-0005kk-Sw
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:14 +0100
Message-Id: <E1R3tg2-0005kk-Sw@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] scripts/git-checkout.sh: Is not bash
	specific. Invoke with /bin/sh.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1315909257 -3600
# Node ID 64aab9a077ea937b31fd678b02f755139b924184
# Parent  1d40b27937230ba849c6e4743fc17eaf3727e35f
scripts/git-checkout.sh: Is not bash specific. Invoke with /bin/sh.

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 1d40b2793723 -r 64aab9a077ea scripts/git-checkout.sh
--- a/scripts/git-checkout.sh	Tue Sep 13 10:43:43 2011 +0100
+++ b/scripts/git-checkout.sh	Tue Sep 13 11:20:57 2011 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 TREE=$1
 TAG=$2

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 11:00:13 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 11:00:13 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3tkq-0001lJ-0j; Wed, 14 Sep 2011 11:00:12 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg7-0000dL-Ap
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1316022916!17755960!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3320 invoked from network); 14 Sep 2011 17:55:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:55:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tg3-0005mL-U1
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:15 +0100
Message-Id: <E1R3tg3-0005mL-U1@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] fix the build when CONFIG_QEMU is
	specified by the user
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <sstabellini@xensource.com>
# Date 1315925207 -3600
# Node ID 51913fe3d25a3756edf9af02843abdb36873618d
# Parent  e564f2f1b737bc756410b34d886a15711caa288a
fix the build when CONFIG_QEMU is specified by the user

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---


diff -r e564f2f1b737 -r 51913fe3d25a scripts/git-checkout.sh
--- a/scripts/git-checkout.sh	Tue Sep 13 14:52:22 2011 +0100
+++ b/scripts/git-checkout.sh	Tue Sep 13 15:46:47 2011 +0100
@@ -30,7 +30,7 @@
 cd $DIR
 # is this qemu-xen-traditional?
 if test -f $ROOT/xen-setup; then
-	$ROOT/xen-setup $IOEMU_CONFIGURE_CROSS
+	QEMU_ROOT=$ROOT $ROOT/xen-setup $IOEMU_CONFIGURE_CROSS
 # is this qemu-xen?
 elif test -f $ROOT/configure; then
 	cd $ROOT

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 14 11:00:39 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 14 Sep 2011 11:00:39 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R3tlF-0001ov-Os; Wed, 14 Sep 2011 11:00:38 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R3tg7-0000de-OZ
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 10:55:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1316022916!31438923!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25920 invoked from network); 14 Sep 2011 17:55:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Sep 2011 17:55:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R3tg4-0005n6-ES
	for xen-changelog@lists.xensource.com; Wed, 14 Sep 2011 18:55:16 +0100
Message-Id: <E1R3tg4-0005n6-ES@xenbits.xen.org>
Date: Wed, 14 Sep 2011 18:55:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: Revert seabios and upstream
	qemu build changes
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1315996693 -3600
# Node ID e90438f6e6d1585a71b18784a99c162b5d95f390
# Parent  51913fe3d25a3756edf9af02843abdb36873618d
tools: Revert seabios and upstream qemu build changes

These have broken the build and it seems to be difficult to fix.  So
we will revert the whole lot for now, and await corrected patch(es).

Revert "fix the build when CONFIG_QEMU is specified by the user"
Revert "tools: fix permissions of git-checkout.sh"
Revert "scripts/git-checkout.sh: Is not bash specific. Invoke with /bin/sh."
Revert "Clone and build Seabios by default"
Revert "Clone and build upstream Qemu by default"
Revert "Rename ioemu-dir as qemu-xen-traditional-dir"
Revert "Move the ioemu-dir-find shell script to an external file"

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 51913fe3d25a -r e90438f6e6d1 .hgignore
--- a/.hgignore	Tue Sep 13 15:46:47 2011 +0100
+++ b/.hgignore	Wed Sep 14 11:38:13 2011 +0100
@@ -291,12 +291,8 @@
 ^tools/xm-test/lib/XmTestLib/config.py$
 ^tools/xm-test/lib/XmTestReport/xmtest.py$
 ^tools/xm-test/tests/.*\.test$
-^tools/qemu-xen-traditional-dir-remote
-^tools/qemu-xen-traditional-dir$
-^tools/qemu-xen-dir-remote
-^tools/qemu-xen-dir$
-^tools/tools/firmware/seabios-dir-remote
-^tools/tools/firmware/seabios-dir$
+^tools/ioemu-remote
+^tools/ioemu-dir$
 ^tools/ocaml/.*/.*\.annot$
 ^tools/ocaml/.*/.*\.cmx?a$
 ^tools/ocaml/.*/META$
diff -r 51913fe3d25a -r e90438f6e6d1 Config.mk
--- a/Config.mk	Tue Sep 13 15:46:47 2011 +0100
+++ b/Config.mk	Wed Sep 14 11:38:13 2011 +0100
@@ -192,12 +192,6 @@
 QEMU_REMOTE=git://xenbits.xensource.com/qemu-xen-unstable.git
 endif
 
-# Only available through the git protocol at the moment
-QEMU_UPSTREAM_URL ?= git://xenbits.xen.org/people/sstabellini/qemu-dm.git
-QEMU_UPSTREAM_TAG ?= origin/xen-stable-0.15
-SEABIOS_UPSTREAM_URL=git://git.qemu.org/seabios.git
-SEABIOS_UPSTREAM_TAG ?= 7fc039e9c262b4199fab497f3e12f4e425c37560
-
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
@@ -210,6 +204,15 @@
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.
 
+# SeaBIOS integration is a work in progress. Before enabling this
+# option you must clone git://git.qemu.org/seabios.git/, possibly add
+# some development patches and then build it yourself before pointing
+# this variable to it (using an absolute path).
+#
+# Note that using SeaBIOS requires the use the upstream qemu as the
+# device model.
+SEABIOS_DIR ?= 
+
 # Optional components
 XENSTAT_XENTOP     ?= y
 VTPM_TOOLS         ?= n
diff -r 51913fe3d25a -r e90438f6e6d1 Makefile
--- a/Makefile	Tue Sep 13 15:46:47 2011 +0100
+++ b/Makefile	Wed Sep 14 11:38:13 2011 +0100
@@ -70,7 +70,7 @@
 	$(MAKE) -C tools install
 
 ifeq ($(CONFIG_IOEMU),y)
-install-tools: tools/qemu-xen-traditional-dir tools/qemu-xen-dir
+install-tools: tools/ioemu-dir
 endif
 
 .PHONY: install-kernels
@@ -78,21 +78,18 @@
 	for i in $(XKERNELS) ; do $(MAKE) $$i-install || exit 1; done
 
 .PHONY: install-stubdom
-install-stubdom: tools/qemu-xen-traditional-dir install-tools
+install-stubdom: tools/ioemu-dir install-tools
 	$(MAKE) -C stubdom install
 ifeq (x86_64,$(XEN_TARGET_ARCH))
 	XEN_TARGET_ARCH=x86_32 $(MAKE) -C stubdom install-grub
 endif
 
-tools/qemu-xen-traditional-dir:
-	$(MAKE) -C tools qemu-xen-traditional-dir-find
+tools/ioemu-dir:
+	$(MAKE) -C tools ioemu-dir-find
 
-.PHONY: tools/qemu-xen-traditional-dir-force-update
-tools/qemu-xen-traditional-dir-force-update:
-	$(MAKE) -C tools qemu-xen-traditional-dir-force-update
-
-tools/qemu-xen-dir:
-	$(MAKE) -C tools qemu-xen-dir-find
+.PHONY: tools/ioemu-dir-force-update
+tools/ioemu-dir-force-update:
+	$(MAKE) -C tools ioemu-dir-force-update
 
 .PHONY: install-docs
 install-docs:
diff -r 51913fe3d25a -r e90438f6e6d1 scripts/git-checkout.sh
--- a/scripts/git-checkout.sh	Tue Sep 13 15:46:47 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-#!/bin/sh
-
-TREE=$1
-TAG=$2
-DIR=$3
-
-
-if test -d $TREE; then
-	mkdir -p $DIR
-	ROOT=$TREE
-else
-	if test \! -d $DIR-remote; then
-		rm -rf $DIR-remote $DIR-remote.tmp;
-		mkdir $DIR-remote.tmp; rmdir $DIR-remote.tmp;
-		git clone $TREE $DIR-remote.tmp;
-		if test "$TAG" ; then
-			cd $DIR-remote.tmp
-			git branch -D dummy >/dev/null 2>&1 ||:
-			git checkout -b dummy $TAG
-			cd ..
-		fi
-		mv $DIR-remote.tmp $DIR-remote
-	fi
-	rm -f $DIR
-	ln -sf $DIR-remote $DIR
-	ROOT=.
-fi
-
-set -e
-cd $DIR
-# is this qemu-xen-traditional?
-if test -f $ROOT/xen-setup; then
-	QEMU_ROOT=$ROOT $ROOT/xen-setup $IOEMU_CONFIGURE_CROSS
-# is this qemu-xen?
-elif test -f $ROOT/configure; then
-	cd $ROOT
-	./configure --enable-xen --target-list=i386-softmmu \
-		--extra-cflags="-I$XEN_ROOT/tools/include \
-		-I$XEN_ROOT/tools/libxc \
-		-I$XEN_ROOT/tools/xenstore" \
-		--extra-ldflags="-L$XEN_ROOT/tools/libxc \
-		-L$XEN_ROOT/tools/libxenstore" \
-		--bindir=/usr/lib/xen/bin \
-		--disable-kvm \
-		$IOEMU_CONFIGURE_CROSS
-fi
-
diff -r 51913fe3d25a -r e90438f6e6d1 tools/Makefile
--- a/tools/Makefile	Tue Sep 13 15:46:47 2011 +0100
+++ b/tools/Makefile	Wed Sep 14 11:38:13 2011 +0100
@@ -30,8 +30,7 @@
 
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
-SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-traditional-dir
-SUBDIRS-$(CONFIG_IOEMU) += qemu-xen-dir
+SUBDIRS-$(CONFIG_IOEMU) += ioemu-dir
 endif
 
 SUBDIRS-y += xenpmd
@@ -71,8 +70,7 @@
 
 .PHONY: distclean
 distclean: subdirs-distclean
-	rm -rf qemu-xen-traditional-dir qemu-xen-traditional-dir-remote
-	rm -rf qemu-xen-dir qemu-xen-dir-remote
+	rm -rf ioemu-dir ioemu-remote
 
 ifneq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 IOEMU_CONFIGURE_CROSS ?= --cpu=$(XEN_TARGET_ARCH) \
@@ -80,35 +78,51 @@
 			 --interp-prefix=$(CROSS_SYS_ROOT)
 endif
 
-qemu-xen-traditional-dir-find:
-	$(XEN_ROOT)/scripts/git-checkout.sh $(CONFIG_QEMU) $(QEMU_TAG) qemu-xen-traditional-dir
-	
-qemu-xen-dir-find:
-	$(XEN_ROOT)/scripts/git-checkout.sh $(QEMU_UPSTREAM_URL) $(QEMU_UPSTREAM_TAG) qemu-xen-dir
-	
-.PHONY: qemu-xen-traditional-dir-force-update
-qemu-xen-traditional-dir-force-update:
+QEMU_ROOT := $(shell if [ -d "$(CONFIG_QEMU)" ]; then echo "$(CONFIG_QEMU)"; else echo .; fi)
+ifneq ($(QEMU_ROOT),.)
+export QEMU_ROOT
+endif
+
+ioemu-dir-find:
+	set -ex; \
+	if test -d $(CONFIG_QEMU); then \
+		mkdir -p ioemu-dir; \
+	else \
+		if [ ! -d ioemu-remote ]; then \
+			rm -rf ioemu-remote ioemu-remote.tmp; \
+			mkdir ioemu-remote.tmp; rmdir ioemu-remote.tmp; \
+			$(GIT) clone $(CONFIG_QEMU) ioemu-remote.tmp; \
+			if [ "$(QEMU_TAG)" ]; then			\
+				cd ioemu-remote.tmp;			\
+				$(GIT) branch -D dummy >/dev/null 2>&1 ||:; \
+				$(GIT) checkout -b dummy $(QEMU_TAG);	\
+				cd ..;					\
+			fi;						\
+			mv ioemu-remote.tmp ioemu-remote; \
+		fi; \
+		rm -f ioemu-dir; \
+		ln -sf ioemu-remote ioemu-dir; \
+	fi
+	set -e; \
+		$(buildmakevars2shellvars); \
+		cd ioemu-dir; \
+		$(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS)
+
+.PHONY: ioemu-dir-force-update
+ioemu-dir-force-update:
 	set -ex; \
 	if [ "$(QEMU_TAG)" ]; then \
-		cd qemu-xen-traditional-dir-remote; \
+		cd ioemu-remote; \
 		$(GIT) fetch origin; \
 		$(GIT) reset --hard $(QEMU_TAG); \
 	fi
 
-subdir-all-qemu-xen-traditional-dir subdir-install-qemu-xen-traditional-dir: qemu-xen-traditional-dir-find
+subdir-all-ioemu-dir subdir-install-ioemu-dir: ioemu-dir-find
 
-subdir-clean-qemu-xen-traditional-dir:
-	set -e; if test -d qemu-xen-traditional-dir/.; then \
+subdir-clean-ioemu-dir:
+	set -e; if test -d ioemu-dir/.; then \
 		$(buildmakevars2shellvars); \
-		$(MAKE) -C qemu-xen-traditional-dir clean; \
-	fi
-
-subdir-all-qemu-xen-dir subdir-install-qemu-xen-dir: qemu-xen-dir-find
-
-subdir-clean-qemu-xen-dir:
-	set -e; if test -d qemu-xen-dir/.; then \
-		$(buildmakevars2shellvars); \
-		$(MAKE) -C qemu-xen-dir clean; \
+		$(MAKE) -C ioemu-dir clean; \
 	fi
 
 subdir-clean-debugger/gdbsx subdir-distclean-debugger/gdbsx: .phony
diff -r 51913fe3d25a -r e90438f6e6d1 tools/firmware/Makefile
--- a/tools/firmware/Makefile	Tue Sep 13 15:46:47 2011 +0100
+++ b/tools/firmware/Makefile	Wed Sep 14 11:38:13 2011 +0100
@@ -6,18 +6,13 @@
 INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR)
 
 SUBDIRS :=
-SUBDIRS += seabios-dir
 SUBDIRS += rombios
 SUBDIRS += vgabios
 SUBDIRS += etherboot
 SUBDIRS += hvmloader
 
-seabios-dir:
-	$(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_TAG) seabios-dir
-	cp seabios-config seabios-dir/.config;
-
 .PHONY: all
-all: seabios-dir
+all:
 	@set -e; if [ $$((`( bcc -v 2>&1 | grep version || echo 0.0.0 ) | cut -d' ' -f 3 | awk -F. '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -lt $$((0x00100e)) ] ; then \
 	echo "==========================================================================="; \
 	echo "Require dev86 rpm or bin86 & bcc debs version >= 0.16.14 to build firmware!"; \
@@ -40,7 +35,4 @@
 distclean: subdirs-distclean
 
 subdir-distclean-etherboot: .phony
-	$(MAKE) -C etherboot distclean
-
-subdir-distclean-seabios-dir: .phony
-	rm -rf seabios-dir seabios-dir-remote
+	$(MAKE) -C etherboot distclean
\ No newline at end of file
diff -r 51913fe3d25a -r e90438f6e6d1 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Tue Sep 13 15:46:47 2011 +0100
+++ b/tools/firmware/hvmloader/Makefile	Wed Sep 14 11:38:13 2011 +0100
@@ -44,7 +44,6 @@
 ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
 endif
 
-SEABIOS_DIR := ../seabios-dir
 ifneq ($(SEABIOS_DIR),)
 OBJS += seabios.o
 CFLAGS += -DENABLE_SEABIOS
diff -r 51913fe3d25a -r e90438f6e6d1 tools/firmware/seabios-config
--- a/tools/firmware/seabios-config	Tue Sep 13 15:46:47 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# SeaBIOS Configuration
-# Wed Sep  7 13:03:21 2011
-#
-
-#
-# General Features
-#
-# CONFIG_COREBOOT is not set
-CONFIG_XEN=y
-CONFIG_THREADS=y
-# CONFIG_THREAD_OPTIONROMS is not set
-CONFIG_RELOCATE_INIT=y
-CONFIG_BOOTMENU=y
-# CONFIG_BOOTSPLASH is not set
-CONFIG_BOOTORDER=y
-
-#
-# Hardware support
-#
-CONFIG_ATA=y
-CONFIG_ATA_DMA=y
-CONFIG_ATA_PIO32=y
-CONFIG_AHCI=y
-CONFIG_VIRTIO_BLK=y
-CONFIG_FLOPPY=y
-CONFIG_PS2PORT=y
-CONFIG_USB=y
-CONFIG_USB_UHCI=y
-CONFIG_USB_OHCI=y
-CONFIG_USB_EHCI=y
-CONFIG_USB_MSC=y
-CONFIG_USB_HUB=y
-CONFIG_USB_KEYBOARD=y
-CONFIG_USB_MOUSE=y
-CONFIG_SERIAL=y
-CONFIG_LPT=y
-# CONFIG_USE_SMM is not set
-CONFIG_MTRR_INIT=y
-
-#
-# BIOS interfaces
-#
-CONFIG_DRIVES=y
-CONFIG_CDROM_BOOT=y
-CONFIG_CDROM_EMU=y
-CONFIG_PCIBIOS=y
-CONFIG_APMBIOS=y
-CONFIG_PNPBIOS=y
-CONFIG_OPTIONROMS=y
-# CONFIG_OPTIONROMS_DEPLOYED is not set
-CONFIG_PMM=y
-CONFIG_BOOT=y
-CONFIG_KEYBOARD=y
-CONFIG_KBD_CALL_INT15_4F=y
-CONFIG_MOUSE=y
-CONFIG_S3_RESUME=y
-# CONFIG_DISABLE_A20 is not set
-
-#
-# BIOS Tables
-#
-CONFIG_PIRTABLE=y
-CONFIG_MPTABLE=y
-CONFIG_SMBIOS=y
-CONFIG_ACPI=y
-
-#
-# Debugging
-#
-CONFIG_DEBUG_LEVEL=1
-# CONFIG_DEBUG_SERIAL is not set

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 15 05:11:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 15 Sep 2011 05:11:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4Amh-0004Sd-Ie; Thu, 15 Sep 2011 05:11:16 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4Ame-0004Rv-8s
	for xen-changelog@lists.xensource.com; Thu, 15 Sep 2011 05:11:12 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1316088654!54221409!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4720 invoked from network); 15 Sep 2011 12:10:54 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Sep 2011 12:10:54 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4Ama-00032p-UM
	for xen-changelog@lists.xensource.com; Thu, 15 Sep 2011 13:11:08 +0100
Message-Id: <E1R4Ama-00032p-UM@xenbits.xen.org>
Date: Thu, 15 Sep 2011 13:11:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: allow guest to shutdown
	all its watches/transactions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1316081285 -3600
# Node ID 42a45baf037dfc0d0ad09c29b0f6149304023802
# Parent  e90438f6e6d1585a71b18784a99c162b5d95f390
xenstored: allow guest to shutdown all its watches/transactions

During kexec all old watches have to be removed, otherwise the new
kernel will receive unexpected events. Allow a guest to reset itself
and cleanup all of its watches and transactions.

Add a new XS_RESET_WATCHES command to do the reset on behalf of the
guest.

(Changes by iwj: specify the argument to be a single nul byte.  Permit
read-only clients to use the new command.)

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r e90438f6e6d1 -r 42a45baf037d docs/misc/xenstore.txt
--- a/docs/misc/xenstore.txt	Wed Sep 14 11:38:13 2011 +0100
+++ b/docs/misc/xenstore.txt	Thu Sep 15 11:08:05 2011 +0100
@@ -217,6 +217,9 @@
 
 UNWATCH			<wpath>|<token>|?
 
+RESET_WATCHES		|
+	Reset all watches and transactions of the caller.
+
 ---------- Transactions ----------
 
 TRANSACTION_START	|			<transid>|
diff -r e90438f6e6d1 -r 42a45baf037d tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Wed Sep 14 11:38:13 2011 +0100
+++ b/tools/xenstore/xenstored_core.c	Thu Sep 15 11:08:05 2011 +0100
@@ -120,6 +120,7 @@
 	case XS_IS_DOMAIN_INTRODUCED: return "XS_IS_DOMAIN_INTRODUCED";
 	case XS_RESUME: return "RESUME";
 	case XS_SET_TARGET: return "SET_TARGET";
+	case XS_RESET_WATCHES: return "RESET_WATCHES";
 	default:
 		return "**UNKNOWN**";
 	}
@@ -1242,6 +1243,10 @@
 		do_set_target(conn, in);
 		break;
 
+	case XS_RESET_WATCHES:
+		do_reset_watches(conn);
+		break;
+
 	default:
 		eprintf("Client unknown operation %i", in->hdr.msg.type);
 		send_error(conn, ENOSYS);
diff -r e90438f6e6d1 -r 42a45baf037d tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c	Wed Sep 14 11:38:13 2011 +0100
+++ b/tools/xenstore/xenstored_domain.c	Thu Sep 15 11:08:05 2011 +0100
@@ -537,6 +537,15 @@
 	send_reply(conn, XS_IS_DOMAIN_INTRODUCED, result ? "T" : "F", 2);
 }
 
+/* Allow guest to reset all watches */
+void do_reset_watches(struct connection *conn)
+{
+	conn_delete_all_watches(conn);
+	conn_delete_all_transactions(conn);
+
+	send_ack(conn, XS_RESET_WATCHES);
+}
+
 static int close_xc_handle(void *_handle)
 {
 	xc_interface_close(*(xc_interface**)_handle);
diff -r e90438f6e6d1 -r 42a45baf037d tools/xenstore/xenstored_domain.h
--- a/tools/xenstore/xenstored_domain.h	Wed Sep 14 11:38:13 2011 +0100
+++ b/tools/xenstore/xenstored_domain.h	Thu Sep 15 11:08:05 2011 +0100
@@ -40,6 +40,9 @@
 /* domid */
 void do_get_domain_path(struct connection *conn, const char *domid_str);
 
+/* Allow guest to reset all watches */
+void do_reset_watches(struct connection *conn);
+
 void domain_init(void);
 
 /* Returns the implicit path of a connection (only domains have this) */
diff -r e90438f6e6d1 -r 42a45baf037d xen/include/public/io/xs_wire.h
--- a/xen/include/public/io/xs_wire.h	Wed Sep 14 11:38:13 2011 +0100
+++ b/xen/include/public/io/xs_wire.h	Thu Sep 15 11:08:05 2011 +0100
@@ -48,7 +48,8 @@
     XS_IS_DOMAIN_INTRODUCED,
     XS_RESUME,
     XS_SET_TARGET,
-    XS_RESTRICT
+    XS_RESTRICT,
+    XS_RESET_WATCHES
 };
 
 #define XS_WRITE_NONE "NONE"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 15 10:55:26 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 15 Sep 2011 10:55:26 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4G9m-0001g7-20; Thu, 15 Sep 2011 10:55:26 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4G9a-0001bG-EL
	for xen-changelog@lists.xensource.com; Thu, 15 Sep 2011 10:55:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1316109311!10844923!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4653 invoked from network); 15 Sep 2011 17:55:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Sep 2011 17:55:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4G9W-0005Tb-V1
	for xen-changelog@lists.xensource.com; Thu, 15 Sep 2011 18:55:11 +0100
Message-Id: <E1R4G9W-0005Tb-V1@xenbits.xen.org>
Date: Thu, 15 Sep 2011 18:55:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: Enable cpuid performance
	counter leaf for HVM
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1316096767 -3600
# Node ID 4815be3af73cd22d8225754ef5fff0ca03759ad7
# Parent  42a45baf037dfc0d0ad09c29b0f6149304023802
libxc: Enable cpuid performance counter leaf for HVM

In HVM domains the usable performance counters can be checked
automatically only, if cpuid leaf 0x0000000a is accessible.

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 42a45baf037d -r 4815be3af73c tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c	Thu Sep 15 11:08:05 2011 +0100
+++ b/tools/libxc/xc_cpuid_x86.c	Thu Sep 15 15:26:07 2011 +0100
@@ -392,6 +392,7 @@
 
     case 0x00000002: /* Intel cache info (dumped by AMD policy) */
     case 0x00000004: /* Intel cache info (dumped by AMD policy) */
+    case 0x0000000a: /* Architectural Performance Monitor Features */
     case 0x80000002: /* Processor name string */
     case 0x80000003: /* ... continued         */
     case 0x80000004: /* ... continued         */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 16 08:12:36 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 16 Sep 2011 08:12:36 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4a5i-0004y9-RR; Fri, 16 Sep 2011 08:12:34 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4Ztr-0003aD-Kd
	for xen-changelog@lists.xensource.com; Fri, 16 Sep 2011 08:00:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1316185216!13649113!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6320 invoked from network); 16 Sep 2011 15:00:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Sep 2011 15:00:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4Ztn-0008S2-GZ
	for xen-changelog@lists.xensource.com; Fri, 16 Sep 2011 16:00:15 +0100
Message-Id: <E1R4Ztn-0008S2-GZ@xenbits.xen.org>
Date: Fri, 16 Sep 2011 16:00:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mem_event: use different ringbuffers
	for share, paging and access
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1316171966 -3600
# Node ID 483c5f8319adafd61510d3a1ea085a7aec329a2d
# Parent  ed7586b1d515611e713b6ace72103e08d10a3347
mem_event: use different ringbuffers for share, paging and access

Up to now a single ring buffer was used for mem_share, xenpaging and
xen-access.  Each helper would have to cooperate and pull only its own
requests from the ring.  Unfortunately this was not implemented. And
even if it was, it would make the whole concept fragile because a crash
or early exit of one helper would stall the others.

What happend up to now is that active xenpaging + memory_sharing would
push memsharing requests in the buffer. xenpaging is not prepared for
such requests.

This patch creates an independet ring buffer for mem_share, xenpaging
and xen-access and adds also new functions to enable xenpaging and
xen-access. The xc_mem_event_enable/xc_mem_event_disable functions will
be removed. The various XEN_DOMCTL_MEM_EVENT_* macros were cleaned up.
Due to the removal the API changed, so the SONAME will be changed too.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r ed7586b1d515 -r 483c5f8319ad tools/libxc/Makefile
--- a/tools/libxc/Makefile	Fri Sep 16 12:13:31 2011 +0100
+++ b/tools/libxc/Makefile	Fri Sep 16 12:19:26 2011 +0100
@@ -1,7 +1,7 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-MAJOR    = 4.0
+MAJOR    = 4.2
 MINOR    = 0
 
 CTRL_SRCS-y       :=
diff -r ed7586b1d515 -r 483c5f8319ad tools/libxc/xc_mem_access.c
--- a/tools/libxc/xc_mem_access.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/tools/libxc/xc_mem_access.c	Fri Sep 16 12:19:26 2011 +0100
@@ -24,12 +24,29 @@
 #include "xc_private.h"
 
 
+int xc_mem_access_enable(xc_interface *xch, domid_t domain_id,
+                        void *shared_page, void *ring_page)
+{
+    return xc_mem_event_control(xch, domain_id,
+                                XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE,
+                                XEN_DOMCTL_MEM_EVENT_OP_ACCESS,
+                                shared_page, ring_page, INVALID_MFN);
+}
+
+int xc_mem_access_disable(xc_interface *xch, domid_t domain_id)
+{
+    return xc_mem_event_control(xch, domain_id,
+                                XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE,
+                                XEN_DOMCTL_MEM_EVENT_OP_ACCESS,
+                                NULL, NULL, INVALID_MFN);
+}
+
 int xc_mem_access_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME,
-                                XEN_DOMCTL_MEM_EVENT_OP_ACCESS, NULL, NULL,
-                                gfn);
+                                XEN_DOMCTL_MEM_EVENT_OP_ACCESS,
+                                NULL, NULL, gfn);
 }
 
 /*
diff -r ed7586b1d515 -r 483c5f8319ad tools/libxc/xc_mem_event.c
--- a/tools/libxc/xc_mem_event.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/tools/libxc/xc_mem_event.c	Fri Sep 16 12:19:26 2011 +0100
@@ -42,18 +42,3 @@
     return do_domctl(xch, &domctl);
 }
 
-int xc_mem_event_enable(xc_interface *xch, domid_t domain_id,
-                        void *shared_page, void *ring_page)
-{
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_ENABLE, 0,
-                                shared_page, ring_page, INVALID_MFN);
-}
-
-int xc_mem_event_disable(xc_interface *xch, domid_t domain_id)
-{
-    return xc_mem_event_control(xch, domain_id,
-                                XEN_DOMCTL_MEM_EVENT_OP_DISABLE, 0,
-                                NULL, NULL, INVALID_MFN);
-}
-
diff -r ed7586b1d515 -r 483c5f8319ad tools/libxc/xc_mem_paging.c
--- a/tools/libxc/xc_mem_paging.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/tools/libxc/xc_mem_paging.c	Fri Sep 16 12:19:26 2011 +0100
@@ -24,36 +24,53 @@
 #include "xc_private.h"
 
 
+int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id,
+                        void *shared_page, void *ring_page)
+{
+    return xc_mem_event_control(xch, domain_id,
+                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE,
+                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
+                                shared_page, ring_page, INVALID_MFN);
+}
+
+int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id)
+{
+    return xc_mem_event_control(xch, domain_id,
+                                XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE,
+                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
+                                NULL, NULL, INVALID_MFN);
+}
+
 int xc_mem_paging_nominate(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING, NULL, NULL,
-                                gfn);
+                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
+                                NULL, NULL, gfn);
 }
 
 int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING, NULL, NULL,
-                                gfn);
+                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
+                                NULL, NULL, gfn);
 }
 
 int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING, NULL, NULL,
-                                gfn);
+                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
+                                NULL, NULL, gfn);
 }
 
 int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id, unsigned long gfn)
 {
     return xc_mem_event_control(xch, domain_id,
                                 XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME,
-                                XEN_DOMCTL_MEM_EVENT_OP_PAGING, NULL, NULL,
-                                gfn);
+                                XEN_DOMCTL_MEM_EVENT_OP_PAGING,
+                                NULL, NULL, gfn);
 }
 
 
diff -r ed7586b1d515 -r 483c5f8319ad tools/libxc/xc_memshr.c
--- a/tools/libxc/xc_memshr.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/tools/libxc/xc_memshr.c	Fri Sep 16 12:19:26 2011 +0100
@@ -36,7 +36,7 @@
     domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
     domctl.domain = (domid_t)domid;
     op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_SHARING_OP_CONTROL;
+    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL;
     op->u.enable = enable;
 
     return do_domctl(xch, &domctl);
@@ -55,7 +55,7 @@
     domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
     domctl.domain = (domid_t)domid;
     op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GFN;
+    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN;
     op->u.nominate.u.gfn = gfn;
 
     ret = do_domctl(xch, &domctl);
@@ -77,7 +77,7 @@
     domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
     domctl.domain = (domid_t)domid;
     op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GREF;
+    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF;
     op->u.nominate.u.grant_ref = gref;
 
     ret = do_domctl(xch, &domctl);
@@ -97,7 +97,7 @@
     domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
     domctl.domain = 0;
     op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_SHARING_OP_SHARE;
+    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE;
     op->u.share.source_handle = source_handle;
     op->u.share.client_handle = client_handle;
 
@@ -114,7 +114,7 @@
     domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
     domctl.domain = (domid_t)domid;
     op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_SHARING_OP_RESUME;
+    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME;
 
     return do_domctl(xch, &domctl);
 }
@@ -130,7 +130,7 @@
     domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
     domctl.domain = (domid_t)domid;
     op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GFN;
+    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN;
     op->u.debug.u.gfn = gfn;
 
     return do_domctl(xch, &domctl);
@@ -147,7 +147,7 @@
     domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
     domctl.domain = (domid_t)domid;
     op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_SHARING_OP_DEBUG_MFN;
+    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN;
     op->u.debug.u.mfn = mfn;
 
     return do_domctl(xch, &domctl);
@@ -164,7 +164,7 @@
     domctl.interface_version = XEN_DOMCTL_INTERFACE_VERSION;
     domctl.domain = (domid_t)domid;
     op = &(domctl.u.mem_sharing_op);
-    op->op = XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GREF;
+    op->op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF;
     op->u.debug.u.gref = gref;
 
     return do_domctl(xch, &domctl);
diff -r ed7586b1d515 -r 483c5f8319ad tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Fri Sep 16 12:13:31 2011 +0100
+++ b/tools/libxc/xenctrl.h	Fri Sep 16 12:19:26 2011 +0100
@@ -1758,16 +1758,19 @@
                          unsigned int mode, void *shared_page,
                           void *ring_page, unsigned long gfn);
 
-int xc_mem_event_enable(xc_interface *xch, domid_t domain_id,
+int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id,
                         void *shared_page, void *ring_page);
-int xc_mem_event_disable(xc_interface *xch, domid_t domain_id);
-
+int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id);
 int xc_mem_paging_nominate(xc_interface *xch, domid_t domain_id,
                            unsigned long gfn);
 int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long gfn);
 int xc_mem_paging_prep(xc_interface *xch, domid_t domain_id, unsigned long gfn);
 int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id,
                          unsigned long gfn);
+
+int xc_mem_access_enable(xc_interface *xch, domid_t domain_id,
+                        void *shared_page, void *ring_page);
+int xc_mem_access_disable(xc_interface *xch, domid_t domain_id);
 int xc_mem_access_resume(xc_interface *xch, domid_t domain_id,
                          unsigned long gfn);
 
diff -r ed7586b1d515 -r 483c5f8319ad tools/tests/xen-access/xen-access.c
--- a/tools/tests/xen-access/xen-access.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/tools/tests/xen-access/xen-access.c	Fri Sep 16 12:19:26 2011 +0100
@@ -241,7 +241,7 @@
     mem_event_ring_lock_init(&xenaccess->mem_event);
 
     /* Initialise Xen */
-    rc = xc_mem_event_enable(xenaccess->xc_handle, xenaccess->mem_event.domain_id,
+    rc = xc_mem_access_enable(xenaccess->xc_handle, xenaccess->mem_event.domain_id,
                              xenaccess->mem_event.shared_page,
                              xenaccess->mem_event.ring_page);
     if ( rc != 0 )
@@ -351,7 +351,7 @@
         return 0;
 
     /* Tear down domain xenaccess in Xen */
-    rc = xc_mem_event_disable(xenaccess->xc_handle, xenaccess->mem_event.domain_id);
+    rc = xc_mem_access_disable(xenaccess->xc_handle, xenaccess->mem_event.domain_id);
     if ( rc != 0 )
     {
         ERROR("Error tearing down domain xenaccess in xen");
diff -r ed7586b1d515 -r 483c5f8319ad tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/tools/xenpaging/xenpaging.c	Fri Sep 16 12:19:26 2011 +0100
@@ -234,7 +234,7 @@
                    PAGE_SIZE);
     
     /* Initialise Xen */
-    rc = xc_mem_event_enable(xch, paging->mem_event.domain_id,
+    rc = xc_mem_paging_enable(xch, paging->mem_event.domain_id,
                              paging->mem_event.shared_page,
                              paging->mem_event.ring_page);
     if ( rc != 0 )
@@ -353,7 +353,7 @@
     xch = paging->xc_handle;
     paging->xc_handle = NULL;
     /* Tear down domain paging in Xen */
-    rc = xc_mem_event_disable(xch, paging->mem_event.domain_id);
+    rc = xc_mem_paging_disable(xch, paging->mem_event.domain_id);
     if ( rc != 0 )
     {
         ERROR("Error tearing down domain paging in xen");
diff -r ed7586b1d515 -r 483c5f8319ad xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/xen/arch/ia64/xen/dom0_ops.c	Fri Sep 16 12:19:26 2011 +0100
@@ -688,7 +688,7 @@
 
         switch(mec->op)
         {
-            case XEN_DOMCTL_MEM_SHARING_OP_CONTROL:
+            case XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL:
             {
                 if (mec->u.enable) {
                     ret = -EINVAL; /* not implemented */
diff -r ed7586b1d515 -r 483c5f8319ad xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Fri Sep 16 12:19:26 2011 +0100
@@ -4025,7 +4025,7 @@
     if ( (p & HVMPME_onchangeonly) && (value == old) )
         return 1;
     
-    rc = mem_event_check_ring(d, &d->mem_event);
+    rc = mem_event_check_ring(d, &d->mem_access);
     if ( rc )
         return rc;
     
@@ -4048,7 +4048,7 @@
         req.gla_valid = 1;
     }
     
-    mem_event_put_request(d, &d->mem_event, &req);
+    mem_event_put_request(d, &d->mem_access, &req);
     
     return 1;
 }
diff -r ed7586b1d515 -r 483c5f8319ad xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/xen/arch/x86/mm/mem_event.c	Fri Sep 16 12:19:26 2011 +0100
@@ -37,24 +37,52 @@
 #define mem_event_ring_lock(_med)       spin_lock(&(_med)->ring_lock)
 #define mem_event_ring_unlock(_med)     spin_unlock(&(_med)->ring_lock)
 
-static int mem_event_enable(struct domain *d, struct mem_event_domain *med, mfn_t ring_mfn, mfn_t shared_mfn)
+static int mem_event_enable(struct domain *d,
+                            xen_domctl_mem_event_op_t *mec,
+                            struct mem_event_domain *med)
 {
     int rc;
+    struct domain *dom_mem_event = current->domain;
+    struct vcpu *v = current;
+    unsigned long ring_addr = mec->ring_addr;
+    unsigned long shared_addr = mec->shared_addr;
+    l1_pgentry_t l1e;
+    unsigned long gfn;
+    p2m_type_t p2mt;
+    mfn_t ring_mfn;
+    mfn_t shared_mfn;
+
+    /* Only one helper at a time. If the helper crashed,
+     * the ring is in an undefined state and so is the guest.
+     */
+    if ( med->ring_page )
+        return -EBUSY;
+
+    /* Get MFN of ring page */
+    guest_get_eff_l1e(v, ring_addr, &l1e);
+    gfn = l1e_get_pfn(l1e);
+    ring_mfn = gfn_to_mfn(dom_mem_event, gfn, &p2mt);
+
+    if ( unlikely(!mfn_valid(mfn_x(ring_mfn))) )
+        return -EINVAL;
+
+    /* Get MFN of shared page */
+    guest_get_eff_l1e(v, shared_addr, &l1e);
+    gfn = l1e_get_pfn(l1e);
+    shared_mfn = gfn_to_mfn(dom_mem_event, gfn, &p2mt);
+
+    if ( unlikely(!mfn_valid(mfn_x(shared_mfn))) )
+        return -EINVAL;
 
     /* Map ring and shared pages */
     med->ring_page = map_domain_page(mfn_x(ring_mfn));
-    if ( med->ring_page == NULL )
-        goto err;
-
     med->shared_page = map_domain_page(mfn_x(shared_mfn));
-    if ( med->shared_page == NULL )
-        goto err_ring;
 
     /* Allocate event channel */
     rc = alloc_unbound_xen_event_channel(d->vcpu[0],
                                          current->domain->domain_id);
     if ( rc < 0 )
-        goto err_shared;
+        goto err;
 
     ((mem_event_shared_page_t *)med->shared_page)->port = rc;
     med->xen_port = rc;
@@ -71,14 +99,14 @@
 
     return 0;
 
- err_shared:
+ err:
     unmap_domain_page(med->shared_page);
     med->shared_page = NULL;
- err_ring:
+
     unmap_domain_page(med->ring_page);
     med->ring_page = NULL;
- err:
-    return 1;
+
+    return rc;
 }
 
 static int mem_event_disable(struct mem_event_domain *med)
@@ -220,86 +248,79 @@
 
     rc = -ENOSYS;
 
-    switch ( mec-> mode ) 
+    switch ( mec->mode )
     {
-    case 0:
+    case XEN_DOMCTL_MEM_EVENT_OP_PAGING:
     {
+        struct mem_event_domain *med = &d->mem_paging;
+        rc = -ENODEV;
+        /* Only HAP is supported */
+        if ( !hap_enabled(d) )
+            break;
+
+        /* Currently only EPT is supported */
+        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
+            break;
+
         switch( mec->op )
         {
-        case XEN_DOMCTL_MEM_EVENT_OP_ENABLE:
+        case XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE:
         {
-            struct domain *dom_mem_event = current->domain;
-            struct vcpu *v = current;
-            struct mem_event_domain *med = &d->mem_event;
-            unsigned long ring_addr = mec->ring_addr;
-            unsigned long shared_addr = mec->shared_addr;
-            l1_pgentry_t l1e;
-            unsigned long gfn;
-            p2m_type_t p2mt;
-            mfn_t ring_mfn;
-            mfn_t shared_mfn;
-
-            /* Only one xenpaging at a time. If xenpaging crashed,
-             * the cache is in an undefined state and so is the guest
-             */
-            rc = -EBUSY;
-            if ( med->ring_page )
-                break;
-
-            /* Currently only EPT is supported */
-            rc = -ENODEV;
-            if ( !(hap_enabled(d) &&
-                  (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) )
-                break;
-
-            /* Get MFN of ring page */
-            guest_get_eff_l1e(v, ring_addr, &l1e);
-            gfn = l1e_get_pfn(l1e);
-            ring_mfn = gfn_to_mfn(dom_mem_event, gfn, &p2mt);
-
-            rc = -EINVAL;
-            if ( unlikely(!mfn_valid(mfn_x(ring_mfn))) )
-                break;
-
-            /* Get MFN of shared page */
-            guest_get_eff_l1e(v, shared_addr, &l1e);
-            gfn = l1e_get_pfn(l1e);
-            shared_mfn = gfn_to_mfn(dom_mem_event, gfn, &p2mt);
-
-            rc = -EINVAL;
-            if ( unlikely(!mfn_valid(mfn_x(shared_mfn))) )
-                break;
-
-            rc = -EINVAL;
-            if ( mem_event_enable(d, med, ring_mfn, shared_mfn) != 0 )
-                break;
-
-            rc = 0;
+            rc = mem_event_enable(d, mec, med);
         }
         break;
 
-        case XEN_DOMCTL_MEM_EVENT_OP_DISABLE:
+        case XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE:
         {
-            rc = mem_event_disable(&d->mem_event);
+            rc = mem_event_disable(med);
         }
         break;
 
         default:
-            rc = -ENOSYS;
-            break;
+        {
+            if ( med->ring_page )
+                rc = mem_paging_domctl(d, mec, u_domctl);
         }
         break;
+        }
     }
-    case XEN_DOMCTL_MEM_EVENT_OP_PAGING:
-    {
-        rc = mem_paging_domctl(d, mec, u_domctl);
-        break;
-    }
+    break;
+
     case XEN_DOMCTL_MEM_EVENT_OP_ACCESS: 
     {
-        rc = mem_access_domctl(d, mec, u_domctl);
+        struct mem_event_domain *med = &d->mem_access;
+        rc = -ENODEV;
+        /* Only HAP is supported */
+        if ( !hap_enabled(d) )
+            break;
+
+        /* Currently only EPT is supported */
+        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
+            break;
+
+        switch( mec->op )
+        {
+        case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE:
+        {
+            rc = mem_event_enable(d, mec, med);
+        }
         break;
+
+        case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE:
+        {
+            rc = mem_event_disable(&d->mem_access);
+        }
+        break;
+
+        default:
+        {
+            if ( med->ring_page )
+                rc = mem_access_domctl(d, mec, u_domctl);
+        }
+        break;
+        }
     }
+    break;
     }
 
     return rc;
diff -r ed7586b1d515 -r 483c5f8319ad xen/arch/x86/mm/mem_paging.c
--- a/xen/arch/x86/mm/mem_paging.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/xen/arch/x86/mm/mem_paging.c	Fri Sep 16 12:19:26 2011 +0100
@@ -28,10 +28,6 @@
 int mem_paging_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
                       XEN_GUEST_HANDLE(void) u_domctl)
 {
-    /* Only HAP is supported */
-    if ( !hap_enabled(d) )
-         return -ENODEV;
-
     switch( mec->op )
     {
     case XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE:
diff -r ed7586b1d515 -r 483c5f8319ad xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/xen/arch/x86/mm/mem_sharing.c	Fri Sep 16 12:19:26 2011 +0100
@@ -281,12 +281,12 @@
     vcpu_pause_nosync(v);
     req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
 
-    if(mem_event_check_ring(d, &d->mem_event)) return page;
+    if(mem_event_check_ring(d, &d->mem_share)) return page;
 
     req.gfn = gfn;
     req.p2mt = p2m_ram_shared;
     req.vcpu_id = v->vcpu_id;
-    mem_event_put_request(d, &d->mem_event, &req);
+    mem_event_put_request(d, &d->mem_share, &req);
 
     return page;
 }
@@ -301,7 +301,7 @@
     mem_event_response_t rsp;
 
     /* Get request off the ring */
-    mem_event_get_response(&d->mem_event, &rsp);
+    mem_event_get_response(&d->mem_share, &rsp);
 
     /* Unpause domain/vcpu */
     if( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
@@ -697,14 +697,14 @@
 
     switch(mec->op)
     {
-        case XEN_DOMCTL_MEM_SHARING_OP_CONTROL:
+        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL:
         {
             d->arch.hvm_domain.mem_sharing_enabled = mec->u.enable;
             rc = 0;
         }
         break;
 
-        case XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GFN:
+        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN:
         {
             unsigned long gfn = mec->u.nominate.u.gfn;
             shr_handle_t handle;
@@ -715,7 +715,7 @@
         }
         break;
 
-        case XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GREF:
+        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF:
         {
             grant_ref_t gref = mec->u.nominate.u.grant_ref;
             unsigned long gfn;
@@ -730,7 +730,7 @@
         }
         break;
 
-        case XEN_DOMCTL_MEM_SHARING_OP_SHARE:
+        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE:
         {
             shr_handle_t sh = mec->u.share.source_handle;
             shr_handle_t ch = mec->u.share.client_handle;
@@ -738,7 +738,7 @@
         }
         break;
 
-        case XEN_DOMCTL_MEM_SHARING_OP_RESUME:
+        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME:
         {
             if(!mem_sharing_enabled(d))
                 return -EINVAL;
@@ -746,21 +746,21 @@
         }
         break;
 
-        case XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GFN:
+        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN:
         {
             unsigned long gfn = mec->u.debug.u.gfn;
             rc = mem_sharing_debug_gfn(d, gfn);
         }
         break;
 
-        case XEN_DOMCTL_MEM_SHARING_OP_DEBUG_MFN:
+        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN:
         {
             unsigned long mfn = mec->u.debug.u.mfn;
             rc = mem_sharing_debug_mfn(mfn);
         }
         break;
 
-        case XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GREF:
+        case XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF:
         {
             grant_ref_t gref = mec->u.debug.u.gref;
             rc = mem_sharing_debug_gref(d, gref);
diff -r ed7586b1d515 -r 483c5f8319ad xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Sep 16 12:13:31 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Fri Sep 16 12:19:26 2011 +0100
@@ -755,7 +755,7 @@
     mem_event_request_t req;
 
     /* Check that there's space on the ring for this request */
-    if ( mem_event_check_ring(d, &d->mem_event) == 0)
+    if ( mem_event_check_ring(d, &d->mem_paging) == 0)
     {
         /* Send release notification to pager */
         memset(&req, 0, sizeof(req));
@@ -763,7 +763,7 @@
         req.gfn = gfn;
         req.vcpu_id = v->vcpu_id;
 
-        mem_event_put_request(d, &d->mem_event, &req);
+        mem_event_put_request(d, &d->mem_paging, &req);
     }
 }
 
@@ -775,7 +775,7 @@
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
     /* Check that there's space on the ring for this request */
-    if ( mem_event_check_ring(d, &d->mem_event) )
+    if ( mem_event_check_ring(d, &d->mem_paging) )
         return;
 
     memset(&req, 0, sizeof(req));
@@ -803,7 +803,7 @@
     else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
     {
         /* gfn is already on its way back and vcpu is not paused */
-        mem_event_put_req_producers(&d->mem_event);
+        mem_event_put_req_producers(&d->mem_paging);
         return;
     }
 
@@ -812,7 +812,7 @@
     req.p2mt = p2mt;
     req.vcpu_id = v->vcpu_id;
 
-    mem_event_put_request(d, &d->mem_event, &req);
+    mem_event_put_request(d, &d->mem_paging, &req);
 }
 
 int p2m_mem_paging_prep(struct domain *d, unsigned long gfn)
@@ -842,7 +842,7 @@
     mfn_t mfn;
 
     /* Pull the response off the ring */
-    mem_event_get_response(&d->mem_event, &rsp);
+    mem_event_get_response(&d->mem_paging, &rsp);
 
     /* Fix p2m entry if the page was not dropped */
     if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
@@ -889,7 +889,7 @@
     p2m_unlock(p2m);
 
     /* Otherwise, check if there is a memory event listener, and send the message along */
-    res = mem_event_check_ring(d, &d->mem_event);
+    res = mem_event_check_ring(d, &d->mem_access);
     if ( res < 0 ) 
     {
         /* No listener */
@@ -933,7 +933,7 @@
     
     req.vcpu_id = v->vcpu_id;
 
-    mem_event_put_request(d, &d->mem_event, &req);
+    mem_event_put_request(d, &d->mem_access, &req);
 
     /* VCPU paused, mem event request sent */
 }
@@ -943,7 +943,7 @@
     struct domain *d = p2m->domain;
     mem_event_response_t rsp;
 
-    mem_event_get_response(&d->mem_event, &rsp);
+    mem_event_get_response(&d->mem_access, &rsp);
 
     /* Unpause domain */
     if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
diff -r ed7586b1d515 -r 483c5f8319ad xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Fri Sep 16 12:13:31 2011 +0100
+++ b/xen/include/public/domctl.h	Fri Sep 16 12:19:26 2011 +0100
@@ -708,20 +708,18 @@
 
 /* XEN_DOMCTL_mem_event_op */
 
-/* Add and remove memory handlers */
-#define XEN_DOMCTL_MEM_EVENT_OP_ENABLE     0
-#define XEN_DOMCTL_MEM_EVENT_OP_DISABLE    1
-
 /*
+* Domain memory paging
  * Page memory in and out. 
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING            1
 
-/* Domain memory paging */
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE   0
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT      1
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP       2
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME     3
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE     0
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE    1
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE   2
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT      3
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP       4
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME     5
 
 /*
  * Access permissions.
@@ -734,11 +732,14 @@
  * ACCESS_RESUME mode for the following domctl.
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_ACCESS            2
-#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME     0 
+
+#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE     0
+#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE    1
+#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME     2
 
 struct xen_domctl_mem_event_op {
-    uint32_t       op;           /* XEN_DOMCTL_MEM_EVENT_OP_* */
-    uint32_t       mode;         /* XEN_DOMCTL_MEM_EVENT_ENABLE_* */
+    uint32_t       op;           /* XEN_DOMCTL_MEM_EVENT_OP_*_* */
+    uint32_t       mode;         /* XEN_DOMCTL_MEM_EVENT_OP_* */
 
     /* OP_ENABLE */
     uint64_aligned_t shared_addr;  /* IN:  Virtual address of shared page */
@@ -755,14 +756,16 @@
  */
 /* XEN_DOMCTL_mem_sharing_op */
 
-#define XEN_DOMCTL_MEM_SHARING_OP_CONTROL        0
-#define XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GFN   1
-#define XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GREF  2
-#define XEN_DOMCTL_MEM_SHARING_OP_SHARE          3
-#define XEN_DOMCTL_MEM_SHARING_OP_RESUME         4
-#define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GFN      5
-#define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_MFN      6
-#define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GREF     7
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING                3
+
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL        0
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN   1
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF  2
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE          3
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME         4
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN      5
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN      6
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF     7
 
 #define XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID  (-10)
 #define XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID  (-9)
diff -r ed7586b1d515 -r 483c5f8319ad xen/include/xen/sched.h
--- a/xen/include/xen/sched.h	Fri Sep 16 12:13:31 2011 +0100
+++ b/xen/include/xen/sched.h	Fri Sep 16 12:19:26 2011 +0100
@@ -317,8 +317,12 @@
     /* Non-migratable and non-restoreable? */
     bool_t disable_migrate;
 
+    /* Memory sharing support */
+    struct mem_event_domain mem_share;
     /* Memory paging support */
-    struct mem_event_domain mem_event;
+    struct mem_event_domain mem_paging;
+    /* Memory access support */
+    struct mem_event_domain mem_access;
 
     /* Currently computed from union of all vcpu cpu-affinity masks. */
     nodemask_t node_affinity;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 16 08:12:50 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 16 Sep 2011 08:12:50 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4a5y-000518-2I; Fri, 16 Sep 2011 08:12:50 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4Ztq-0003aC-1P
	for xen-changelog@lists.xensource.com; Fri, 16 Sep 2011 08:00:23 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1316185214!28001858!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1035 invoked from network); 16 Sep 2011 15:00:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Sep 2011 15:00:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4Ztl-0008Rb-Ao
	for xen-changelog@lists.xensource.com; Fri, 16 Sep 2011 16:00:13 +0100
Message-Id: <E1R4Ztl-0008Rb-Ao@xenbits.xen.org>
Date: Fri, 16 Sep 2011 16:00:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mem_event: pass mem_event_domain
	pointer to mem_event functions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1316171611 -3600
# Node ID ed7586b1d515611e713b6ace72103e08d10a3347
# Parent  4815be3af73cd22d8225754ef5fff0ca03759ad7
mem_event: pass mem_event_domain pointer to mem_event functions

Pass a struct mem_event_domain pointer to the various mem_event
functions.  This will be used in a subsequent patch which creates
different ring buffers for the memshare, xenpaging and memaccess
functionality.

Remove the struct domain argument from some functions.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 4815be3af73c -r ed7586b1d515 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Thu Sep 15 15:26:07 2011 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Fri Sep 16 12:13:31 2011 +0100
@@ -4025,7 +4025,7 @@
     if ( (p & HVMPME_onchangeonly) && (value == old) )
         return 1;
     
-    rc = mem_event_check_ring(d);
+    rc = mem_event_check_ring(d, &d->mem_event);
     if ( rc )
         return rc;
     
@@ -4048,7 +4048,7 @@
         req.gla_valid = 1;
     }
     
-    mem_event_put_request(d, &req);      
+    mem_event_put_request(d, &d->mem_event, &req);
     
     return 1;
 }
diff -r 4815be3af73c -r ed7586b1d515 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Thu Sep 15 15:26:07 2011 +0100
+++ b/xen/arch/x86/mm/mem_event.c	Fri Sep 16 12:13:31 2011 +0100
@@ -33,21 +33,21 @@
 #define xen_rmb()  rmb()
 #define xen_wmb()  wmb()
 
-#define mem_event_ring_lock_init(_d)  spin_lock_init(&(_d)->mem_event.ring_lock)
-#define mem_event_ring_lock(_d)       spin_lock(&(_d)->mem_event.ring_lock)
-#define mem_event_ring_unlock(_d)     spin_unlock(&(_d)->mem_event.ring_lock)
+#define mem_event_ring_lock_init(_med)  spin_lock_init(&(_med)->ring_lock)
+#define mem_event_ring_lock(_med)       spin_lock(&(_med)->ring_lock)
+#define mem_event_ring_unlock(_med)     spin_unlock(&(_med)->ring_lock)
 
-static int mem_event_enable(struct domain *d, mfn_t ring_mfn, mfn_t shared_mfn)
+static int mem_event_enable(struct domain *d, struct mem_event_domain *med, mfn_t ring_mfn, mfn_t shared_mfn)
 {
     int rc;
 
     /* Map ring and shared pages */
-    d->mem_event.ring_page = map_domain_page(mfn_x(ring_mfn));
-    if ( d->mem_event.ring_page == NULL )
+    med->ring_page = map_domain_page(mfn_x(ring_mfn));
+    if ( med->ring_page == NULL )
         goto err;
 
-    d->mem_event.shared_page = map_domain_page(mfn_x(shared_mfn));
-    if ( d->mem_event.shared_page == NULL )
+    med->shared_page = map_domain_page(mfn_x(shared_mfn));
+    if ( med->shared_page == NULL )
         goto err_ring;
 
     /* Allocate event channel */
@@ -56,15 +56,15 @@
     if ( rc < 0 )
         goto err_shared;
 
-    ((mem_event_shared_page_t *)d->mem_event.shared_page)->port = rc;
-    d->mem_event.xen_port = rc;
+    ((mem_event_shared_page_t *)med->shared_page)->port = rc;
+    med->xen_port = rc;
 
     /* Prepare ring buffer */
-    FRONT_RING_INIT(&d->mem_event.front_ring,
-                    (mem_event_sring_t *)d->mem_event.ring_page,
+    FRONT_RING_INIT(&med->front_ring,
+                    (mem_event_sring_t *)med->ring_page,
                     PAGE_SIZE);
 
-    mem_event_ring_lock_init(d);
+    mem_event_ring_lock_init(med);
 
     /* Wake any VCPUs paused for memory events */
     mem_event_unpause_vcpus(d);
@@ -72,34 +72,34 @@
     return 0;
 
  err_shared:
-    unmap_domain_page(d->mem_event.shared_page);
-    d->mem_event.shared_page = NULL;
+    unmap_domain_page(med->shared_page);
+    med->shared_page = NULL;
  err_ring:
-    unmap_domain_page(d->mem_event.ring_page);
-    d->mem_event.ring_page = NULL;
+    unmap_domain_page(med->ring_page);
+    med->ring_page = NULL;
  err:
     return 1;
 }
 
-static int mem_event_disable(struct domain *d)
+static int mem_event_disable(struct mem_event_domain *med)
 {
-    unmap_domain_page(d->mem_event.ring_page);
-    d->mem_event.ring_page = NULL;
+    unmap_domain_page(med->ring_page);
+    med->ring_page = NULL;
 
-    unmap_domain_page(d->mem_event.shared_page);
-    d->mem_event.shared_page = NULL;
+    unmap_domain_page(med->shared_page);
+    med->shared_page = NULL;
 
     return 0;
 }
 
-void mem_event_put_request(struct domain *d, mem_event_request_t *req)
+void mem_event_put_request(struct domain *d, struct mem_event_domain *med, mem_event_request_t *req)
 {
     mem_event_front_ring_t *front_ring;
     RING_IDX req_prod;
 
-    mem_event_ring_lock(d);
+    mem_event_ring_lock(med);
 
-    front_ring = &d->mem_event.front_ring;
+    front_ring = &med->front_ring;
     req_prod = front_ring->req_prod_pvt;
 
     /* Copy request */
@@ -107,23 +107,23 @@
     req_prod++;
 
     /* Update ring */
-    d->mem_event.req_producers--;
+    med->req_producers--;
     front_ring->req_prod_pvt = req_prod;
     RING_PUSH_REQUESTS(front_ring);
 
-    mem_event_ring_unlock(d);
+    mem_event_ring_unlock(med);
 
-    notify_via_xen_event_channel(d, d->mem_event.xen_port);
+    notify_via_xen_event_channel(d, med->xen_port);
 }
 
-void mem_event_get_response(struct domain *d, mem_event_response_t *rsp)
+void mem_event_get_response(struct mem_event_domain *med, mem_event_response_t *rsp)
 {
     mem_event_front_ring_t *front_ring;
     RING_IDX rsp_cons;
 
-    mem_event_ring_lock(d);
+    mem_event_ring_lock(med);
 
-    front_ring = &d->mem_event.front_ring;
+    front_ring = &med->front_ring;
     rsp_cons = front_ring->rsp_cons;
 
     /* Copy response */
@@ -134,7 +134,7 @@
     front_ring->rsp_cons = rsp_cons;
     front_ring->sring->rsp_event = rsp_cons + 1;
 
-    mem_event_ring_unlock(d);
+    mem_event_ring_unlock(med);
 }
 
 void mem_event_unpause_vcpus(struct domain *d)
@@ -152,35 +152,35 @@
     vcpu_sleep_nosync(v);
 }
 
-void mem_event_put_req_producers(struct domain *d)
+void mem_event_put_req_producers(struct mem_event_domain *med)
 {
-    mem_event_ring_lock(d);
-    d->mem_event.req_producers--;
-    mem_event_ring_unlock(d);
+    mem_event_ring_lock(med);
+    med->req_producers--;
+    mem_event_ring_unlock(med);
 }
 
-int mem_event_check_ring(struct domain *d)
+int mem_event_check_ring(struct domain *d, struct mem_event_domain *med)
 {
     struct vcpu *curr = current;
     int free_requests;
     int ring_full = 1;
 
-    if ( !d->mem_event.ring_page )
+    if ( !med->ring_page )
         return -1;
 
-    mem_event_ring_lock(d);
+    mem_event_ring_lock(med);
 
-    free_requests = RING_FREE_REQUESTS(&d->mem_event.front_ring);
-    if ( d->mem_event.req_producers < free_requests )
+    free_requests = RING_FREE_REQUESTS(&med->front_ring);
+    if ( med->req_producers < free_requests )
     {
-        d->mem_event.req_producers++;
+        med->req_producers++;
         ring_full = 0;
     }
 
-    if ( (curr->domain->domain_id == d->domain_id) && ring_full )
+    if ( ring_full && (curr->domain == d) )
         mem_event_mark_and_pause(curr);
 
-    mem_event_ring_unlock(d);
+    mem_event_ring_unlock(med);
 
     return ring_full;
 }
@@ -230,6 +230,7 @@
         {
             struct domain *dom_mem_event = current->domain;
             struct vcpu *v = current;
+            struct mem_event_domain *med = &d->mem_event;
             unsigned long ring_addr = mec->ring_addr;
             unsigned long shared_addr = mec->shared_addr;
             l1_pgentry_t l1e;
@@ -242,7 +243,7 @@
              * the cache is in an undefined state and so is the guest
              */
             rc = -EBUSY;
-            if ( d->mem_event.ring_page )
+            if ( med->ring_page )
                 break;
 
             /* Currently only EPT is supported */
@@ -270,7 +271,7 @@
                 break;
 
             rc = -EINVAL;
-            if ( mem_event_enable(d, ring_mfn, shared_mfn) != 0 )
+            if ( mem_event_enable(d, med, ring_mfn, shared_mfn) != 0 )
                 break;
 
             rc = 0;
@@ -279,7 +280,7 @@
 
         case XEN_DOMCTL_MEM_EVENT_OP_DISABLE:
         {
-            rc = mem_event_disable(d);
+            rc = mem_event_disable(&d->mem_event);
         }
         break;
 
diff -r 4815be3af73c -r ed7586b1d515 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Thu Sep 15 15:26:07 2011 +0100
+++ b/xen/arch/x86/mm/mem_sharing.c	Fri Sep 16 12:13:31 2011 +0100
@@ -281,12 +281,12 @@
     vcpu_pause_nosync(v);
     req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
 
-    if(mem_event_check_ring(d)) return page;
+    if(mem_event_check_ring(d, &d->mem_event)) return page;
 
     req.gfn = gfn;
     req.p2mt = p2m_ram_shared;
     req.vcpu_id = v->vcpu_id;
-    mem_event_put_request(d, &req);
+    mem_event_put_request(d, &d->mem_event, &req);
 
     return page;
 }
@@ -301,7 +301,7 @@
     mem_event_response_t rsp;
 
     /* Get request off the ring */
-    mem_event_get_response(d, &rsp);
+    mem_event_get_response(&d->mem_event, &rsp);
 
     /* Unpause domain/vcpu */
     if( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
diff -r 4815be3af73c -r ed7586b1d515 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Sep 15 15:26:07 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Fri Sep 16 12:13:31 2011 +0100
@@ -755,7 +755,7 @@
     mem_event_request_t req;
 
     /* Check that there's space on the ring for this request */
-    if ( mem_event_check_ring(d) == 0)
+    if ( mem_event_check_ring(d, &d->mem_event) == 0)
     {
         /* Send release notification to pager */
         memset(&req, 0, sizeof(req));
@@ -763,7 +763,7 @@
         req.gfn = gfn;
         req.vcpu_id = v->vcpu_id;
 
-        mem_event_put_request(d, &req);
+        mem_event_put_request(d, &d->mem_event, &req);
     }
 }
 
@@ -775,7 +775,7 @@
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
     /* Check that there's space on the ring for this request */
-    if ( mem_event_check_ring(d) )
+    if ( mem_event_check_ring(d, &d->mem_event) )
         return;
 
     memset(&req, 0, sizeof(req));
@@ -803,7 +803,7 @@
     else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
     {
         /* gfn is already on its way back and vcpu is not paused */
-        mem_event_put_req_producers(d);
+        mem_event_put_req_producers(&d->mem_event);
         return;
     }
 
@@ -812,7 +812,7 @@
     req.p2mt = p2mt;
     req.vcpu_id = v->vcpu_id;
 
-    mem_event_put_request(d, &req);
+    mem_event_put_request(d, &d->mem_event, &req);
 }
 
 int p2m_mem_paging_prep(struct domain *d, unsigned long gfn)
@@ -842,7 +842,7 @@
     mfn_t mfn;
 
     /* Pull the response off the ring */
-    mem_event_get_response(d, &rsp);
+    mem_event_get_response(&d->mem_event, &rsp);
 
     /* Fix p2m entry if the page was not dropped */
     if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
@@ -889,7 +889,7 @@
     p2m_unlock(p2m);
 
     /* Otherwise, check if there is a memory event listener, and send the message along */
-    res = mem_event_check_ring(d);
+    res = mem_event_check_ring(d, &d->mem_event);
     if ( res < 0 ) 
     {
         /* No listener */
@@ -933,7 +933,7 @@
     
     req.vcpu_id = v->vcpu_id;
 
-    mem_event_put_request(d, &req);   
+    mem_event_put_request(d, &d->mem_event, &req);
 
     /* VCPU paused, mem event request sent */
 }
@@ -943,7 +943,7 @@
     struct domain *d = p2m->domain;
     mem_event_response_t rsp;
 
-    mem_event_get_response(d, &rsp);
+    mem_event_get_response(&d->mem_event, &rsp);
 
     /* Unpause domain */
     if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
diff -r 4815be3af73c -r ed7586b1d515 xen/include/asm-x86/mem_event.h
--- a/xen/include/asm-x86/mem_event.h	Thu Sep 15 15:26:07 2011 +0100
+++ b/xen/include/asm-x86/mem_event.h	Fri Sep 16 12:13:31 2011 +0100
@@ -26,10 +26,10 @@
 
 /* Pauses VCPU while marking pause flag for mem event */
 void mem_event_mark_and_pause(struct vcpu *v);
-int mem_event_check_ring(struct domain *d);
-void mem_event_put_req_producers(struct domain *d);
-void mem_event_put_request(struct domain *d, mem_event_request_t *req);
-void mem_event_get_response(struct domain *d, mem_event_response_t *rsp);
+int mem_event_check_ring(struct domain *d, struct mem_event_domain *med);
+void mem_event_put_req_producers(struct mem_event_domain *med);
+void mem_event_put_request(struct domain *d, struct mem_event_domain *med, mem_event_request_t *req);
+void mem_event_get_response(struct mem_event_domain *med, mem_event_response_t *rsp);
 void mem_event_unpause_vcpus(struct domain *d);
 
 int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 08:33:13 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 08:33:13 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4wtF-0003Dr-F3; Sat, 17 Sep 2011 08:33:13 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4wtB-0003C8-6p
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 08:33:09 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1316273585!31757985!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17284 invoked from network); 17 Sep 2011 15:33:06 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 15:33:06 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4wt7-0007qU-Ck
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 16:33:05 +0100
Message-Id: <E1R4wt7-0007qU-Ck@xenbits.xen.org>
Date: Sat, 17 Sep 2011 16:33:04 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] xen/backends: use kzalloc() in
	favor of kmalloc()+memset()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@novell.com>
# Date 1316273342 -3600
# Node ID f4f25124b1b6d926b6e19a499bf4a3fdc97f0157
# Parent  700f70b60d4b50e04228e54bf636ec882bf54968
xen/backends: use kzalloc() in favor of kmalloc()+memset()

This fixes the problem of three of those four memset()-s having
improper size arguments passed: Sizeof a pointer-typed expression
returns the size of the pointer, not that of the pointed to data.

Reported-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Jan Beulich <jbeulich@novell.com>
---


diff -r 700f70b60d4b -r f4f25124b1b6 drivers/xen/blkback/blkback.c
--- a/drivers/xen/blkback/blkback.c	Sat Aug 27 12:12:38 2011 +0100
+++ b/drivers/xen/blkback/blkback.c	Sat Sep 17 16:29:02 2011 +0100
@@ -633,7 +633,7 @@
 
 	mmap_pages = blkif_reqs * BLKIF_MAX_SEGMENTS_PER_REQUEST;
 
-	pending_reqs          = kmalloc(sizeof(pending_reqs[0]) *
+	pending_reqs          = kzalloc(sizeof(pending_reqs[0]) *
 					blkif_reqs, GFP_KERNEL);
 	pending_grant_handles = kmalloc(sizeof(pending_grant_handles[0]) *
 					mmap_pages, GFP_KERNEL);
@@ -650,7 +650,6 @@
 
 	blkif_interface_init();
 
-	memset(pending_reqs, 0, sizeof(pending_reqs));
 	INIT_LIST_HEAD(&pending_free);
 
 	for (i = 0; i < blkif_reqs; i++)
diff -r 700f70b60d4b -r f4f25124b1b6 drivers/xen/scsiback/emulate.c
--- a/drivers/xen/scsiback/emulate.c	Sat Aug 27 12:12:38 2011 +0100
+++ b/drivers/xen/scsiback/emulate.c	Sat Sep 17 16:29:02 2011 +0100
@@ -246,13 +246,11 @@
 	alloc_len  = sizeof(struct scsi_lun) * alloc_luns
 				+ VSCSI_REPORT_LUNS_HEADER;
 retry:
-	if ((buff = kmalloc(alloc_len, GFP_KERNEL)) == NULL) {
+	if ((buff = kzalloc(alloc_len, GFP_KERNEL)) == NULL) {
 		printk(KERN_ERR "scsiback:%s kmalloc err\n", __FUNCTION__);
 		goto fail;
 	}
 
-	memset(buff, 0, alloc_len);
-
 	one_lun = (struct scsi_lun *) &buff[8];
 	spin_lock_irqsave(&info->v2p_lock, flags);
 	list_for_each_entry(entry, head, l) {
diff -r 700f70b60d4b -r f4f25124b1b6 drivers/xen/scsiback/scsiback.c
--- a/drivers/xen/scsiback/scsiback.c	Sat Aug 27 12:12:38 2011 +0100
+++ b/drivers/xen/scsiback/scsiback.c	Sat Sep 17 16:29:02 2011 +0100
@@ -687,7 +687,7 @@
 
 	mmap_pages = vscsiif_reqs * VSCSIIF_SG_TABLESIZE;
 
-	pending_reqs          = kmalloc(sizeof(pending_reqs[0]) *
+	pending_reqs          = kzalloc(sizeof(pending_reqs[0]) *
 					vscsiif_reqs, GFP_KERNEL);
 	pending_grant_handles = kmalloc(sizeof(pending_grant_handles[0]) *
 					mmap_pages, GFP_KERNEL);
@@ -702,7 +702,6 @@
 	if (scsiback_interface_init() < 0)
 		goto out_of_kmem;
 
-	memset(pending_reqs, 0, sizeof(pending_reqs));
 	INIT_LIST_HEAD(&pending_free);
 
 	for (i = 0; i < vscsiif_reqs; i++)
diff -r 700f70b60d4b -r f4f25124b1b6 drivers/xen/usbback/usbback.c
--- a/drivers/xen/usbback/usbback.c	Sat Aug 27 12:12:38 2011 +0100
+++ b/drivers/xen/usbback/usbback.c	Sat Sep 17 16:29:02 2011 +0100
@@ -1105,7 +1105,7 @@
 		return -ENODEV;
 
 	mmap_pages = usbif_reqs * USBIF_MAX_SEGMENTS_PER_REQUEST;
-	pending_reqs = kmalloc(sizeof(pending_reqs[0]) *
+	pending_reqs = kzalloc(sizeof(pending_reqs[0]) *
 			usbif_reqs, GFP_KERNEL);
 	pending_grant_handles = kmalloc(sizeof(pending_grant_handles[0]) *
 			mmap_pages, GFP_KERNEL);
@@ -1119,7 +1119,6 @@
 	for (i = 0; i < mmap_pages; i++)
 		pending_grant_handles[i] = USBBACK_INVALID_HANDLE;
 
-	memset(pending_reqs, 0, sizeof(pending_reqs));
 	INIT_LIST_HEAD(&pending_free);
 
 	for (i = 0; i < usbif_reqs; i++)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 10:44:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 10:44:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4yw4-0006oQ-3D; Sat, 17 Sep 2011 10:44:16 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4yw1-0006mo-2B
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 10:44:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1316281450!18728752!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27053 invoked from network); 17 Sep 2011 17:44:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 17:44:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4yvx-000503-UO
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 18:44:09 +0100
Message-Id: <E1R4yvx-000503-UO@xenbits.xen.org>
Date: Sat, 17 Sep 2011 18:44:09 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Avoid race in schedule() when
	switching schedulers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1316273721 -3600
# Node ID 4a401bdaeb5b2d87312fa622dd61006e993ca5b4
# Parent  3e1d3c9747f20f6d5bd1a7a04431ac4a0f0c4e39
Avoid race in schedule() when switching schedulers

Selecting the scheduler to call must be done under lock. Otherwise a
race might occur when switching schedulers in a cpupool

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
xen-unstable changeset:   23843:6684e3bafbbd
xen-unstable date:        Sat Sep 17 16:19:26 2011 +0100
---


diff -r 3e1d3c9747f2 -r 4a401bdaeb5b xen/common/schedule.c
--- a/xen/common/schedule.c	Sat Sep 17 16:31:01 2011 +0100
+++ b/xen/common/schedule.c	Sat Sep 17 16:35:21 2011 +0100
@@ -1112,7 +1112,7 @@
 {
     struct vcpu          *prev = current, *next = NULL;
     s_time_t              now = NOW();
-    struct scheduler     *sched = this_cpu(scheduler);
+    struct scheduler     *sched;
     unsigned long        *tasklet_work = &this_cpu(tasklet_work_to_do);
     bool_t                tasklet_work_scheduled = 0;
     struct schedule_data *sd;
@@ -1146,6 +1146,7 @@
     stop_timer(&sd->s_timer);
     
     /* get policy-specific decision on scheduling... */
+    sched = this_cpu(scheduler);
     next_slice = sched->do_schedule(sched, now, tasklet_work_scheduled);
 
     next = next_slice.task;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 10:44:25 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 10:44:25 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4ywD-0006rV-4z; Sat, 17 Sep 2011 10:44:25 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4yw1-0006mn-1X
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 10:44:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1316281449!18709694!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22695 invoked from network); 17 Sep 2011 17:44:09 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 17:44:09 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4yvx-0004yz-C1
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 18:44:09 +0100
Message-Id: <E1R4yvx-0004yz-C1@xenbits.xen.org>
Date: Sat, 17 Sep 2011 18:44:08 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86: Couple of small cleanups
	after cpuid faulting patch.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1316273461 -3600
# Node ID 3e1d3c9747f20f6d5bd1a7a04431ac4a0f0c4e39
# Parent  829c4fd73b10967259a202eb19d78fc6762555f7
x86: Couple of small cleanups after cpuid faulting patch.

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23655:7e4404a8f5f9
xen-unstable date:        Mon Jul 04 07:57:32 2011 +0100

x86: Remove redundant cpuid-faulting-related BUG_ON I added.

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23654:122fcf37c596
xen-unstable date:        Sat Jul 02 09:08:27 2011 +0100

x86: cpuid faulting feature enable

Latest Intel processor add cpuid faulting feature. This patch is used
to support cpuid faulting in Xen.  Like cpuid spoofing, cpuid faulting
mainly used to support live migration. When cpuid faulting enabled,
cpuid instruction runs at cpl>0 will produce GP, vmm then emulate
execution of the cpuid instruction. Hence will appear to guest
software the value chosen by the vmm.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23653:71b58748cfee
xen-unstable date:        Fri Jul 01 22:28:53 2011 +0100
---


diff -r 829c4fd73b10 -r 3e1d3c9747f2 xen/arch/x86/cpu/cpu.h
--- a/xen/arch/x86/cpu/cpu.h	Tue Sep 13 10:38:34 2011 +0100
+++ b/xen/arch/x86/cpu/cpu.h	Sat Sep 17 16:31:01 2011 +0100
@@ -30,4 +30,3 @@
 extern void generic_identify(struct cpuinfo_x86 * c);
 
 extern void early_intel_workaround(struct cpuinfo_x86 *c);
-
diff -r 829c4fd73b10 -r 3e1d3c9747f2 xen/arch/x86/cpu/intel.c
--- a/xen/arch/x86/cpu/intel.c	Tue Sep 13 10:38:34 2011 +0100
+++ b/xen/arch/x86/cpu/intel.c	Sat Sep 17 16:31:01 2011 +0100
@@ -27,6 +27,30 @@
 struct movsl_mask movsl_mask __read_mostly;
 #endif
 
+static unsigned int probe_intel_cpuid_faulting(void)
+{
+	uint64_t x;
+	return !rdmsr_safe(MSR_INTEL_PLATFORM_INFO, x) && (x & (1u<<31));
+}
+
+static DEFINE_PER_CPU(bool_t, cpuid_faulting_enabled);
+void set_cpuid_faulting(bool_t enable)
+{
+	uint32_t hi, lo;
+
+	if (!cpu_has_cpuid_faulting ||
+	    this_cpu(cpuid_faulting_enabled) == enable )
+		return;
+
+	rdmsr(MSR_INTEL_MISC_FEATURES_ENABLES, lo, hi);
+	lo &= ~1;
+	if (enable)
+		lo |= 1;
+	wrmsr(MSR_INTEL_MISC_FEATURES_ENABLES, lo, hi);
+
+	this_cpu(cpuid_faulting_enabled) = enable;
+}
+
 /*
  * opt_cpuid_mask_ecx/edx: cpuid.1[ecx, edx] feature mask.
  * For example, E8400[Intel Core 2 Duo Processor series] ecx = 0x0008E3FD,
@@ -218,7 +242,16 @@
 		detect_ht(c);
 	}
 
-	set_cpuidmask(c);
+	if (smp_processor_id() == 0) {
+		if (probe_intel_cpuid_faulting())
+			set_bit(X86_FEATURE_CPUID_FAULTING, c->x86_capability);
+	} else if (boot_cpu_has(X86_FEATURE_CPUID_FAULTING)) {
+		BUG_ON(!probe_intel_cpuid_faulting());
+		set_bit(X86_FEATURE_CPUID_FAULTING, c->x86_capability);
+	}
+
+	if (!cpu_has_cpuid_faulting)
+		set_cpuidmask(c);
 
 	/* Work around errata */
 	Intel_errata_workarounds(c);
diff -r 829c4fd73b10 -r 3e1d3c9747f2 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Tue Sep 13 10:38:34 2011 +0100
+++ b/xen/arch/x86/domain.c	Sat Sep 17 16:31:01 2011 +0100
@@ -1519,6 +1519,9 @@
             load_LDT(next);
             load_segments(next);
         }
+
+        set_cpuid_faulting(!is_hvm_vcpu(next) &&
+                           (next->domain->domain_id != 0));
     }
 
     context_saved(prev);
diff -r 829c4fd73b10 -r 3e1d3c9747f2 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Tue Sep 13 10:38:34 2011 +0100
+++ b/xen/arch/x86/traps.c	Sat Sep 17 16:31:01 2011 +0100
@@ -2092,11 +2092,13 @@
 
  twobyte_opcode:
     /*
-     * All 2 and 3 byte opcodes, except RDTSC (0x31) and RDTSCP (0x1,0xF9)
-     * are executable only from guest kernel mode (virtual ring 0).
+     * All 2 and 3 byte opcodes, except RDTSC (0x31), RDTSCP (0x1,0xF9),
+     * and CPUID (0xa2), are executable only from guest kernel mode 
+     * (virtual ring 0).
      */
     opcode = insn_fetch(u8, code_base, eip, code_limit);
-    if ( !guest_kernel_mode(v, regs) && (opcode != 0x1) && (opcode != 0x31) )
+    if ( !guest_kernel_mode(v, regs) && 
+        (opcode != 0x1) && (opcode != 0x31) && (opcode != 0xa2) )
         goto fail;
 
     if ( lock && (opcode & ~3) != 0x20 )
@@ -2531,6 +2533,10 @@
         }
         break;
 
+    case 0xa2: /* CPUID */
+        pv_cpuid(regs);
+        break;
+
     default:
         goto fail;
     }
diff -r 829c4fd73b10 -r 3e1d3c9747f2 xen/include/asm-x86/cpufeature.h
--- a/xen/include/asm-x86/cpufeature.h	Tue Sep 13 10:38:34 2011 +0100
+++ b/xen/include/asm-x86/cpufeature.h	Sat Sep 17 16:31:01 2011 +0100
@@ -79,6 +79,7 @@
 #define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
 #define X86_FEATURE_TSC_RELIABLE (3*32+12) /* TSC is known to be reliable */
 #define X86_FEATURE_XTOPOLOGY    (3*32+13) /* cpu topology enum extensions */
+#define X86_FEATURE_CPUID_FAULTING (3*32+14) /* cpuid faulting */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3	(4*32+ 0) /* Streaming SIMD Extensions-3 */
@@ -217,6 +218,8 @@
 
 #define cpu_has_rdtscp          boot_cpu_has(X86_FEATURE_RDTSCP)
 
+#define cpu_has_cpuid_faulting	boot_cpu_has(X86_FEATURE_CPUID_FAULTING)
+
 #endif /* __ASM_I386_CPUFEATURE_H */
 
 /* 
diff -r 829c4fd73b10 -r 3e1d3c9747f2 xen/include/asm-x86/msr-index.h
--- a/xen/include/asm-x86/msr-index.h	Tue Sep 13 10:38:34 2011 +0100
+++ b/xen/include/asm-x86/msr-index.h	Sat Sep 17 16:31:01 2011 +0100
@@ -156,11 +156,6 @@
 #define MSR_P6_EVNTSEL0			0x00000186
 #define MSR_P6_EVNTSEL1			0x00000187
 
-/* MSRs for Intel cpuid feature mask */
-#define MSR_INTEL_CPUID_FEATURE_MASK	0x00000478
-#define MSR_INTEL_CPUID1_FEATURE_MASK	0x00000130
-#define MSR_INTEL_CPUID80000001_FEATURE_MASK 0x00000131
-
 /* MSRs & bits used for VMX enabling */
 #define MSR_IA32_VMX_BASIC                      0x480
 #define MSR_IA32_VMX_PINBASED_CTLS              0x481
@@ -472,6 +467,15 @@
 #define MSR_CORE_PERF_GLOBAL_CTRL	0x0000038f
 #define MSR_CORE_PERF_GLOBAL_OVF_CTRL	0x00000390
 
+/* Intel cpuid spoofing MSRs */
+#define MSR_INTEL_CPUID_FEATURE_MASK	0x00000478
+#define MSR_INTEL_CPUID1_FEATURE_MASK	0x00000130
+#define MSR_INTEL_CPUID80000001_FEATURE_MASK 0x00000131
+
+/* Intel cpuid faulting MSRs */
+#define MSR_INTEL_PLATFORM_INFO		0x000000ce
+#define MSR_INTEL_MISC_FEATURES_ENABLES	0x00000140
+
 /* Geode defined MSRs */
 #define MSR_GEODE_BUSCONT_CONF0		0x00001900
 
diff -r 829c4fd73b10 -r 3e1d3c9747f2 xen/include/asm-x86/processor.h
--- a/xen/include/asm-x86/processor.h	Tue Sep 13 10:38:34 2011 +0100
+++ b/xen/include/asm-x86/processor.h	Sat Sep 17 16:31:01 2011 +0100
@@ -193,6 +193,8 @@
 #define current_cpu_data boot_cpu_data
 #endif
 
+extern void set_cpuid_faulting(bool_t enable);
+
 extern u64 host_pat;
 extern int phys_proc_id[NR_CPUS];
 extern int cpu_core_id[NR_CPUS];

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 10:44:34 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 10:44:34 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4ywM-0006ui-9p; Sat, 17 Sep 2011 10:44:34 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4yw1-0006n6-Lx
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 10:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1316281435!42843377!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27375 invoked from network); 17 Sep 2011 17:43:55 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 17:43:55 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4yvy-00050q-Eb
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 18:44:10 +0100
Message-Id: <E1R4yvy-00050q-Eb@xenbits.xen.org>
Date: Sat, 17 Sep 2011 18:44:09 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] xen: Move tsc reliability check
	until after CPUs have booted
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1316273876 -3600
# Node ID c5554f952a82c5d6bc1989b3035a69ad9904203d
# Parent  4a401bdaeb5b2d87312fa622dd61006e993ca5b4
xen: Move tsc reliability check until after CPUs have booted

AMD CPUs by default enable X86_FEATURE_TSC_RELIABLE, and depend upon a
later check to disable this feature if TSC drift is detected.
Unfortunately, this check is done in time.c:init_xen_time(), which is
done before any secondary CPUs are brought up, and is thus guaranteed
to succed.

This patch moves the check into its own function, and calls it after
cpus are brought up.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen-unstable changeset:   23846:bf2aaf21e8e7
xen-unstable date:        Sat Sep 17 16:22:54 2011 +0100
---


diff -r 4a401bdaeb5b -r c5554f952a82 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c	Sat Sep 17 16:35:21 2011 +0100
+++ b/xen/arch/x86/setup.c	Sat Sep 17 16:37:56 2011 +0100
@@ -1266,8 +1266,11 @@
     printk("Brought up %ld CPUs\n", (long)num_online_cpus());
     smp_cpus_done(max_cpus);
 
+    verify_tsc_reliability();
+
     do_initcalls();
 
+
     if ( opt_watchdog ) 
         watchdog_enable();
     
diff -r 4a401bdaeb5b -r c5554f952a82 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Sat Sep 17 16:35:21 2011 +0100
+++ b/xen/arch/x86/time.c	Sat Sep 17 16:37:56 2011 +0100
@@ -1445,8 +1445,8 @@
     disable_tsc_sync = 1;
 }
 
-/* Late init function (after all CPUs are booted). */
-int __init init_xen_time(void)
+/* Late init function, after all cpus have booted */
+void __init verify_tsc_reliability(void)
 {
     if ( boot_cpu_has(X86_FEATURE_TSC_RELIABLE) )
     {
@@ -1458,9 +1458,17 @@
          */
         tsc_check_reliability();
         if ( tsc_max_warp )
+        {
+            printk("%s: TSC warp detected, disabling TSC_RELIABLE\n",
+                   __func__);
             setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE);
+        }
     }
+}
 
+/* Late init function (after interrupts are enabled). */
+int __init init_xen_time(void)
+{
     tsc_check_writability();
 
     /* If we have constant-rate TSCs then scale factor can be shared. */
diff -r 4a401bdaeb5b -r c5554f952a82 xen/include/xen/time.h
--- a/xen/include/xen/time.h	Sat Sep 17 16:35:21 2011 +0100
+++ b/xen/include/xen/time.h	Sat Sep 17 16:37:56 2011 +0100
@@ -11,6 +11,7 @@
 #include <xen/types.h>
 #include <public/xen.h>
 
+extern void verify_tsc_reliability(void);
 extern int init_xen_time(void);
 extern void cstate_restore_tsc(void);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 10:44:42 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 10:44:42 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4ywU-0006xu-7Z; Sat, 17 Sep 2011 10:44:42 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4yw2-0006nH-5E
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 10:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1316281451!29650764!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7277 invoked from network); 17 Sep 2011 17:44:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 17:44:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4yvy-00051d-Uq
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 18:44:10 +0100
Message-Id: <E1R4yvy-00051d-Uq@xenbits.xen.org>
Date: Sat, 17 Sep 2011 18:44:10 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86/vmx: don't call __vmxoff()
	blindly
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316273911 -3600
# Node ID 7d13e08b51209721fde4979ae59cceda6854877a
# Parent  c5554f952a82c5d6bc1989b3035a69ad9904203d
x86/vmx: don't call __vmxoff() blindly

If vmx_vcpu_up() failed, __vmxon() would generally not have got
(successfully) executed, and in that case __vmxoff() will #UD.

Additionally, any panic() during early resume (namely the tboot
related one) would cause vmx_cpu_down() to get executed without
vmx_cpu_up() having run before.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen-unstable changeset:   23848:cf37d2eec2ef
xen-unstable date:        Sat Sep 17 16:26:37 2011 +0100
---


diff -r c5554f952a82 -r 7d13e08b5120 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c	Sat Sep 17 16:37:56 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/vmcs.c	Sat Sep 17 16:38:31 2011 +0100
@@ -70,6 +70,7 @@
 static DEFINE_PER_CPU_READ_MOSTLY(struct vmcs_struct *, vmxon_region);
 static DEFINE_PER_CPU(struct vmcs_struct *, current_vmcs);
 static DEFINE_PER_CPU(struct list_head, active_vmcs_list);
+static DEFINE_PER_CPU(bool_t, vmxon);
 
 static u32 vmcs_revision_id __read_mostly;
 
@@ -517,6 +518,7 @@
         printk("CPU%d: unexpected VMXON failure\n", cpu);
         return -EINVAL;
     case 0: /* success */
+        this_cpu(vmxon) = 1;
         break;
     default:
         BUG();
@@ -538,6 +540,9 @@
     struct list_head *active_vmcs_list = &this_cpu(active_vmcs_list);
     unsigned long flags;
 
+    if ( !this_cpu(vmxon) )
+        return;
+
     local_irq_save(flags);
 
     while ( !list_empty(active_vmcs_list) )
@@ -545,6 +550,7 @@
                                     struct vcpu, arch.hvm_vmx.active_list));
 
     BUG_ON(!(read_cr4() & X86_CR4_VMXE));
+    this_cpu(vmxon) = 0;
     __vmxoff();
 
     local_irq_restore(flags);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 11:01:30 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 11:01:30 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4zCk-0007jE-1d; Sat, 17 Sep 2011 11:01:30 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4zBZ-0007bp-EE
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 11:00:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1316282414!17610872!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25279 invoked from network); 17 Sep 2011 18:00:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 18:00:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4zBW-0006pn-Cs
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 19:00:14 +0100
Message-Id: <E1R4zBW-0006pn-Cs@xenbits.xen.org>
Date: Sat, 17 Sep 2011 19:00:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86-64/EFI: 2.0 header extensions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316273226 -3600
# Node ID bf4be96e2de92d91212a52cc9d368e87a5b7e971
# Parent  cf37d2eec2ef0548588e2e2b2be10798168ce2d1
x86-64/EFI: 2.0 header extensions

Updates from gnu-efi 3.0m. UEFI 2.0 runtime services additions taken
from EDK 1.06.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r cf37d2eec2ef -r bf4be96e2de9 xen/arch/x86/efi/efi.h
--- a/xen/arch/x86/efi/efi.h	Sat Sep 17 16:26:37 2011 +0100
+++ b/xen/arch/x86/efi/efi.h	Sat Sep 17 16:27:06 2011 +0100
@@ -3,6 +3,7 @@
 #include <efi/efierr.h>
 #include <efi/eficon.h>
 #include <efi/efidevp.h>
+#include <efi/eficapsule.h>
 #include <efi/efiapi.h>
 #include <xen/efi.h>
 #include <xen/spinlock.h>
diff -r cf37d2eec2ef -r bf4be96e2de9 xen/include/asm-x86/x86_64/efibind.h
--- a/xen/include/asm-x86/x86_64/efibind.h	Sat Sep 17 16:26:37 2011 +0100
+++ b/xen/include/asm-x86/x86_64/efibind.h	Sat Sep 17 16:27:06 2011 +0100
@@ -236,7 +236,22 @@
 // one big module.
 //
 
-    #define EFI_DRIVER_ENTRY_POINT(InitFunction)
+    #define EFI_DRIVER_ENTRY_POINT(InitFunction)    \
+        UINTN                                       \
+        InitializeDriver (                          \
+            VOID    *ImageHandle,                   \
+            VOID    *SystemTable                    \
+            )                                       \
+        {                                           \
+            return InitFunction(ImageHandle,        \
+                    SystemTable);                   \
+        }                                           \
+                                                    \
+        EFI_STATUS efi_main(                        \
+            EFI_HANDLE image,                       \
+            EFI_SYSTEM_TABLE *systab                \
+            ) __attribute__((weak,                  \
+                    alias ("InitializeDriver")));
 
     #define LOAD_INTERNAL_DRIVER(_if, type, name, entry)    \
             (_if)->LoadInternal(type, name, entry)
diff -r cf37d2eec2ef -r bf4be96e2de9 xen/include/efi/efiapi.h
--- a/xen/include/efi/efiapi.h	Sat Sep 17 16:26:37 2011 +0100
+++ b/xen/include/efi/efiapi.h	Sat Sep 17 16:27:06 2011 +0100
@@ -246,6 +246,15 @@
     IN VOID                         *Data
     );
 
+typedef
+EFI_STATUS
+(EFIAPI *EFI_QUERY_VARIABLE_INFO) (
+    IN UINT32                       Attributes,
+    OUT UINT64                      *MaximumVariableStorageSize,
+    OUT UINT64                      *RemainingVariableStorageSize,
+    OUT UINT64                      *MaximumVariableSize
+    );
+
 
 //
 // EFI Time
@@ -412,6 +421,147 @@
     IN CHAR16                   *WatchdogData OPTIONAL
     );
 
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CONNECT_CONTROLLER) (
+    IN EFI_HANDLE               ControllerHandle,
+    IN EFI_HANDLE               *DriverImageHandle OPTIONAL,
+    IN EFI_DEVICE_PATH          *RemainingDevicePath OPTIONAL,
+    IN BOOLEAN                  Recursive
+    );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_DISCONNECT_CONTROLLER) (
+    IN EFI_HANDLE               ControllerHandle,
+    IN EFI_HANDLE               DriverImageHandle OPTIONAL,
+    IN EFI_HANDLE               ChildHandle OPTIONAL
+    );
+
+#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
+#define EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
+#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
+#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
+#define EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
+#define EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_OPEN_PROTOCOL) (
+    IN EFI_HANDLE               Handle,
+    IN EFI_GUID                 *Protocol,
+    OUT VOID                    **Interface OPTIONAL,
+    IN EFI_HANDLE               AgentHandle,
+    IN EFI_HANDLE               ControllerHandle,
+    IN UINT32                   Attributes
+    );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CLOSE_PROTOCOL) (
+    IN EFI_HANDLE               Handle,
+    IN EFI_GUID                 *Protocol,
+    IN EFI_HANDLE               AgentHandle,
+    IN EFI_HANDLE               ControllerHandle
+    );
+
+typedef struct {
+    EFI_HANDLE                  AgentHandle;
+    EFI_HANDLE                  ControllerHandle;
+    UINT32                      Attributes;
+    UINT32                      OpenCount;
+} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
+    IN EFI_HANDLE               Handle,
+    IN EFI_GUID                 *Protocol,
+    OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
+    OUT UINTN                   *EntryCount
+    );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
+    IN EFI_HANDLE               Handle,
+    OUT EFI_GUID                ***ProtocolBuffer,
+    OUT UINTN                   *ProtocolBufferCount
+    );
+
+typedef enum {
+    AllHandles,
+    ByRegisterNotify,
+    ByProtocol
+} EFI_LOCATE_SEARCH_TYPE;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
+    IN EFI_LOCATE_SEARCH_TYPE   SearchType,
+    IN EFI_GUID                 *Protocol OPTIONAL,
+    IN VOID                     *SearchKey OPTIONAL,
+    IN OUT UINTN                *NoHandles,
+    OUT EFI_HANDLE              **Buffer
+    );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_LOCATE_PROTOCOL) (
+    IN EFI_GUID                 *Protocol,
+    IN VOID                     *Registration OPTIONAL,
+    OUT VOID                    **Interface
+    );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
+    IN OUT EFI_HANDLE           *Handle,
+    ...
+    );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
+    IN OUT EFI_HANDLE           Handle,
+    ...
+    );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CALCULATE_CRC32) (
+    IN VOID                     *Data,
+    IN UINTN                    DataSize,
+    OUT UINT32                  *Crc32
+    );
+
+typedef
+VOID
+(EFIAPI *EFI_COPY_MEM) (
+    IN VOID                     *Destination,
+    IN VOID                     *Source,
+    IN UINTN                    Length
+    );
+
+typedef
+VOID
+(EFIAPI *EFI_SET_MEM) (
+    IN VOID                     *Buffer,
+    IN UINTN                    Size,
+    IN UINT8                    Value
+    );
+
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CREATE_EVENT_EX) (
+    IN UINT32                   Type,
+    IN EFI_TPL                  NotifyTpl,
+    IN EFI_EVENT_NOTIFY         NotifyFunction OPTIONAL,
+    IN const VOID               *NotifyContext OPTIONAL,
+    IN const EFI_GUID           EventGroup OPTIONAL,
+    OUT EFI_EVENT               *Event
+    );
 
 typedef enum {
     EfiResetCold,
@@ -440,6 +590,24 @@
     OUT UINT32                  *HighCount
     );
 
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UPDATE_CAPSULE) (
+    IN EFI_CAPSULE_HEADER       **CapsuleHeaderArray,
+    IN UINTN                    CapsuleCount,
+    IN EFI_PHYSICAL_ADDRESS     ScatterGatherList OPTIONAL
+    );
+
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES) (
+    IN  EFI_CAPSULE_HEADER      **CapsuleHeaderArray,
+    IN  UINTN                   CapsuleCount,
+    OUT UINT64                  *MaxiumCapsuleSize,
+    OUT EFI_RESET_TYPE          *ResetType
+);
+
 //
 // Protocol handler functions
 //
@@ -491,12 +659,6 @@
     OUT VOID                    **Registration
     );
 
-typedef enum {
-    AllHandles,
-    ByRegisterNotify,
-    ByProtocol
-} EFI_LOCATE_SEARCH_TYPE;
-
 typedef
 EFI_STATUS
 (EFIAPI *EFI_LOCATE_HANDLE) (
@@ -578,6 +740,14 @@
     EFI_GET_NEXT_HIGH_MONO_COUNT    GetNextHighMonotonicCount;
     EFI_RESET_SYSTEM                ResetSystem;
 
+    //
+    // New Boot Service added by UEFI 2.0
+    //
+
+    EFI_UPDATE_CAPSULE             UpdateCapsule;
+    EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities;
+    EFI_QUERY_VARIABLE_INFO        QueryVariableInfo;
+
 } EFI_RUNTIME_SERVICES;
 
 
@@ -652,6 +822,40 @@
     EFI_STALL                       Stall;
     EFI_SET_WATCHDOG_TIMER          SetWatchdogTimer;
 
+    //
+    // DriverSupport Services
+    //
+
+    EFI_CONNECT_CONTROLLER          ConnectController;
+    EFI_DISCONNECT_CONTROLLER       DisconnectController;
+
+    //
+    // Open and Close Protocol Services
+    //
+    EFI_OPEN_PROTOCOL               OpenProtocol;
+    EFI_CLOSE_PROTOCOL              CloseProtocol;
+    EFI_OPEN_PROTOCOL_INFORMATION   OpenProtocolInformation;
+
+    //
+    // Library Services
+    //
+    EFI_PROTOCOLS_PER_HANDLE        ProtocolsPerHandle;
+    EFI_LOCATE_HANDLE_BUFFER        LocateHandleBuffer;
+    EFI_LOCATE_PROTOCOL             LocateProtocol;
+    EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
+    EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
+
+    //
+    // 32-bit CRC Services
+    //
+    EFI_CALCULATE_CRC32             CalculateCrc32;
+
+    //
+    // Misc Services
+    //
+    EFI_COPY_MEM                    CopyMem;
+    EFI_SET_MEM                     SetMem;
+    EFI_CREATE_EVENT_EX             CreateEventEx;
 } EFI_BOOT_SERVICES;
 
 
diff -r cf37d2eec2ef -r bf4be96e2de9 xen/include/efi/eficapsule.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/efi/eficapsule.h	Sat Sep 17 16:27:06 2011 +0100
@@ -0,0 +1,89 @@
+/*++
+
+Copyright (c) 2004 - 2007, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+  EfiCapsule.h
+
+Abstract:
+
+  Defines for the EFI Capsule functionality
+
+--*/
+
+#ifndef _EFI_CAPSULE_H
+#define _EFI_CAPSULE_H
+
+
+#define CAPSULE_BLOCK_DESCRIPTOR_SIGNATURE  EFI_SIGNATURE_32 ('C', 'B', 'D', 'S')
+
+typedef struct {
+  EFI_GUID  OemGuid;
+  UINT32    HeaderSize;
+  //
+  // UINT8                       OemHdrData[];
+  //
+} EFI_CAPSULE_OEM_HEADER;
+
+#define MAX_SUPPORT_CAPSULE_NUM               50
+#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET    0x00010000
+#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE   0x00020000
+
+typedef struct {
+  UINT64                   Length;
+  union {
+    EFI_PHYSICAL_ADDRESS   DataBlock;
+    EFI_PHYSICAL_ADDRESS   ContinuationPointer;
+  } Union;
+} EFI_CAPSULE_BLOCK_DESCRIPTOR;
+
+typedef struct {
+  EFI_GUID  CapsuleGuid;
+  UINT32    HeaderSize;
+  UINT32    Flags;
+  UINT32    CapsuleImageSize;
+} EFI_CAPSULE_HEADER;
+
+typedef struct {
+  UINT32   CapsuleArrayNumber;
+  VOID*    CapsulePtr[1];
+} EFI_CAPSULE_TABLE;
+
+//
+// Bits in the flags field of the capsule header
+//
+#define EFI_CAPSULE_HEADER_FLAG_SETUP 0x00000001  // supports setup changes
+//
+// This is the GUID of the capsule header of the image on disk.
+//
+#define EFI_CAPSULE_GUID \
+  { \
+    0x3B6686BD, 0x0D76, 0x4030, 0xB7, 0x0E, 0xB5, 0x51, 0x9E, 0x2F, 0xC5, 0xA0 \
+  }
+
+//
+// This is the GUID of the file created by the capsule application that contains
+// the path to the device(s) to update.
+//
+#define EFI_PATH_FILE_NAME_GUID \
+  { \
+    0x7644C181, 0xFA6E, 0x46DA, 0x80, 0xCB, 0x04, 0xB9, 0x90, 0x40, 0x62, 0xE8 \
+  }
+//
+// This is the GUID of the configuration results file created by the capsule
+// application.
+//
+#define EFI_CONFIG_FILE_NAME_GUID \
+  { \
+    0x98B8D59B, 0xE8BA, 0x48EE, 0x98, 0xDD, 0xC2, 0x95, 0x39, 0x2F, 0x1E, 0xDB \
+  }
+
+#endif

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 11:01:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 11:01:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4zCz-0007mF-TI; Sat, 17 Sep 2011 11:01:45 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4zBa-0007br-9S
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 11:00:25 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1316282415!31806614!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12695 invoked from network); 17 Sep 2011 18:00:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 18:00:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4zBX-0006qF-1E
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 19:00:15 +0100
Message-Id: <E1R4zBX-0006qF-1E@xenbits.xen.org>
Date: Sat, 17 Sep 2011 19:00:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86-64/EFI: 2.0 hypercall extensions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316273256 -3600
# Node ID 3af7c715a79dc20a63b63d84727d1cf14a422ab8
# Parent  bf4be96e2de92d91212a52cc9d368e87a5b7e971
x86-64/EFI: 2.0 hypercall extensions

Flesh out the interface to EFI 2.0 runtime calls and implement what
can reasonably be without actually having active call paths getting
there (i.e. without actual debugging possible: The capsule interfaces
certainly require an environment where an initial implementation can
actually be tested).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r bf4be96e2de9 -r 3af7c715a79d xen/arch/x86/efi/runtime.c
--- a/xen/arch/x86/efi/runtime.c	Sat Sep 17 16:27:06 2011 +0100
+++ b/xen/arch/x86/efi/runtime.c	Sat Sep 17 16:27:36 2011 +0100
@@ -130,6 +130,14 @@
     case XEN_FW_EFI_VERSION:
         info->version = efi_version;
         break;
+    case XEN_FW_EFI_RT_VERSION:
+    {
+        unsigned long cr3 = efi_rs_enter();
+
+        info->version = efi_rs->Hdr.Revision;
+        efi_rs_leave(cr3);
+        break;
+    }
     case XEN_FW_EFI_CONFIG_TABLE:
         info->cfg.addr = __pa(efi_ct);
         info->cfg.nent = efi_num_ct;
@@ -418,7 +426,12 @@
         name.raw = xmalloc_bytes(size);
         if ( !name.raw )
             return -ENOMEM;
-        copy_from_guest(name.raw, op->u.get_next_variable_name.name, size);
+        if ( copy_from_guest(name.raw, op->u.get_next_variable_name.name,
+                             size) )
+        {
+            xfree(name.raw);
+            return -EFAULT;
+        }
 
         cr3 = efi_rs_enter();
         status = efi_rs->GetNextVariableName(
@@ -435,6 +448,31 @@
     }
     break;
 
+    case XEN_EFI_query_variable_info:
+        cr3 = efi_rs_enter();
+        if ( (efi_rs->Hdr.Revision >> 16) < 2 )
+        {
+            efi_rs_leave(cr3);
+            return -EOPNOTSUPP;
+        }
+        status = efi_rs->QueryVariableInfo(
+            op->u.query_variable_info.attr,
+            &op->u.query_variable_info.max_store_size,
+            &op->u.query_variable_info.remain_store_size,
+            &op->u.query_variable_info.max_size);
+        efi_rs_leave(cr3);
+        break;
+
+    case XEN_EFI_query_capsule_capabilities:
+    case XEN_EFI_update_capsule:
+        cr3 = efi_rs_enter();
+        if ( (efi_rs->Hdr.Revision >> 16) < 2 )
+        {
+            efi_rs_leave(cr3);
+            return -EOPNOTSUPP;
+        }
+        efi_rs_leave(cr3);
+        /* XXX fall through for now */
     default:
         return -ENOSYS;
     }
diff -r bf4be96e2de9 -r 3af7c715a79d xen/include/public/platform.h
--- a/xen/include/public/platform.h	Sat Sep 17 16:27:06 2011 +0100
+++ b/xen/include/public/platform.h	Sat Sep 17 16:27:36 2011 +0100
@@ -123,6 +123,9 @@
 #define XEN_EFI_get_variable                  6
 #define XEN_EFI_set_variable                  7
 #define XEN_EFI_get_next_variable_name        8
+#define XEN_EFI_query_variable_info           9
+#define XEN_EFI_query_capsule_capabilities   10
+#define XEN_EFI_update_capsule               11
 struct xenpf_efi_runtime_call {
     uint32_t function;
     /*
@@ -180,6 +183,26 @@
             XEN_GUEST_HANDLE(void) name;  /* UCS-2/UTF-16 string */
             struct xenpf_efi_guid vendor_guid;
         } get_next_variable_name;
+
+        struct {
+            uint32_t attr;
+            uint64_t max_store_size;
+            uint64_t remain_store_size;
+            uint64_t max_size;
+        } query_variable_info;
+
+        struct {
+            XEN_GUEST_HANDLE(void) capsule_header_array;
+            unsigned long capsule_count;
+            uint64_t max_capsule_size;
+            unsigned int reset_type;
+        } query_capsule_capabilities;
+
+        struct {
+            XEN_GUEST_HANDLE(void) capsule_header_array;
+            unsigned long capsule_count;
+            uint64_t sg_list; /* machine address */
+        } update_capsule;
     } u;
 };
 typedef struct xenpf_efi_runtime_call xenpf_efi_runtime_call_t;
@@ -194,6 +217,7 @@
 #define  XEN_FW_EFI_CONFIG_TABLE   1
 #define  XEN_FW_EFI_VENDOR         2
 #define  XEN_FW_EFI_MEM_INFO       3
+#define  XEN_FW_EFI_RT_VERSION     4
 struct xenpf_firmware_info {
     /* IN variables. */
     uint32_t type;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 11:02:04 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 11:02:04 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4zDH-0007pc-U6; Sat, 17 Sep 2011 11:02:04 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4zBW-0007bk-Od
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 11:00:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-21.messagelabs.com!1316282396!50325423!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19618 invoked from network); 17 Sep 2011 17:59:56 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 17:59:56 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4zBT-0006mV-EV
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 19:00:11 +0100
Message-Id: <E1R4zBT-0006mV-EV@xenbits.xen.org>
Date: Sat, 17 Sep 2011 19:00:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen/xsm: Compile error due to naming
	clash between XSM and EFI runtime
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User James Carter <jwcart2@tycho.nsa.gov>
# Date 1316272858 -3600
# Node ID da7f016b288fbdd05ba1c2b474bd47dd72b63fa3
# Parent  6684e3bafbbdb031e08fe330e762c4d5f5bcf535
xen/xsm: Compile error due to naming clash between XSM and EFI runtime

The problem is that efi_runtime_call is the name of both a function in
xen/arch/x86/efi/runtime.c and a member of the xsm_operations struct
in xen/include/xsm/xsm.h. This causes the macro "#define
efi_runtime_call(x) efi_compat_runtime_call(x)" on line 15 of
xen/arch/x86/x86_64/platform_hypercall.c to cause the above compile
error.

Renaming the XSM struct member fixes the problem.

Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
Acked-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 6684e3bafbbd -r da7f016b288f xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c	Sat Sep 17 16:19:26 2011 +0100
+++ b/xen/arch/x86/platform_hypercall.c	Sat Sep 17 16:20:58 2011 +0100
@@ -306,7 +306,7 @@
         break;
 
     case XENPF_efi_runtime_call:
-        ret = xsm_efi_runtime_call();
+        ret = xsm_efi_call();
         if ( ret )
             break;
 
diff -r 6684e3bafbbd -r da7f016b288f xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Sat Sep 17 16:19:26 2011 +0100
+++ b/xen/include/xsm/xsm.h	Sat Sep 17 16:20:58 2011 +0100
@@ -132,7 +132,7 @@
     int (*physinfo) (void);
     int (*platform_quirk) (uint32_t);
     int (*firmware_info) (void);
-    int (*efi_runtime_call) (void);
+    int (*efi_call) (void);
     int (*acpi_sleep) (void);
     int (*change_freq) (void);
     int (*getidletime) (void);
@@ -554,9 +554,9 @@
     return xsm_call(firmware_info());
 }
 
-static inline int xsm_efi_runtime_call (void)
+static inline int xsm_efi_call (void)
 {
-    return xsm_call(efi_runtime_call());
+    return xsm_call(efi_call());
 }
 
 static inline int xsm_acpi_sleep (void)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 11:02:20 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 11:02:20 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4zDX-0007tC-VS; Sat, 17 Sep 2011 11:02:20 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4zBY-0007bn-KR
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 11:00:25 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1316282413!18165152!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24013 invoked from network); 17 Sep 2011 18:00:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 18:00:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4zBV-0006oO-9K
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 19:00:13 +0100
Message-Id: <E1R4zBV-0006oO-9K@xenbits.xen.org>
Date: Sat, 17 Sep 2011 19:00:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/tboot: make resume error
	messages visible
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316273153 -3600
# Node ID dbfb2e052c4b3e096e4c14c55240ef4fa866e62e
# Parent  bf2aaf21e8e72fdd033c603b55792e9efd471dfa
x86/tboot: make resume error messages visible

With tboot_s3_resume() running before console_resume(), the error
messages so far printed by it are mostly guaranteed to go into
nirwana.  Latch MACs into a static variable instead, and issue the
messages right before calling panic().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r bf2aaf21e8e7 -r dbfb2e052c4b xen/arch/x86/acpi/power.c
--- a/xen/arch/x86/acpi/power.c	Sat Sep 17 16:22:54 2011 +0100
+++ b/xen/arch/x86/acpi/power.c	Sat Sep 17 16:25:53 2011 +0100
@@ -193,7 +193,7 @@
     printk(XENLOG_INFO "Finishing wakeup from ACPI S%d state.\n", state);
 
     if ( (state == ACPI_STATE_S3) && error )
-        panic("Memory integrity was lost on resume (%d)\n", error);
+        tboot_s3_error(error);
 
  done:
     spin_debug_enable();
diff -r bf2aaf21e8e7 -r dbfb2e052c4b xen/arch/x86/tboot.c
--- a/xen/arch/x86/tboot.c	Sat Sep 17 16:22:54 2011 +0100
+++ b/xen/arch/x86/tboot.c	Sat Sep 17 16:25:53 2011 +0100
@@ -481,35 +481,50 @@
     return rc;
 }
 
+static vmac_t orig_mac, resume_mac;
+
 int tboot_s3_resume(void)
 {
-    vmac_t mac;
-
     if ( !tboot_in_measured_env() )
         return 0;
 
     /* need to do these in reverse order of shutdown */
-    tboot_gen_xenheap_integrity(g_tboot_shared->s3_key, &mac);
-    printk("MAC for xenheap before S3 is: 0x%08"PRIx64"\n", xenheap_mac);
-    printk("MAC for xenheap after S3 is: 0x%08"PRIx64"\n", mac);
-    if ( mac != xenheap_mac )
+    tboot_gen_xenheap_integrity(g_tboot_shared->s3_key, &resume_mac);
+    orig_mac = xenheap_mac;
+    if ( resume_mac != xenheap_mac )
         return -1;
 
-    tboot_gen_frametable_integrity(g_tboot_shared->s3_key, &mac);
-    printk("MAC for frametable before S3 is: 0x%08"PRIx64"\n", frametable_mac);
-    printk("MAC for frametable after S3 is: 0x%08"PRIx64"\n", mac);
-    if ( mac != frametable_mac )
+    tboot_gen_frametable_integrity(g_tboot_shared->s3_key, &resume_mac);
+    orig_mac = frametable_mac;
+    if ( resume_mac != frametable_mac )
         return -2;
 
-    tboot_gen_domain_integrity(g_tboot_shared->s3_key, &mac);
-    printk("MAC for domains before S3 is: 0x%08"PRIx64"\n", domain_mac);
-    printk("MAC for domains after S3 is: 0x%08"PRIx64"\n", mac);
-    if ( mac != domain_mac )
+    tboot_gen_domain_integrity(g_tboot_shared->s3_key, &resume_mac);
+    orig_mac = domain_mac;
+    if ( resume_mac != domain_mac )
         return -3;
 
     return 0;
 }
 
+void tboot_s3_error(int error)
+{
+    const char *what = "???";
+
+    BUG_ON(!error || !tboot_in_measured_env());
+
+    switch ( error )
+    {
+    case -1: what = "Xen heap"; break;
+    case -2: what = "frame table"; break;
+    case -3: what = "domains"; break;
+    }
+
+    printk("MAC for %s before S3 is: 0x%08"PRIx64"\n", what, orig_mac);
+    printk("MAC for %s after S3 is: 0x%08"PRIx64"\n", what, resume_mac);
+    panic("Memory integrity was lost on resume (%d)\n", error);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r bf2aaf21e8e7 -r dbfb2e052c4b xen/include/asm-x86/tboot.h
--- a/xen/include/asm-x86/tboot.h	Sat Sep 17 16:22:54 2011 +0100
+++ b/xen/include/asm-x86/tboot.h	Sat Sep 17 16:25:53 2011 +0100
@@ -119,6 +119,7 @@
 int tboot_protect_mem_regions(void);
 int tboot_parse_dmar_table(acpi_table_handler dmar_handler);
 int tboot_s3_resume(void);
+void tboot_s3_error(int error);
 
 #endif /* __TBOOT_H__ */
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 11:02:37 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 11:02:37 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4zDo-0007wG-Cs; Sat, 17 Sep 2011 11:02:36 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4zBW-0007bj-Oq
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 11:00:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1316282411!18567044!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22135 invoked from network); 17 Sep 2011 18:00:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 18:00:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4zBS-0006lz-SZ
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 19:00:10 +0100
Message-Id: <E1R4zBS-0006lz-SZ@xenbits.xen.org>
Date: Sat, 17 Sep 2011 19:00:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Avoid race in schedule() when
	switching schedulers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1316272766 -3600
# Node ID 6684e3bafbbdb031e08fe330e762c4d5f5bcf535
# Parent  483c5f8319adafd61510d3a1ea085a7aec329a2d
Avoid race in schedule() when switching schedulers

Selecting the scheduler to call must be done under lock. Otherwise a
race might occur when switching schedulers in a cpupool

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
---


diff -r 483c5f8319ad -r 6684e3bafbbd xen/common/schedule.c
--- a/xen/common/schedule.c	Fri Sep 16 12:19:26 2011 +0100
+++ b/xen/common/schedule.c	Sat Sep 17 16:19:26 2011 +0100
@@ -1107,7 +1107,7 @@
 {
     struct vcpu          *prev = current, *next = NULL;
     s_time_t              now = NOW();
-    struct scheduler     *sched = this_cpu(scheduler);
+    struct scheduler     *sched;
     unsigned long        *tasklet_work = &this_cpu(tasklet_work_to_do);
     bool_t                tasklet_work_scheduled = 0;
     struct schedule_data *sd;
@@ -1141,6 +1141,7 @@
     stop_timer(&sd->s_timer);
     
     /* get policy-specific decision on scheduling... */
+    sched = this_cpu(scheduler);
     next_slice = sched->do_schedule(sched, now, tasklet_work_scheduled);
 
     next = next_slice.task;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 11:02:54 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 11:02:54 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4zE6-0007zN-Lh; Sat, 17 Sep 2011 11:02:54 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4zBY-0007bo-Qy
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 11:00:25 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1316282412!34479886!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7049 invoked from network); 17 Sep 2011 18:00:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 18:00:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4zBV-0006p4-Pz
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 19:00:13 +0100
Message-Id: <E1R4zBV-0006p4-Pz@xenbits.xen.org>
Date: Sat, 17 Sep 2011 19:00:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/vmx: don't call __vmxoff()
	blindly
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316273197 -3600
# Node ID cf37d2eec2ef0548588e2e2b2be10798168ce2d1
# Parent  dbfb2e052c4b3e096e4c14c55240ef4fa866e62e
x86/vmx: don't call __vmxoff() blindly

If vmx_vcpu_up() failed, __vmxon() would generally not have got
(successfully) executed, and in that case __vmxoff() will #UD.

Additionally, any panic() during early resume (namely the tboot
related one) would cause vmx_cpu_down() to get executed without
vmx_cpu_up() having run before.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r dbfb2e052c4b -r cf37d2eec2ef xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c	Sat Sep 17 16:25:53 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/vmcs.c	Sat Sep 17 16:26:37 2011 +0100
@@ -71,6 +71,7 @@
 static DEFINE_PER_CPU_READ_MOSTLY(struct vmcs_struct *, vmxon_region);
 static DEFINE_PER_CPU(struct vmcs_struct *, current_vmcs);
 static DEFINE_PER_CPU(struct list_head, active_vmcs_list);
+static DEFINE_PER_CPU(bool_t, vmxon);
 
 static u32 vmcs_revision_id __read_mostly;
 
@@ -519,6 +520,7 @@
         printk("CPU%d: unexpected VMXON failure\n", cpu);
         return -EINVAL;
     case 0: /* success */
+        this_cpu(vmxon) = 1;
         break;
     default:
         BUG();
@@ -540,6 +542,9 @@
     struct list_head *active_vmcs_list = &this_cpu(active_vmcs_list);
     unsigned long flags;
 
+    if ( !this_cpu(vmxon) )
+        return;
+
     local_irq_save(flags);
 
     while ( !list_empty(active_vmcs_list) )
@@ -547,6 +552,7 @@
                                     struct vcpu, arch.hvm_vmx.active_list));
 
     BUG_ON(!(read_cr4() & X86_CR4_VMXE));
+    this_cpu(vmxon) = 0;
     __vmxoff();
 
     local_irq_restore(flags);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 11:03:12 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 11:03:12 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4zEN-00082t-Uf; Sat, 17 Sep 2011 11:03:11 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4zBa-0007bx-SA
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 11:00:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1316282415!18729970!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19356 invoked from network); 17 Sep 2011 18:00:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 18:00:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4zBX-0006qg-NV
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 19:00:15 +0100
Message-Id: <E1R4zBX-0006qg-NV@xenbits.xen.org>
Date: Sat, 17 Sep 2011 19:00:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/time: verify_tsc_reliability()
	can be run as a generic initcall.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1316274296 -3600
# Node ID 994b5b125c31dd243e412aa568a0a6eb0d6436e9
# Parent  3af7c715a79dc20a63b63d84727d1cf14a422ab8
x86/time: verify_tsc_reliability() can be run as a generic initcall.

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 3af7c715a79d -r 994b5b125c31 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c	Sat Sep 17 16:27:36 2011 +0100
+++ b/xen/arch/x86/setup.c	Sat Sep 17 16:44:56 2011 +0100
@@ -1292,11 +1292,8 @@
     printk("Brought up %ld CPUs\n", (long)num_online_cpus());
     smp_cpus_done();
 
-    verify_tsc_reliability();
-
     do_initcalls();
 
-
     if ( opt_watchdog ) 
         watchdog_setup();
 
diff -r 3af7c715a79d -r 994b5b125c31 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Sat Sep 17 16:27:36 2011 +0100
+++ b/xen/arch/x86/time.c	Sat Sep 17 16:44:56 2011 +0100
@@ -1451,7 +1451,7 @@
 }
 
 /* Late init function, after all cpus have booted */
-void __init verify_tsc_reliability(void)
+static int __init verify_tsc_reliability(void)
 {
     if ( boot_cpu_has(X86_FEATURE_TSC_RELIABLE) )
     {
@@ -1469,7 +1469,10 @@
             setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE);
         }
     }
+
+    return 0;
 }
+__initcall(verify_tsc_reliability);
 
 /* Late init function (after interrupts are enabled). */
 int __init init_xen_time(void)
diff -r 3af7c715a79d -r 994b5b125c31 xen/include/xen/time.h
--- a/xen/include/xen/time.h	Sat Sep 17 16:27:36 2011 +0100
+++ b/xen/include/xen/time.h	Sat Sep 17 16:44:56 2011 +0100
@@ -11,7 +11,6 @@
 #include <xen/types.h>
 #include <public/xen.h>
 
-extern void verify_tsc_reliability(void);
 extern int init_xen_time(void);
 extern void cstate_restore_tsc(void);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 11:03:38 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 11:03:38 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4zEn-00086b-Uf; Sat, 17 Sep 2011 11:03:38 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4zBX-0007bl-CI
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 11:00:25 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1316282412!18661180!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12952 invoked from network); 17 Sep 2011 18:00:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 18:00:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4zBU-0006my-5b
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 19:00:12 +0100
Message-Id: <E1R4zBU-0006my-5b@xenbits.xen.org>
Date: Sat, 17 Sep 2011 19:00:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/hvm: Tidy up the viridian code a
	little and flesh out the APIC
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Paul Durrant <paul.durrant@citrix.com>
# Date 1316272933 -3600
# Node ID 17b754cab7b09c3fc76841366a378eb64007d091
# Parent  da7f016b288fbdd05ba1c2b474bd47dd72b63fa3
x86/hvm: Tidy up the viridian code a little and flesh out the APIC
assist MSR handling code.

We don't say we that handle that MSR but Windows assumes it. In
Windows 7 it just wrote to the MSR and we used to handle that
ok. Windows 8 also reads from the MSR so we need to keep a record of
the contents.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---


diff -r da7f016b288f -r 17b754cab7b0 xen/arch/x86/hvm/viridian.c
--- a/xen/arch/x86/hvm/viridian.c	Sat Sep 17 16:20:58 2011 +0100
+++ b/xen/arch/x86/hvm/viridian.c	Sat Sep 17 16:22:13 2011 +0100
@@ -96,9 +96,43 @@
     return 1;
 }
 
-static void enable_hypercall_page(void)
+void dump_guest_os_id(struct domain *d)
 {
-    struct domain *d = current->domain;
+    gdprintk(XENLOG_INFO, "GUEST_OS_ID:\n");
+    gdprintk(XENLOG_INFO, "\tvendor: %x\n",
+            d->arch.hvm_domain.viridian.guest_os_id.fields.vendor);
+    gdprintk(XENLOG_INFO, "\tos: %x\n",
+            d->arch.hvm_domain.viridian.guest_os_id.fields.os);
+    gdprintk(XENLOG_INFO, "\tmajor: %x\n",
+            d->arch.hvm_domain.viridian.guest_os_id.fields.major);
+    gdprintk(XENLOG_INFO, "\tminor: %x\n",
+            d->arch.hvm_domain.viridian.guest_os_id.fields.minor);
+    gdprintk(XENLOG_INFO, "\tsp: %x\n",
+            d->arch.hvm_domain.viridian.guest_os_id.fields.service_pack);
+    gdprintk(XENLOG_INFO, "\tbuild: %x\n",
+            d->arch.hvm_domain.viridian.guest_os_id.fields.build_number);
+}
+
+void dump_hypercall(struct domain *d)
+{
+    gdprintk(XENLOG_INFO, "HYPERCALL:\n");
+    gdprintk(XENLOG_INFO, "\tenabled: %x\n",
+            d->arch.hvm_domain.viridian.hypercall_gpa.fields.enabled);
+    gdprintk(XENLOG_INFO, "\tpfn: %lx\n",
+            (unsigned long)d->arch.hvm_domain.viridian.hypercall_gpa.fields.pfn);
+}
+
+void dump_apic_assist(struct vcpu *v)
+{
+    gdprintk(XENLOG_INFO, "APIC_ASSIST[%d]:\n", v->vcpu_id);
+    gdprintk(XENLOG_INFO, "\tenabled: %x\n",
+            v->arch.hvm_vcpu.viridian.apic_assist.fields.enabled);
+    gdprintk(XENLOG_INFO, "\tpfn: %lx\n",
+            (unsigned long)v->arch.hvm_vcpu.viridian.apic_assist.fields.pfn);
+}
+
+static void enable_hypercall_page(struct domain *d)
+{
     unsigned long gmfn = d->arch.hvm_domain.viridian.hypercall_gpa.fields.pfn;
     unsigned long mfn = gmfn_to_mfn(d, gmfn);
     uint8_t *p;
@@ -130,9 +164,43 @@
     put_page_and_type(mfn_to_page(mfn));
 }
 
+void initialize_apic_assist(struct vcpu *v)
+{
+    struct domain *d = v->domain;
+    unsigned long gmfn = v->arch.hvm_vcpu.viridian.apic_assist.fields.pfn;
+    unsigned long mfn = gmfn_to_mfn(d, gmfn);
+    uint8_t *p;
+
+    /*
+     * We don't support the APIC assist page, and that fact is reflected in
+     * our CPUID flags. However, Newer versions of Windows have a bug which
+     * means that they don't recognise that, and tries to use the page
+     * anyway. We therefore have to fake up just enough to keep windows happy.
+     *
+     * See http://msdn.microsoft.com/en-us/library/ff538657%28VS.85%29.aspx for
+     * details of how Windows uses the page.
+     */
+
+    if ( !mfn_valid(mfn) ||
+         !get_page_and_type(mfn_to_page(mfn), d, PGT_writable_page) )
+    {
+        gdprintk(XENLOG_WARNING, "Bad GMFN %lx (MFN %lx)\n", gmfn, mfn);
+        return;
+    }
+
+    p = map_domain_page(mfn);
+
+    *(u32 *)p = 0;
+
+    unmap_domain_page(p);
+
+    put_page_and_type(mfn_to_page(mfn));
+}
+
 int wrmsr_viridian_regs(uint32_t idx, uint64_t val)
 {
-    struct domain *d = current->domain;
+    struct vcpu *v = current;
+    struct domain *d = v->domain;
 
     if ( !is_viridian_domain(d) )
         return 0;
@@ -142,44 +210,29 @@
     case VIRIDIAN_MSR_GUEST_OS_ID:
         perfc_incr(mshv_wrmsr_osid);
         d->arch.hvm_domain.viridian.guest_os_id.raw = val;
-        gdprintk(XENLOG_INFO, "Guest os:\n");
-        gdprintk(XENLOG_INFO, "\tvendor: %x\n",
-               d->arch.hvm_domain.viridian.guest_os_id.fields.vendor);
-        gdprintk(XENLOG_INFO, "\tos: %x\n",
-               d->arch.hvm_domain.viridian.guest_os_id.fields.os);
-        gdprintk(XENLOG_INFO, "\tmajor: %x\n",
-               d->arch.hvm_domain.viridian.guest_os_id.fields.major);
-        gdprintk(XENLOG_INFO, "\tminor: %x\n",
-               d->arch.hvm_domain.viridian.guest_os_id.fields.minor);
-        gdprintk(XENLOG_INFO, "\tsp: %x\n",
-               d->arch.hvm_domain.viridian.guest_os_id.fields.service_pack);
-        gdprintk(XENLOG_INFO, "\tbuild: %x\n",
-               d->arch.hvm_domain.viridian.guest_os_id.fields.build_number);
+        dump_guest_os_id(d);
         break;
 
     case VIRIDIAN_MSR_HYPERCALL:
         perfc_incr(mshv_wrmsr_hc_page);
-        gdprintk(XENLOG_INFO, "Set hypercall page %"PRIx64".\n", val);
-        if ( d->arch.hvm_domain.viridian.guest_os_id.raw == 0 )
-            break;
         d->arch.hvm_domain.viridian.hypercall_gpa.raw = val;
+        dump_hypercall(d);
         if ( d->arch.hvm_domain.viridian.hypercall_gpa.fields.enabled )
-            enable_hypercall_page();
+            enable_hypercall_page(d);
         break;
 
     case VIRIDIAN_MSR_VP_INDEX:
         perfc_incr(mshv_wrmsr_vp_index);
-        gdprintk(XENLOG_INFO, "Set VP index %"PRIu64".\n", val);
         break;
 
     case VIRIDIAN_MSR_EOI:
         perfc_incr(mshv_wrmsr_eoi);
-        vlapic_EOI_set(vcpu_vlapic(current));
+        vlapic_EOI_set(vcpu_vlapic(v));
         break;
 
     case VIRIDIAN_MSR_ICR: {
         u32 eax = (u32)val, edx = (u32)(val >> 32);
-        struct vlapic *vlapic = vcpu_vlapic(current);
+        struct vlapic *vlapic = vcpu_vlapic(v);
         perfc_incr(mshv_wrmsr_icr);
         eax &= ~(1 << 12);
         edx &= 0xff000000;
@@ -191,31 +244,15 @@
 
     case VIRIDIAN_MSR_TPR:
         perfc_incr(mshv_wrmsr_tpr);
-        vlapic_set_reg(vcpu_vlapic(current), APIC_TASKPRI, (uint8_t)val);
+        vlapic_set_reg(vcpu_vlapic(v), APIC_TASKPRI, (uint8_t)val);
         break;
 
     case VIRIDIAN_MSR_APIC_ASSIST:
-        /*
-         * We don't support the APIC assist page, and that fact is reflected in
-         * our CPUID flags. However, Windows 7 build 7000 has a bug which means
-         * that it doesn't recognise that, and tries to use the page anyway. We
-         * therefore have to fake up just enough to keep win7 happy.
-         * Fortunately, that's really easy: just setting the first four bytes
-         * in the page to zero effectively disables the page again, so that's
-         * what we do. Semantically, the first four bytes are supposed to be a
-         * flag saying whether the guest really needs to issue an EOI. Setting
-         * that flag to zero means that it must always issue one, which is what
-         * we want. Once a page has been repurposed as an APIC assist page the
-         * guest isn't allowed to set anything in it, so the flag remains zero
-         * and all is fine. The guest is allowed to clear flags in the page,
-         * but that doesn't cause us any problems.
-         */
-        if ( val & 1 ) /* APIC assist page enabled? */
-        {
-            uint32_t word = 0;
-            paddr_t page_start = val & ~1ul;
-            (void)hvm_copy_to_guest_phys(page_start, &word, sizeof(word));
-        }
+        perfc_incr(mshv_wrmsr_apic_msr);
+        v->arch.hvm_vcpu.viridian.apic_assist.raw = val;
+        dump_apic_assist(v);
+        if (v->arch.hvm_vcpu.viridian.apic_assist.fields.enabled)
+            initialize_apic_assist(v);
         break;
 
     default:
@@ -228,20 +265,21 @@
 int rdmsr_viridian_regs(uint32_t idx, uint64_t *val)
 {
     struct vcpu *v = current;
+    struct domain *d = v->domain;
     
-    if ( !is_viridian_domain(v->domain) )
+    if ( !is_viridian_domain(d) )
         return 0;
 
     switch ( idx )
     {
     case VIRIDIAN_MSR_GUEST_OS_ID:
         perfc_incr(mshv_rdmsr_osid);
-        *val = v->domain->arch.hvm_domain.viridian.guest_os_id.raw;
+        *val = d->arch.hvm_domain.viridian.guest_os_id.raw;
         break;
 
     case VIRIDIAN_MSR_HYPERCALL:
         perfc_incr(mshv_rdmsr_hc_page);
-        *val = v->domain->arch.hvm_domain.viridian.hypercall_gpa.raw;
+        *val = d->arch.hvm_domain.viridian.hypercall_gpa.raw;
         break;
 
     case VIRIDIAN_MSR_VP_INDEX:
@@ -260,6 +298,11 @@
         *val = vlapic_get_reg(vcpu_vlapic(v), APIC_TASKPRI);
         break;
 
+    case VIRIDIAN_MSR_APIC_ASSIST:
+        perfc_incr(mshv_rdmsr_apic_msr);
+        *val = v->arch.hvm_vcpu.viridian.apic_assist.raw;
+        break;
+
     default:
         return 0;
     }
diff -r da7f016b288f -r 17b754cab7b0 xen/include/asm-x86/hvm/vcpu.h
--- a/xen/include/asm-x86/hvm/vcpu.h	Sat Sep 17 16:20:58 2011 +0100
+++ b/xen/include/asm-x86/hvm/vcpu.h	Sat Sep 17 16:22:13 2011 +0100
@@ -23,6 +23,7 @@
 #include <xen/tasklet.h>
 #include <asm/hvm/io.h>
 #include <asm/hvm/vlapic.h>
+#include <asm/hvm/viridian.h>
 #include <asm/hvm/vmx/vmcs.h>
 #include <asm/hvm/vmx/vvmx.h>
 #include <asm/hvm/svm/vmcb.h>
@@ -163,6 +164,8 @@
     int           inject_trap;       /* -1 for nothing to inject */
     int           inject_error_code;
     unsigned long inject_cr2;
+
+    struct viridian_vcpu viridian;
 };
 
 #endif /* __ASM_X86_HVM_VCPU_H__ */
diff -r da7f016b288f -r 17b754cab7b0 xen/include/asm-x86/hvm/viridian.h
--- a/xen/include/asm-x86/hvm/viridian.h	Sat Sep 17 16:20:58 2011 +0100
+++ b/xen/include/asm-x86/hvm/viridian.h	Sat Sep 17 16:22:13 2011 +0100
@@ -9,6 +9,21 @@
 #ifndef __ASM_X86_HVM_VIRIDIAN_H__
 #define __ASM_X86_HVM_VIRIDIAN_H__
 
+union viridian_apic_assist
+{   uint64_t raw;
+    struct
+    {
+        uint64_t enabled:1;
+        uint64_t reserved_preserved:11;
+        uint64_t pfn:48;
+    } fields;
+};
+
+struct viridian_vcpu
+{
+    union viridian_apic_assist apic_assist;
+};
+
 union viridian_guest_os_id
 {
     uint64_t raw;
diff -r da7f016b288f -r 17b754cab7b0 xen/include/asm-x86/perfc_defn.h
--- a/xen/include/asm-x86/perfc_defn.h	Sat Sep 17 16:20:58 2011 +0100
+++ b/xen/include/asm-x86/perfc_defn.h	Sat Sep 17 16:22:13 2011 +0100
@@ -120,12 +120,14 @@
 PERFCOUNTER(mshv_rdmsr_vp_index,        "MS Hv rdmsr vp index")
 PERFCOUNTER(mshv_rdmsr_icr,             "MS Hv rdmsr icr")
 PERFCOUNTER(mshv_rdmsr_tpr,             "MS Hv rdmsr tpr")
+PERFCOUNTER(mshv_rdmsr_apic_assist,     "MS Hv rdmsr APIC assist")
 PERFCOUNTER(mshv_wrmsr_osid,            "MS Hv wrmsr Guest OS ID")
 PERFCOUNTER(mshv_wrmsr_hc_page,         "MS Hv wrmsr hypercall page")
 PERFCOUNTER(mshv_wrmsr_vp_index,        "MS Hv wrmsr vp index")
 PERFCOUNTER(mshv_wrmsr_icr,             "MS Hv wrmsr icr")
 PERFCOUNTER(mshv_wrmsr_tpr,             "MS Hv wrmsr tpr")
 PERFCOUNTER(mshv_wrmsr_eoi,             "MS Hv wrmsr eoi")
+PERFCOUNTER(mshv_wrmsr_apic_assist,     "MS Hv wrmsr APIC assist")
 
 PERFCOUNTER(realmode_emulations, "realmode instructions emulated")
 PERFCOUNTER(realmode_exits,      "vmexits from realmode")

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Sat Sep 17 11:04:00 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 17 Sep 2011 11:04:00 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R4zFA-00089m-0l; Sat, 17 Sep 2011 11:04:00 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R4zBY-0007bm-4I
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 11:00:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1316282412!31802180!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25124 invoked from network); 17 Sep 2011 18:00:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Sep 2011 18:00:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R4zBU-0006ng-Ob
	for xen-changelog@lists.xensource.com; Sat, 17 Sep 2011 19:00:12 +0100
Message-Id: <E1R4zBU-0006ng-Ob@xenbits.xen.org>
Date: Sat, 17 Sep 2011 19:00:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: Move tsc reliability check
	until after CPUs have booted
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User George Dunlap <george.dunlap@eu.citrix.com>
# Date 1316272974 -3600
# Node ID bf2aaf21e8e72fdd033c603b55792e9efd471dfa
# Parent  17b754cab7b09c3fc76841366a378eb64007d091
xen: Move tsc reliability check until after CPUs have booted

AMD CPUs by default enable X86_FEATURE_TSC_RELIABLE, and depend upon a
later check to disable this feature if TSC drift is detected.
Unfortunately, this check is done in time.c:init_xen_time(), which is
done before any secondary CPUs are brought up, and is thus guaranteed
to succed.

This patch moves the check into its own function, and calls it after
cpus are brought up.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
---


diff -r 17b754cab7b0 -r bf2aaf21e8e7 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c	Sat Sep 17 16:22:13 2011 +0100
+++ b/xen/arch/x86/setup.c	Sat Sep 17 16:22:54 2011 +0100
@@ -1292,8 +1292,11 @@
     printk("Brought up %ld CPUs\n", (long)num_online_cpus());
     smp_cpus_done();
 
+    verify_tsc_reliability();
+
     do_initcalls();
 
+
     if ( opt_watchdog ) 
         watchdog_setup();
 
diff -r 17b754cab7b0 -r bf2aaf21e8e7 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Sat Sep 17 16:22:13 2011 +0100
+++ b/xen/arch/x86/time.c	Sat Sep 17 16:22:54 2011 +0100
@@ -1450,8 +1450,8 @@
     disable_tsc_sync = 1;
 }
 
-/* Late init function (after interrupts are enabled). */
-int __init init_xen_time(void)
+/* Late init function, after all cpus have booted */
+void __init verify_tsc_reliability(void)
 {
     if ( boot_cpu_has(X86_FEATURE_TSC_RELIABLE) )
     {
@@ -1463,9 +1463,17 @@
          */
         tsc_check_reliability();
         if ( tsc_max_warp )
+        {
+            printk("%s: TSC warp detected, disabling TSC_RELIABLE\n",
+                   __func__);
             setup_clear_cpu_cap(X86_FEATURE_TSC_RELIABLE);
+        }
     }
+}
 
+/* Late init function (after interrupts are enabled). */
+int __init init_xen_time(void)
+{
     tsc_check_writability();
 
     /* If we have constant-rate TSCs then scale factor can be shared. */
diff -r 17b754cab7b0 -r bf2aaf21e8e7 xen/include/xen/time.h
--- a/xen/include/xen/time.h	Sat Sep 17 16:22:13 2011 +0100
+++ b/xen/include/xen/time.h	Sat Sep 17 16:22:54 2011 +0100
@@ -11,6 +11,7 @@
 #include <xen/types.h>
 #include <public/xen.h>
 
+extern void verify_tsc_reliability(void);
 extern int init_xen_time(void);
 extern void cstate_restore_tsc(void);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 21 07:33:33 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 21 Sep 2011 07:33:33 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6Nrh-0007Iw-G3; Wed, 21 Sep 2011 07:33:33 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6NrL-00078y-UI
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 07:33:12 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-182.messagelabs.com!1316615588!19199306!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13087 invoked from network); 21 Sep 2011 14:33:09 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Sep 2011 14:33:09 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6NrI-00051X-Pm
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 15:33:08 +0100
Message-Id: <E1R6NrI-00051X-Pm@xenbits.xen.org>
Date: Wed, 21 Sep 2011 15:33:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Clear IRQ_GUEST in irq_desc->status
	when setting action to NULL.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Igor Mammedov <imammedo@redhat.com>
# Date 1316300426 -3600
# Node ID c944e82bb092925f31403a129087e9d40e0fa06a
# Parent  994b5b125c31dd243e412aa568a0a6eb0d6436e9
Clear IRQ_GUEST in irq_desc->status when setting action to NULL.

Looking more closely at usage of action field with relation to
IRQ_GUEST flag. It appears that set IRQ_GUEST implies that action
is not NULL. As result it is not safe to set action to NULL and
leave IRQ_GUEST set.

Hence IRQ_GUEST should be cleared in dynamic_irq_cleanup where
action is set to NULL.

An addition remove BUGON at __pirq_guest_unbind that appears to be
bogus and not needed anymore.

Thanks Paolo Bonzini for NACKing previous patch, and pointing at the
correct solution.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>

Reinstate the BUG_ON, but after the action==NULL check. Since we then
go and start interpreting action as an irq_guest_action_t, the BUG_ON
is relevant here.

More generally, the brute-force nature of dynamic_irq_cleanup() looks
a bit worrying. Possibly there should be more integratioin with
pirq_guest_unbind() logic, for cleaning up un-acked EOIs and the like.

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 994b5b125c31 -r c944e82bb092 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Sat Sep 17 16:44:56 2011 +0100
+++ b/xen/arch/x86/irq.c	Sun Sep 18 00:00:26 2011 +0100
@@ -192,6 +192,7 @@
 
     spin_lock_irqsave(&desc->lock, flags);
     desc->status  |= IRQ_DISABLED;
+    desc->status  &= ~IRQ_GUEST;
     desc->handler->shutdown(irq);
     action = desc->action;
     desc->action  = NULL;
@@ -1465,8 +1466,6 @@
     cpumask_t           cpu_eoi_map;
     int                 i;
 
-    BUG_ON(!(desc->status & IRQ_GUEST));
-
     action = (irq_guest_action_t *)desc->action;
     irq = desc - irq_desc;
 
@@ -1477,6 +1476,8 @@
         return NULL;
     }
 
+    BUG_ON(!(desc->status & IRQ_GUEST));
+
     for ( i = 0; (i < action->nr_guests) && (action->guest[i] != d); i++ )
         continue;
     BUG_ON(i == action->nr_guests);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 21 07:33:39 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 21 Sep 2011 07:33:39 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6Nrn-0007MM-6h; Wed, 21 Sep 2011 07:33:39 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6NrM-00079H-Gi
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 07:33:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1316615589!19051548!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9215 invoked from network); 21 Sep 2011 14:33:09 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Sep 2011 14:33:09 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6NrJ-00051m-Ab
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 15:33:09 +0100
Message-Id: <E1R6NrJ-00051m-Ab@xenbits.xen.org>
Date: Wed, 21 Sep 2011 15:33:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Fix PV CPUID virtualization of XSave
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Shan Haitao <haitao.shan@intel.com>
# Date 1316300518 -3600
# Node ID b78235de5c6407023759f9bbf723dd83887fedf0
# Parent  c944e82bb092925f31403a129087e9d40e0fa06a
Fix PV CPUID virtualization of XSave

The patch will fix XSave CPUID virtualization for PV guests. The XSave
area size returned by CPUID leaf D is changed dynamically depending on
the XCR0. Tools/libxc only assigns a static value. The fix will adjust
xsave area size during runtime.

Note: This fix is already in HVM cpuid virtualization. And Dom0 is not
affected, either.

Signed-off-by:  Shan Haitao <haitao.shan@intel.com>
---


diff -r c944e82bb092 -r b78235de5c64 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Sun Sep 18 00:00:26 2011 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Sun Sep 18 00:01:58 2011 +0100
@@ -2426,7 +2426,7 @@
         {
             /* reset EBX to default value first */
             *ebx = XSTATE_AREA_MIN_SIZE; 
-            for ( sub_leaf = 2; sub_leaf < 64; sub_leaf++ )
+            for ( sub_leaf = 2; sub_leaf < 63; sub_leaf++ )
             {
                 if ( !(v->arch.xcr0 & (1ULL << sub_leaf)) )
                     continue;
diff -r c944e82bb092 -r b78235de5c64 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Sun Sep 18 00:00:26 2011 +0100
+++ b/xen/arch/x86/traps.c	Sun Sep 18 00:01:58 2011 +0100
@@ -770,6 +770,30 @@
     {
         if ( !cpuid_hypervisor_leaves(a, c, &a, &b, &c, &d) )
             domain_cpuid(current->domain, a, c, &a, &b, &c, &d);
+
+        switch ( a )
+        {
+        case 0xd:
+        {
+            unsigned int sub_leaf, _eax, _ebx, _ecx, _edx;
+            /* EBX value of main leaf 0 depends on enabled xsave features */
+            if ( c == 0 && current->arch.xcr0 )
+            {
+                /* reset EBX to default value first */
+                b = XSTATE_AREA_MIN_SIZE;
+                for ( sub_leaf = 2; sub_leaf < 63; sub_leaf++ )
+                {
+                    if ( !(current->arch.xcr0 & (1ULL << sub_leaf)) )
+                        continue;
+                    domain_cpuid(current->domain, a, c, &_eax, &_ebx, &_ecx,
+                                 &_edx);
+                    if ( (_eax + _ebx) > b )
+                        b = _eax + _ebx;
+                }
+            }
+        break;
+        }
+        }
         goto out;
     }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 21 07:33:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 21 Sep 2011 07:33:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6Nru-0007PY-CD; Wed, 21 Sep 2011 07:33:46 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6NrM-00079Z-TJ
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 07:33:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1316615556!48989035!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22826 invoked from network); 21 Sep 2011 14:32:36 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Sep 2011 14:32:36 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6NrJ-000521-Qo
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 15:33:09 +0100
Message-Id: <E1R6NrJ-000521-Qo@xenbits.xen.org>
Date: Wed, 21 Sep 2011 15:33:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PCI multi-seg: introduce notion of
	PCI segments
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316301003 -3600
# Node ID e5263921c85e2ec98946dc4e6aa6bfd94b1920e3
# Parent  b78235de5c6407023759f9bbf723dd83887fedf0
PCI multi-seg: introduce notion of PCI segments

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r b78235de5c64 -r e5263921c85e xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c	Sun Sep 18 00:01:58 2011 +0100
+++ b/xen/arch/x86/setup.c	Sun Sep 18 00:10:03 2011 +0100
@@ -1246,6 +1246,8 @@
 
     local_irq_enable();
 
+    pt_pci_init();
+
 #ifdef CONFIG_X86_64
     vesa_mtrr_init();
 
diff -r b78235de5c64 -r e5263921c85e xen/arch/x86/x86_64/acpi_mmcfg.c
--- a/xen/arch/x86/x86_64/acpi_mmcfg.c	Sun Sep 18 00:01:58 2011 +0100
+++ b/xen/arch/x86/x86_64/acpi_mmcfg.c	Sun Sep 18 00:10:03 2011 +0100
@@ -111,6 +111,7 @@
             pci_mmcfg_config_num = 0;
             return -ENODEV;
         }
+        pci_add_segment(pci_mmcfg_config[i].pci_segment);
     }
 
     return 0;
diff -r b78235de5c64 -r e5263921c85e xen/arch/x86/x86_64/mmconfig-shared.c
--- a/xen/arch/x86/x86_64/mmconfig-shared.c	Sun Sep 18 00:01:58 2011 +0100
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c	Sun Sep 18 00:10:03 2011 +0100
@@ -171,6 +171,7 @@
         pci_mmcfg_config[i].pci_segment = i;
         pci_mmcfg_config[i].start_bus_number = 0;
         pci_mmcfg_config[i].end_bus_number = (1 << busnbits) - 1;
+        pci_add_segment(i);
     }
 
     return "AMD Family 10h NB";
diff -r b78235de5c64 -r e5263921c85e xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Sun Sep 18 00:01:58 2011 +0100
+++ b/xen/drivers/passthrough/pci.c	Sun Sep 18 00:10:03 2011 +0100
@@ -26,29 +26,93 @@
 #include <asm/hvm/irq.h>
 #include <xen/delay.h>
 #include <xen/keyhandler.h>
+#include <xen/radix-tree.h>
 #include <xen/tasklet.h>
 #ifdef CONFIG_X86
 #include <asm/msi.h>
 #endif
 
-LIST_HEAD(alldevs_list);
+struct pci_seg {
+    struct list_head alldevs_list;
+    u16 nr;
+    /* bus2bridge_lock protects bus2bridge array */
+    spinlock_t bus2bridge_lock;
+#define MAX_BUSES 256
+    struct {
+        u8 map;
+        u8 bus;
+        u8 devfn;
+    } bus2bridge[MAX_BUSES];
+};
+
 spinlock_t pcidevs_lock = SPIN_LOCK_UNLOCKED;
+static struct radix_tree_root pci_segments;
 
-#define MAX_BUSES 256
-static struct {
-    u8 map;
-    u8 bus;
-    u8 devfn;
-} bus2bridge[MAX_BUSES];
+static inline struct pci_seg *get_pseg(u16 seg)
+{
+    return radix_tree_lookup(&pci_segments, seg);
+}
 
-/* bus2bridge_lock protects bus2bridge array */
-static DEFINE_SPINLOCK(bus2bridge_lock);
+static struct pci_seg *alloc_pseg(u16 seg)
+{
+    struct pci_seg *pseg = get_pseg(seg);
 
-static struct pci_dev *alloc_pdev(u8 bus, u8 devfn)
+    if ( pseg )
+        return pseg;
+
+    pseg = xmalloc(struct pci_seg);
+    if ( !pseg )
+        return NULL;
+
+    pseg->nr = seg;
+    INIT_LIST_HEAD(&pseg->alldevs_list);
+    spin_lock_init(&pseg->bus2bridge_lock);
+    memset(pseg->bus2bridge, 0, sizeof(pseg->bus2bridge));
+
+    if ( radix_tree_insert(&pci_segments, seg, pseg) )
+    {
+        xfree(pseg);
+        pseg = NULL;
+    }
+
+    return pseg;
+}
+
+static int pci_segments_iterate(
+    int (*handler)(struct pci_seg *, void *), void *arg)
+{
+    u16 seg = 0;
+    int rc = 0;
+
+    do {
+        struct pci_seg *pseg;
+
+        if ( !radix_tree_gang_lookup(&pci_segments, (void **)&pseg, seg, 1) )
+            break;
+        rc = handler(pseg, arg);
+        seg = pseg->nr + 1;
+    } while (!rc && seg);
+
+    return rc;
+}
+
+void __init pt_pci_init(void)
+{
+    radix_tree_init(&pci_segments);
+    if ( !alloc_pseg(0) )
+        panic("Could not initialize PCI segment 0\n");
+}
+
+int __init pci_add_segment(u16 seg)
+{
+    return alloc_pseg(seg) ? 0 : -ENOMEM;
+}
+
+static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn)
 {
     struct pci_dev *pdev;
 
-    list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
         if ( pdev->bus == bus && pdev->devfn == devfn )
             return pdev;
 
@@ -61,7 +125,7 @@
     *((u8*) &pdev->devfn) = devfn;
     pdev->domain = NULL;
     INIT_LIST_HEAD(&pdev->msi_list);
-    list_add(&pdev->alldevs_list, &alldevs_list);
+    list_add(&pdev->alldevs_list, &pseg->alldevs_list);
     spin_lock_init(&pdev->msix_table_lock);
 
     return pdev;
@@ -75,11 +139,15 @@
 
 struct pci_dev *pci_get_pdev(int bus, int devfn)
 {
+    struct pci_seg *pseg = get_pseg(0);
     struct pci_dev *pdev = NULL;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
 
-    list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
+    if ( !pseg )
+        return NULL;
+
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
         if ( (pdev->bus == bus || bus == -1) &&
              (pdev->devfn == devfn || devfn == -1) )
         {
@@ -91,9 +159,13 @@
 
 struct pci_dev *pci_get_pdev_by_domain(struct domain *d, int bus, int devfn)
 {
+    struct pci_seg *pseg = get_pseg(0);
     struct pci_dev *pdev = NULL;
 
-    list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
+    if ( !pseg )
+        return NULL;
+
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
          if ( (pdev->bus == bus || bus == -1) &&
               (pdev->devfn == devfn || devfn == -1) &&
               (pdev->domain == d) )
@@ -145,6 +217,7 @@
 
 int pci_add_device(u8 bus, u8 devfn, const struct pci_dev_info *info)
 {
+    struct pci_seg *pseg;
     struct pci_dev *pdev;
     unsigned int slot = PCI_SLOT(devfn), func = PCI_FUNC(devfn);
     const char *pdev_type;
@@ -167,7 +240,10 @@
         return -EINVAL;
 
     spin_lock(&pcidevs_lock);
-    pdev = alloc_pdev(bus, devfn);
+    pseg = alloc_pseg(0);
+    if ( !pseg )
+        goto out;
+    pdev = alloc_pdev(pseg, bus, devfn);
     if ( !pdev )
         goto out;
 
@@ -262,11 +338,15 @@
 
 int pci_remove_device(u8 bus, u8 devfn)
 {
+    struct pci_seg *pseg = get_pseg(0);
     struct pci_dev *pdev;
     int ret = -ENODEV;
 
+    if ( !pseg )
+        return -ENODEV;
+
     spin_lock(&pcidevs_lock);
-    list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
         if ( pdev->bus == bus && pdev->devfn == devfn )
         {
             ret = iommu_remove_device(pdev);
@@ -384,22 +464,26 @@
  */
 int find_upstream_bridge(u8 *bus, u8 *devfn, u8 *secbus)
 {
+    struct pci_seg *pseg = get_pseg(0);
     int ret = 0;
     int cnt = 0;
 
     if ( *bus == 0 )
         return 0;
 
-    if ( !bus2bridge[*bus].map )
+    if ( !pseg )
+        return -1;
+
+    if ( !pseg->bus2bridge[*bus].map )
         return 0;
 
     ret = 1;
-    spin_lock(&bus2bridge_lock);
-    while ( bus2bridge[*bus].map )
+    spin_lock(&pseg->bus2bridge_lock);
+    while ( pseg->bus2bridge[*bus].map )
     {
         *secbus = *bus;
-        *devfn = bus2bridge[*bus].devfn;
-        *bus = bus2bridge[*bus].bus;
+        *devfn = pseg->bus2bridge[*bus].devfn;
+        *bus = pseg->bus2bridge[*bus].bus;
         if ( cnt++ >= MAX_BUSES )
         {
             ret = -1;
@@ -408,7 +492,7 @@
     }
 
 out:
-    spin_unlock(&bus2bridge_lock);
+    spin_unlock(&pseg->bus2bridge_lock);
     return ret;
 }
 
@@ -431,14 +515,13 @@
  * scan pci devices to add all existed PCI devices to alldevs_list,
  * and setup pci hierarchy in array bus2bridge.
  */
-int __init scan_pci_devices(void)
+static int __init _scan_pci_devices(struct pci_seg *pseg, void *arg)
 {
     struct pci_dev *pdev;
     int bus, dev, func;
     u8 sec_bus, sub_bus;
     int type;
 
-    spin_lock(&pcidevs_lock);
     for ( bus = 0; bus < 256; bus++ )
     {
         for ( dev = 0; dev < 32; dev++ )
@@ -448,11 +531,10 @@
                 if ( pci_device_detect(bus, dev, func) == 0 )
                     continue;
 
-                pdev = alloc_pdev(bus, PCI_DEVFN(dev, func));
+                pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
                 if ( !pdev )
                 {
                     printk("%s: alloc_pdev failed.\n", __func__);
-                    spin_unlock(&pcidevs_lock);
                     return -ENOMEM;
                 }
 
@@ -470,14 +552,15 @@
                         sub_bus = pci_conf_read8(bus, dev, func,
                                                  PCI_SUBORDINATE_BUS);
 
-                        spin_lock(&bus2bridge_lock);
+                        spin_lock(&pseg->bus2bridge_lock);
                         for ( sub_bus &= 0xff; sec_bus <= sub_bus; sec_bus++ )
                         {
-                            bus2bridge[sec_bus].map = 1;
-                            bus2bridge[sec_bus].bus =  bus;
-                            bus2bridge[sec_bus].devfn =  PCI_DEVFN(dev, func);
+                            pseg->bus2bridge[sec_bus].map = 1;
+                            pseg->bus2bridge[sec_bus].bus = bus;
+                            pseg->bus2bridge[sec_bus].devfn =
+                                PCI_DEVFN(dev, func);
                         }
-                        spin_unlock(&bus2bridge_lock);
+                        spin_unlock(&pseg->bus2bridge_lock);
                         break;
 
                     case DEV_TYPE_PCIe_ENDPOINT:
@@ -487,7 +570,6 @@
                     default:
                         printk("%s: unknown type: bdf = %x:%x.%x\n",
                                __func__, bus, dev, func);
-                        spin_unlock(&pcidevs_lock);
                         return -EINVAL;
                 }
 
@@ -498,8 +580,18 @@
         }
     }
 
+    return 0;
+}
+
+int __init scan_pci_devices(void)
+{
+    int ret;
+
+    spin_lock(&pcidevs_lock);
+    ret = pci_segments_iterate(_scan_pci_devices, NULL);
     spin_unlock(&pcidevs_lock);
-    return 0;
+
+    return ret;
 }
 
 /* Disconnect all PCI devices from the PCI buses. From the PCI spec:
@@ -508,29 +600,33 @@
  *    configuration accesses. All devices are required to support
  *    this base level of functionality."
  */
-void disconnect_pci_devices(void)
+static int _disconnect_pci_devices(struct pci_seg *pseg, void *arg)
 {
     struct pci_dev *pdev;
 
-    spin_lock(&pcidevs_lock);
-
-    list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
         pci_conf_write16(pdev->bus, PCI_SLOT(pdev->devfn),
                          PCI_FUNC(pdev->devfn), PCI_COMMAND, 0);
 
+    return 0;
+}
+
+void disconnect_pci_devices(void)
+{
+    spin_lock(&pcidevs_lock);
+    pci_segments_iterate(_disconnect_pci_devices, NULL);
     spin_unlock(&pcidevs_lock);
 }
 
 #ifdef SUPPORT_MSI_REMAPPING
-static void dump_pci_devices(unsigned char ch)
+static int _dump_pci_devices(struct pci_seg *pseg, void *arg)
 {
     struct pci_dev *pdev;
     struct msi_desc *msi;
 
-    printk("==== PCI devices ====\n");
-    spin_lock(&pcidevs_lock);
+    printk("==== segment %04x ====\n", pseg->nr);
 
-    list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
+    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
     {
         printk("%02x:%02x.%x - dom %-3d - MSIs < ",
                pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn),
@@ -540,6 +636,14 @@
         printk(">\n");
     }
 
+    return 0;
+}
+
+static void dump_pci_devices(unsigned char ch)
+{
+    printk("==== PCI devices ====\n");
+    spin_lock(&pcidevs_lock);
+    pci_segments_iterate(_dump_pci_devices, NULL);
     spin_unlock(&pcidevs_lock);
 }
 
diff -r b78235de5c64 -r e5263921c85e xen/include/xen/iommu.h
--- a/xen/include/xen/iommu.h	Sun Sep 18 00:01:58 2011 +0100
+++ b/xen/include/xen/iommu.h	Sun Sep 18 00:10:03 2011 +0100
@@ -92,6 +92,8 @@
 void iommu_set_pgd(struct domain *d);
 void iommu_domain_teardown(struct domain *d);
 
+void pt_pci_init(void);
+
 struct pirq;
 int hvm_do_IRQ_dpci(struct domain *, struct pirq *);
 int dpci_ioport_intercept(ioreq_t *p);
diff -r b78235de5c64 -r e5263921c85e xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Sun Sep 18 00:01:58 2011 +0100
+++ b/xen/include/xen/pci.h	Sun Sep 18 00:10:03 2011 +0100
@@ -89,6 +89,7 @@
 struct pci_dev *pci_lock_domain_pdev(struct domain *d, int bus, int devfn);
 
 void pci_release_devices(struct domain *d);
+int pci_add_segment(u16 seg);
 int pci_add_device(u8 bus, u8 devfn, const struct pci_dev_info *);
 int pci_remove_device(u8 bus, u8 devfn);
 struct pci_dev *pci_get_pdev(int bus, int devfn);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 21 07:33:52 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 21 Sep 2011 07:33:52 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6Nrz-0007SQ-PX; Wed, 21 Sep 2011 07:33:51 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6NrO-0007A5-6N
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 07:33:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1316615575!43362193!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18729 invoked from network); 21 Sep 2011 14:32:55 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Sep 2011 14:32:55 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6NrK-00052V-TJ
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 15:33:10 +0100
Message-Id: <E1R6NrK-00052V-TJ@xenbits.xen.org>
Date: Wed, 21 Sep 2011 15:33:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] 
	[xen-unstable] MAINTAINERS: Add Jan Beulich for EFI, x86, ACPI.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1316301683 -3600
# Node ID cd730c6982998364eadb7ebbefd08b71d2cd8673
# Parent  e2bd50b0843a5b87c63060078bdba940b27edce5
MAINTAINERS: Add Jan Beulich for EFI, x86, ACPI.

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r e2bd50b0843a -r cd730c698299 MAINTAINERS
--- a/MAINTAINERS	Sun Sep 18 00:12:19 2011 +0100
+++ b/MAINTAINERS	Sun Sep 18 00:21:23 2011 +0100
@@ -79,6 +79,7 @@
 M:	Winston Wang <winston.l.wang@intel.com>
 M:	Gang Wei <gang.wei@intel.com>
 M:	Mark Langsdorf <mark.langsdorf@amd.com>
+M:	Jan Beulich <jbeulich@suse.com>
 S:	Supported
 F:	xen/arch/x86/acpi/
 F:	xen/drivers/acpi/
@@ -101,6 +102,14 @@
 S:	Supported
 F:	xen/common/cpupool.c
 
+EFI
+M:     Jan Beulich <jbeulich@suse.com>
+S:     Supported
+F:     xen/arch/x86/efi/
+F:     xen/include/efi/
+F:     xen/include/asm-x86/efi*.h
+F:     xen/include/asm-x86/x86_*/efi*.h
+
 GDBSX DEBUGGER
 M:	Mukesh Rathor <mukesh.rathor@oracle.com>
 S:	Supported
@@ -113,8 +122,8 @@
 F:	tools/debugger/kdd/
 
 IA64 ARCHITECTURE
-M:	Supported
 M:	KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
+S:	Supported
 L:	xen-ia64-devel@lists.xensource.com
 F:	xen/arch/ia64/*
 F:	xen/include/asm-ia64/*
@@ -206,11 +215,12 @@
 F:	drivers/xen/usb*/
 
 X86 ARCHITECTURE
-M:	Supported
 M:	Keir Fraser <keir@xen.org>
+M:	Jan Beulich <jbeulich@suse.com>
+S:	Supported
 L:	xen-devel@lists.xensource.com
-F:	xen/arch/x86/*
-F:	xen/include/asm-x86/*
+F:	xen/arch/x86/
+F:	xen/include/asm-x86/
 
 X86 MEMORY MANAGEMENT
 M:	Tim Deegan <tim@xen.org>

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 21 07:33:59 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 21 Sep 2011 07:33:59 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6Ns6-0007Vd-Ek; Wed, 21 Sep 2011 07:33:58 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6NrO-00079q-K4
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 07:33:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1316615576!37065215!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10908 invoked from network); 21 Sep 2011 14:32:56 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Sep 2011 14:32:56 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6NrK-00052G-Dx
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 15:33:10 +0100
Message-Id: <E1R6NrK-00052G-Dx@xenbits.xen.org>
Date: Wed, 21 Sep 2011 15:33:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PCI multi-seg: add new physdevop-s
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316301139 -3600
# Node ID e2bd50b0843a5b87c63060078bdba940b27edce5
# Parent  e5263921c85e2ec98946dc4e6aa6bfd94b1920e3
PCI multi-seg: add new physdevop-s

The new PHYSDEVOP_pci_device_add is intended to be extensible, with a
first extension (to pass the proximity domain of a device) added right
away.

A couple of directly related functions at once get adjusted to account
for the segment number.

Should we deprecate the PHYSDEVOP_manage_pci_* sub-hypercalls?

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r e5263921c85e -r e2bd50b0843a xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/arch/ia64/xen/hypercall.c	Sun Sep 18 00:12:19 2011 +0100
@@ -665,7 +665,7 @@
         if ( copy_from_guest(&manage_pci, arg, 1) != 0 )
             break;
 
-        ret = pci_add_device(manage_pci.bus, manage_pci.devfn, NULL);
+        ret = pci_add_device(0, manage_pci.bus, manage_pci.devfn, NULL);
         break;
     }
 
@@ -678,7 +678,7 @@
         if ( copy_from_guest(&manage_pci, arg, 1) != 0 )
             break;
 
-        ret = pci_remove_device(manage_pci.bus, manage_pci.devfn);
+        ret = pci_remove_device(0, manage_pci.bus, manage_pci.devfn);
             break;
     }
 
@@ -698,7 +698,7 @@
         pdev_info.is_virtfn = manage_pci_ext.is_virtfn;
         pdev_info.physfn.bus = manage_pci_ext.physfn.bus;
         pdev_info.physfn.devfn = manage_pci_ext.physfn.devfn;
-        ret = pci_add_device(manage_pci_ext.bus,
+        ret = pci_add_device(0, manage_pci_ext.bus,
                              manage_pci_ext.devfn,
                              &pdev_info);
         break;
diff -r e5263921c85e -r e2bd50b0843a xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/arch/x86/irq.c	Sun Sep 18 00:12:19 2011 +0100
@@ -1716,7 +1716,7 @@
         if ( !cpu_has_apic )
             goto done;
 
-        pdev = pci_get_pdev(msi->bus, msi->devfn);
+        pdev = pci_get_pdev(msi->seg, msi->bus, msi->devfn);
         ret = pci_enable_msi(msi, &msi_desc);
         if ( ret )
             goto done;
diff -r e5263921c85e -r e2bd50b0843a xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/arch/x86/msi.c	Sun Sep 18 00:12:19 2011 +0100
@@ -528,7 +528,7 @@
 
     if ( vf >= 0 )
     {
-        struct pci_dev *pdev = pci_get_pdev(bus, PCI_DEVFN(slot, func));
+        struct pci_dev *pdev = pci_get_pdev(0, bus, PCI_DEVFN(slot, func));
         unsigned int pos = pci_find_ext_capability(0, bus,
                                                    PCI_DEVFN(slot, func),
                                                    PCI_EXT_CAP_ID_SRIOV);
@@ -767,7 +767,7 @@
     struct msi_desc *old_desc;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
-    pdev = pci_get_pdev(msi->bus, msi->devfn);
+    pdev = pci_get_pdev(msi->seg, msi->bus, msi->devfn);
     if ( !pdev )
         return -ENODEV;
 
@@ -775,7 +775,8 @@
     if ( old_desc )
     {
         dprintk(XENLOG_WARNING, "irq %d has already mapped to MSI on "
-                "device %02x:%02x.%01x.\n", msi->irq, msi->bus,
+                "device %04x:%02x:%02x.%01x\n",
+                msi->irq, msi->seg, msi->bus,
                 PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
         *desc = old_desc;
         return 0;
@@ -785,7 +786,7 @@
     if ( old_desc )
     {
         dprintk(XENLOG_WARNING, "MSI-X is already in use on "
-                "device %02x:%02x.%01x\n", msi->bus,
+                "device %04x:%02x:%02x.%01x\n", msi->seg, msi->bus,
                 PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
         pci_disable_msi(old_desc);
     }
@@ -830,7 +831,7 @@
     struct msi_desc *old_desc;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
-    pdev = pci_get_pdev(msi->bus, msi->devfn);
+    pdev = pci_get_pdev(msi->seg, msi->bus, msi->devfn);
     if ( !pdev )
         return -ENODEV;
 
@@ -844,7 +845,8 @@
     if ( old_desc )
     {
         dprintk(XENLOG_WARNING, "irq %d has already mapped to MSIX on "
-                "device %02x:%02x.%01x.\n", msi->irq, msi->bus,
+                "device %04x:%02x:%02x.%01x\n",
+                msi->irq, msi->seg, msi->bus,
                 PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
         *desc = old_desc;
         return 0;
@@ -854,7 +856,7 @@
     if ( old_desc )
     {
         dprintk(XENLOG_WARNING, "MSI is already in use on "
-                "device %02x:%02x.%01x\n", msi->bus,
+                "device %04x:%02x:%02x.%01x\n", msi->seg, msi->bus,
                 PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
         pci_disable_msi(old_desc);
 
@@ -962,8 +964,10 @@
 
         if (desc->msi_desc != entry)
         {
-            dprintk(XENLOG_ERR, "Restore MSI for dev %x:%x not set before?\n",
-                                pdev->bus, pdev->devfn);
+            dprintk(XENLOG_ERR,
+                    "Restore MSI for dev %04x:%02x:%02x:%x not set before?\n",
+                    pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
+                    PCI_FUNC(pdev->devfn));
             spin_unlock_irqrestore(&desc->lock, flags);
             return -EINVAL;
         }
diff -r e5263921c85e -r e2bd50b0843a xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/arch/x86/physdev.c	Sun Sep 18 00:12:19 2011 +0100
@@ -357,6 +357,15 @@
         if ( copy_from_guest(&map, arg, 1) != 0 )
             break;
 
+        if ( map.type == MAP_PIRQ_TYPE_MSI_SEG )
+        {
+            map.type = MAP_PIRQ_TYPE_MSI;
+            msi.seg = map.bus >> 16;
+        }
+        else
+        {
+            msi.seg = 0;
+        }
         msi.bus = map.bus;
         msi.devfn = map.devfn;
         msi.entry_nr = map.entry_nr;
@@ -480,7 +489,7 @@
         if ( copy_from_guest(&manage_pci, arg, 1) != 0 )
             break;
 
-        ret = pci_add_device(manage_pci.bus, manage_pci.devfn, NULL);
+        ret = pci_add_device(0, manage_pci.bus, manage_pci.devfn, NULL);
         break;
     }
 
@@ -493,7 +502,7 @@
         if ( copy_from_guest(&manage_pci, arg, 1) != 0 )
             break;
 
-        ret = pci_remove_device(manage_pci.bus, manage_pci.devfn);
+        ret = pci_remove_device(0, manage_pci.bus, manage_pci.devfn);
         break;
     }
 
@@ -517,12 +526,52 @@
         pdev_info.is_virtfn = manage_pci_ext.is_virtfn;
         pdev_info.physfn.bus = manage_pci_ext.physfn.bus;
         pdev_info.physfn.devfn = manage_pci_ext.physfn.devfn;
-        ret = pci_add_device(manage_pci_ext.bus,
+        ret = pci_add_device(0, manage_pci_ext.bus,
                              manage_pci_ext.devfn,
                              &pdev_info);
         break;
     }
 
+    case PHYSDEVOP_pci_device_add: {
+        struct physdev_pci_device_add add;
+        struct pci_dev_info pdev_info;
+
+        ret = -EPERM;
+        if ( !IS_PRIV(current->domain) )
+            break;
+
+        ret = -EFAULT;
+        if ( copy_from_guest(&add, arg, 1) != 0 )
+            break;
+
+        pdev_info.is_extfn = !!(add.flags & XEN_PCI_DEV_EXTFN);
+        if ( add.flags & XEN_PCI_DEV_VIRTFN )
+        {
+            pdev_info.is_virtfn = 1;
+            pdev_info.physfn.bus = add.physfn.bus;
+            pdev_info.physfn.devfn = add.physfn.devfn;
+        }
+        else
+            pdev_info.is_virtfn = 0;
+        ret = pci_add_device(add.seg, add.bus, add.devfn, &pdev_info);
+        break;
+    }
+
+    case PHYSDEVOP_pci_device_remove: {
+        struct physdev_pci_device dev;
+
+        ret = -EPERM;
+        if ( !IS_PRIV(v->domain) )
+            break;
+
+        ret = -EFAULT;
+        if ( copy_from_guest(&dev, arg, 1) != 0 )
+            break;
+
+        ret = pci_remove_device(dev.seg, dev.bus, dev.devfn);
+        break;
+    }
+
 #ifdef __x86_64__
     case PHYSDEVOP_pci_mmcfg_reserved: {
         struct physdev_pci_mmcfg_reserved info;
@@ -554,11 +603,31 @@
             break;
 
         spin_lock(&pcidevs_lock);
-        pdev = pci_get_pdev(restore_msi.bus, restore_msi.devfn);
+        pdev = pci_get_pdev(0, restore_msi.bus, restore_msi.devfn);
         ret = pdev ? pci_restore_msi_state(pdev) : -ENODEV;
         spin_unlock(&pcidevs_lock);
         break;
     }
+
+    case PHYSDEVOP_restore_msi_ext: {
+        struct physdev_pci_device dev;
+        struct pci_dev *pdev;
+
+        ret = -EPERM;
+        if ( !IS_PRIV(v->domain) )
+            break;
+
+        ret = -EFAULT;
+        if ( copy_from_guest(&dev, arg, 1) != 0 )
+            break;
+
+        spin_lock(&pcidevs_lock);
+        pdev = pci_get_pdev(dev.seg, dev.bus, dev.devfn);
+        ret = pdev ? pci_restore_msi_state(pdev) : -ENODEV;
+        spin_unlock(&pcidevs_lock);
+        break;
+    }
+
     case PHYSDEVOP_setup_gsi: {
         struct physdev_setup_gsi setup_gsi;
 
diff -r e5263921c85e -r e2bd50b0843a xen/arch/x86/x86_64/physdev.c
--- a/xen/arch/x86/x86_64/physdev.c	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/arch/x86/x86_64/physdev.c	Sun Sep 18 00:12:19 2011 +0100
@@ -67,6 +67,14 @@
 CHECK_physdev_pci_mmcfg_reserved;
 #undef xen_physdev_pci_mmcfg_reserved
 
+#define xen_physdev_pci_device_add physdev_pci_device_add
+CHECK_physdev_pci_device_add
+#undef xen_physdev_pci_device_add
+
+#define xen_physdev_pci_device physdev_pci_device
+CHECK_physdev_pci_device
+#undef xen_physdev_pci_device
+
 #define COMPAT
 #undef guest_handle_okay
 #define guest_handle_okay          compat_handle_okay
diff -r e5263921c85e -r e2bd50b0843a xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Sun Sep 18 00:12:19 2011 +0100
@@ -131,7 +131,7 @@
     {
         for ( devfn = 0; devfn < 256; devfn++ )
         {
-            pdev = pci_get_pdev(bus, devfn);
+            pdev = pci_get_pdev(0, bus, devfn);
             if ( !pdev )
                 continue;
 
@@ -313,7 +313,7 @@
     struct hvm_iommu *t = domain_hvm_iommu(target);
 
     ASSERT(spin_is_locked(&pcidevs_lock));
-    pdev = pci_get_pdev_by_domain(source, bus, devfn);
+    pdev = pci_get_pdev_by_domain(source, 0, bus, devfn);
     if ( !pdev )
         return -ENODEV;
 
diff -r e5263921c85e -r e2bd50b0843a xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/drivers/passthrough/iommu.c	Sun Sep 18 00:12:19 2011 +0100
@@ -282,7 +282,7 @@
         return -EINVAL;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
-    pdev = pci_get_pdev(bus, devfn);
+    pdev = pci_get_pdev(0, bus, devfn);
     if ( !pdev )
         return -ENODEV;
 
diff -r e5263921c85e -r e2bd50b0843a xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/drivers/passthrough/pci.c	Sun Sep 18 00:12:19 2011 +0100
@@ -121,6 +121,7 @@
         return NULL;
     memset(pdev, 0, sizeof(struct pci_dev));
 
+    *(u16*) &pdev->seg = pseg->nr;
     *((u8*) &pdev->bus) = bus;
     *((u8*) &pdev->devfn) = devfn;
     pdev->domain = NULL;
@@ -137,41 +138,59 @@
     xfree(pdev);
 }
 
-struct pci_dev *pci_get_pdev(int bus, int devfn)
+struct pci_dev *pci_get_pdev(int seg, int bus, int devfn)
 {
-    struct pci_seg *pseg = get_pseg(0);
+    struct pci_seg *pseg = get_pseg(seg);
     struct pci_dev *pdev = NULL;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
+    ASSERT(seg != -1 || bus == -1);
+    ASSERT(bus != -1 || devfn == -1);
 
     if ( !pseg )
-        return NULL;
+    {
+        if ( seg == -1 )
+            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
+        if ( !pseg )
+            return NULL;
+    }
 
-    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-        if ( (pdev->bus == bus || bus == -1) &&
-             (pdev->devfn == devfn || devfn == -1) )
-        {
-            return pdev;
-        }
+    do {
+        list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+            if ( (pdev->bus == bus || bus == -1) &&
+                 (pdev->devfn == devfn || devfn == -1) )
+                return pdev;
+    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
+                                     pseg->nr + 1, 1) );
 
     return NULL;
 }
 
-struct pci_dev *pci_get_pdev_by_domain(struct domain *d, int bus, int devfn)
+struct pci_dev *pci_get_pdev_by_domain(
+    struct domain *d, int seg, int bus, int devfn)
 {
-    struct pci_seg *pseg = get_pseg(0);
+    struct pci_seg *pseg = get_pseg(seg);
     struct pci_dev *pdev = NULL;
 
+    ASSERT(seg != -1 || bus == -1);
+    ASSERT(bus != -1 || devfn == -1);
+
     if ( !pseg )
-        return NULL;
+    {
+        if ( seg == -1 )
+            radix_tree_gang_lookup(&pci_segments, (void **)&pseg, 0, 1);
+        if ( !pseg )
+            return NULL;
+    }
 
-    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-         if ( (pdev->bus == bus || bus == -1) &&
-              (pdev->devfn == devfn || devfn == -1) &&
-              (pdev->domain == d) )
-         {
-             return pdev;
-         }
+    do {
+        list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
+            if ( (pdev->bus == bus || bus == -1) &&
+                 (pdev->devfn == devfn || devfn == -1) &&
+                 (pdev->domain == d) )
+                return pdev;
+    } while ( radix_tree_gang_lookup(&pci_segments, (void **)&pseg,
+                                     pseg->nr + 1, 1) );
 
     return NULL;
 }
@@ -215,7 +234,7 @@
     pci_conf_write16(bus, dev, func, pos + PCI_ACS_CTRL, ctrl);
 }
 
-int pci_add_device(u8 bus, u8 devfn, const struct pci_dev_info *info)
+int pci_add_device(u16 seg, u8 bus, u8 devfn, const struct pci_dev_info *info)
 {
     struct pci_seg *pseg;
     struct pci_dev *pdev;
@@ -230,17 +249,20 @@
     else if (info->is_virtfn)
     {
         spin_lock(&pcidevs_lock);
-        pdev = pci_get_pdev(info->physfn.bus, info->physfn.devfn);
+        pdev = pci_get_pdev(seg, info->physfn.bus, info->physfn.devfn);
         spin_unlock(&pcidevs_lock);
         if ( !pdev )
-            pci_add_device(info->physfn.bus, info->physfn.devfn, NULL);
+            pci_add_device(seg, info->physfn.bus, info->physfn.devfn, NULL);
         pdev_type = "virtual function";
     }
     else
-        return -EINVAL;
+    {
+        info = NULL;
+        pdev_type = "device";
+    }
 
     spin_lock(&pcidevs_lock);
-    pseg = alloc_pseg(0);
+    pseg = alloc_pseg(seg);
     if ( !pseg )
         goto out;
     pdev = alloc_pdev(pseg, bus, devfn);
@@ -251,7 +273,7 @@
         pdev->info = *info;
     else if ( !pdev->vf_rlen[0] )
     {
-        unsigned int pos = pci_find_ext_capability(0, bus, devfn,
+        unsigned int pos = pci_find_ext_capability(seg, bus, devfn,
                                                    PCI_EXT_CAP_ID_SRIOV);
         u16 ctrl = pci_conf_read16(bus, slot, func, pos + PCI_SRIOV_CTRL);
 
@@ -271,9 +293,10 @@
                 if ( (bar & PCI_BASE_ADDRESS_SPACE) ==
                      PCI_BASE_ADDRESS_SPACE_IO )
                 {
-                    printk(XENLOG_WARNING "SR-IOV device %02x:%02x.%x with vf"
-                                          " BAR%u in IO space\n",
-                           bus, slot, func, i);
+                    printk(XENLOG_WARNING
+                           "SR-IOV device %04x:%02x:%02x.%u with vf BAR%u"
+                           " in IO space\n",
+                           seg, bus, slot, func, i);
                     continue;
                 }
                 pci_conf_write32(bus, slot, func, idx, ~0);
@@ -282,9 +305,10 @@
                 {
                     if ( i >= PCI_SRIOV_NUM_BARS )
                     {
-                        printk(XENLOG_WARNING "SR-IOV device %02x:%02x.%x with"
-                                              " 64-bit vf BAR in last slot\n",
-                               bus, slot, func);
+                        printk(XENLOG_WARNING
+                               "SR-IOV device %04x:%02x:%02x.%u with 64-bit"
+                               " vf BAR in last slot\n",
+                               seg, bus, slot, func);
                         break;
                     }
                     hi = pci_conf_read32(bus, slot, func, idx + 4);
@@ -309,9 +333,10 @@
             }
         }
         else
-            printk(XENLOG_WARNING "SR-IOV device %02x:%02x.%x has its virtual"
-                                  " functions already enabled (%04x)\n",
-                   bus, slot, func, ctrl);
+            printk(XENLOG_WARNING
+                   "SR-IOV device %04x:%02x:%02x.%u has its virtual"
+                   " functions already enabled (%04x)\n",
+                   seg, bus, slot, func, ctrl);
     }
 
     ret = 0;
@@ -331,14 +356,14 @@
 
 out:
     spin_unlock(&pcidevs_lock);
-    printk(XENLOG_DEBUG "PCI add %s %02x:%02x.%x\n", pdev_type,
-           bus, slot, func);
+    printk(XENLOG_DEBUG "PCI add %s %04x:%02x:%02x.%u\n", pdev_type,
+           seg, bus, slot, func);
     return ret;
 }
 
-int pci_remove_device(u8 bus, u8 devfn)
+int pci_remove_device(u16 seg, u8 bus, u8 devfn)
 {
-    struct pci_seg *pseg = get_pseg(0);
+    struct pci_seg *pseg = get_pseg(seg);
     struct pci_dev *pdev;
     int ret = -ENODEV;
 
@@ -354,8 +379,8 @@
                 list_del(&pdev->domain_list);
             pci_cleanup_msi(pdev);
             free_pdev(pdev);
-            printk(XENLOG_DEBUG "PCI remove device %02x:%02x.%x\n", bus,
-                   PCI_SLOT(devfn), PCI_FUNC(devfn));
+            printk(XENLOG_DEBUG "PCI remove device %04x:%02x:%02x.%u\n",
+                   seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
             break;
         }
 
@@ -413,7 +438,7 @@
 
     spin_lock(&pcidevs_lock);
     pci_clean_dpci_irqs(d);
-    while ( (pdev = pci_get_pdev_by_domain(d, -1, -1)) )
+    while ( (pdev = pci_get_pdev_by_domain(d, -1, -1, -1)) )
     {
         pci_cleanup_msi(pdev);
         bus = pdev->bus; devfn = pdev->devfn;
diff -r e5263921c85e -r e2bd50b0843a xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Sun Sep 18 00:12:19 2011 +0100
@@ -280,7 +280,7 @@
          * just get any passthrough device in the domainr - assume user
          * assigns only devices from same node to a given guest.
          */
-        pdev = pci_get_pdev_by_domain(domain, -1, -1);
+        pdev = pci_get_pdev_by_domain(domain, -1, -1, -1);
         drhd = acpi_find_matched_drhd_unit(pdev);
         if ( !alloc || ((hd->pgd_maddr = alloc_pgtable_maddr(drhd, 1)) == 0) )
             goto out;
@@ -297,7 +297,7 @@
             if ( !alloc )
                 break;
 
-            pdev = pci_get_pdev_by_domain(domain, -1, -1);
+            pdev = pci_get_pdev_by_domain(domain, -1, -1, -1);
             drhd = acpi_find_matched_drhd_unit(pdev);
             maddr = alloc_pgtable_maddr(drhd, 1);
             if ( !maddr )
@@ -1273,7 +1273,7 @@
 
         /* First try to get domain ownership from device structure.  If that's
          * not available, try to read it from the context itself. */
-        pdev = pci_get_pdev(bus, devfn);
+        pdev = pci_get_pdev(0, bus, devfn);
         if ( pdev )
         {
             if ( pdev->domain != domain )
@@ -1396,7 +1396,7 @@
     int ret = 0;
     u32 type;
     u8 secbus;
-    struct pci_dev *pdev = pci_get_pdev(bus, devfn);
+    struct pci_dev *pdev = pci_get_pdev(0, bus, devfn);
 
     drhd = acpi_find_matched_drhd_unit(pdev);
     if ( !drhd )
@@ -1521,7 +1521,7 @@
     int ret = 0;
     u32 type;
     u8 tmp_bus, tmp_devfn, secbus;
-    struct pci_dev *pdev = pci_get_pdev(bus, devfn);
+    struct pci_dev *pdev = pci_get_pdev(0, bus, devfn);
     int found = 0;
 
     BUG_ON(!pdev);
@@ -1632,7 +1632,7 @@
     int ret;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
-    pdev = pci_get_pdev_by_domain(source, bus, devfn);
+    pdev = pci_get_pdev_by_domain(source, 0, bus, devfn);
 
     if (!pdev)
         return -ENODEV;
@@ -1941,7 +1941,7 @@
     {
         for ( devfn = 0; devfn < 256; devfn++ )
         {
-            pdev = pci_get_pdev(bus, devfn);
+            pdev = pci_get_pdev(0, bus, devfn);
             if ( !pdev )
                 continue;
 
@@ -2175,7 +2175,7 @@
     struct pci_dev *pdev;
 
     spin_lock(&pcidevs_lock);
-    pdev = pci_get_pdev_by_domain(dom0, bus, devfn);
+    pdev = pci_get_pdev_by_domain(dom0, 0, bus, devfn);
     if (!pdev)
     {
         spin_unlock(&pcidevs_lock);
@@ -2197,7 +2197,7 @@
         return -ENODEV;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
-    pdev = pci_get_pdev(bus, devfn);
+    pdev = pci_get_pdev(0, bus, devfn);
     if (!pdev)
         return -ENODEV;
 
diff -r e5263921c85e -r e2bd50b0843a xen/drivers/passthrough/vtd/quirks.c
--- a/xen/drivers/passthrough/vtd/quirks.c	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/drivers/passthrough/vtd/quirks.c	Sun Sep 18 00:12:19 2011 +0100
@@ -286,7 +286,7 @@
     struct pci_dev *pdev;
 
     /* find ME VT-d engine base on a real ME device */
-    pdev = pci_get_pdev(0, PCI_DEVFN(dev, 0));
+    pdev = pci_get_pdev(0, 0, PCI_DEVFN(dev, 0));
     drhd = acpi_find_matched_drhd_unit(pdev);
 
     /* map or unmap ME phantom function */
diff -r e5263921c85e -r e2bd50b0843a xen/drivers/passthrough/vtd/x86/ats.c
--- a/xen/drivers/passthrough/vtd/x86/ats.c	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/drivers/passthrough/vtd/x86/ats.c	Sun Sep 18 00:12:19 2011 +0100
@@ -37,6 +37,7 @@
 
 struct pci_ats_dev {
     struct list_head list;
+    u16 seg;
     u8 bus;
     u8 devfn;
     u16 ats_queue_depth;    /* ATS device invalidation queue depth */
@@ -91,7 +92,7 @@
     if ( !ats_enabled || !iommu_qinval )
         return 0;
 
-    pdev = pci_get_pdev(bus, devfn);
+    pdev = pci_get_pdev(seg, bus, devfn);
     if ( !pdev )
         return 0;
 
@@ -130,8 +131,9 @@
     BUG_ON(!pos);
 
     if ( iommu_verbose )
-        dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS capability found\n",
-                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_INFO VTDPREFIX,
+                "%04x:%02x:%02x.%u: ATS capability found\n",
+                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
 
     /* BUGBUG: add back seg when multi-seg platform support is enabled */
     value = pci_conf_read16(bus, PCI_SLOT(devfn),
@@ -140,7 +142,7 @@
     {
         list_for_each_entry ( pdev, &ats_devices, list )
         {
-            if ( pdev->bus == bus && pdev->devfn == devfn )
+            if ( pdev->seg == seg && pdev->bus == bus && pdev->devfn == devfn )
             {
                 pos = 0;
                 break;
@@ -161,6 +163,7 @@
 
     if ( pos )
     {
+        pdev->seg = seg;
         pdev->bus = bus;
         pdev->devfn = devfn;
         value = pci_conf_read16(bus, PCI_SLOT(devfn),
@@ -170,8 +173,10 @@
     }
 
     if ( iommu_verbose )
-        dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS %s enabled\n",
-                bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos ? "is" : "was");
+        dprintk(XENLOG_INFO VTDPREFIX,
+                "%04x:%02x:%02x.%u: ATS %s enabled\n",
+                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                pos ? "is" : "was");
 
     return pos;
 }
@@ -194,7 +199,7 @@
 
     list_for_each_entry ( pdev, &ats_devices, list )
     {
-        if ( pdev->bus == bus && pdev->devfn == devfn )
+        if ( pdev->seg == seg && pdev->bus == bus && pdev->devfn == devfn )
         {
             list_del(&pdev->list);
             xfree(pdev);
@@ -203,8 +208,9 @@
     }
 
     if ( iommu_verbose )
-        dprintk(XENLOG_INFO VTDPREFIX, "%x:%x.%x: ATS is disabled\n",
-                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+        dprintk(XENLOG_INFO VTDPREFIX,
+                "%04x:%02x:%02x.%u: ATS is disabled\n",
+                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
 }
 
 
diff -r e5263921c85e -r e2bd50b0843a xen/include/asm-x86/msi.h
--- a/xen/include/asm-x86/msi.h	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/include/asm-x86/msi.h	Sun Sep 18 00:12:19 2011 +0100
@@ -59,8 +59,9 @@
 #endif
 
 struct msi_info {
-    int bus;
-    int devfn;
+    u16 seg;
+    u8 bus;
+    u8 devfn;
     int irq;
     int entry_nr;
     uint64_t table_base;
diff -r e5263921c85e -r e2bd50b0843a xen/include/public/physdev.h
--- a/xen/include/public/physdev.h	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/include/public/physdev.h	Sun Sep 18 00:12:19 2011 +0100
@@ -142,6 +142,7 @@
 #define MAP_PIRQ_TYPE_MSI               0x0
 #define MAP_PIRQ_TYPE_GSI               0x1
 #define MAP_PIRQ_TYPE_UNKNOWN           0x2
+#define MAP_PIRQ_TYPE_MSI_SEG           0x3
 
 #define PHYSDEVOP_map_pirq               13
 struct physdev_map_pirq {
@@ -152,7 +153,7 @@
     int index;
     /* IN or OUT */
     int pirq;
-    /* IN */
+    /* IN - high 16 bits hold segment for MAP_PIRQ_TYPE_MSI_SEG */
     int bus;
     /* IN */
     int devfn;
@@ -268,6 +269,41 @@
 typedef struct physdev_pci_mmcfg_reserved physdev_pci_mmcfg_reserved_t;
 DEFINE_XEN_GUEST_HANDLE(physdev_pci_mmcfg_reserved_t);
 
+#define XEN_PCI_DEV_EXTFN              0x1
+#define XEN_PCI_DEV_VIRTFN             0x2
+#define XEN_PCI_DEV_PXM                0x4
+
+#define PHYSDEVOP_pci_device_add        25
+struct physdev_pci_device_add {
+    /* IN */
+    uint16_t seg;
+    uint8_t bus;
+    uint8_t devfn;
+    uint32_t flags;
+    struct {
+        uint8_t bus;
+        uint8_t devfn;
+    } physfn;
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    uint32_t optarr[];
+#elif defined(__GNUC__)
+    uint32_t optarr[0];
+#endif
+};
+typedef struct physdev_pci_device_add physdev_pci_device_add_t;
+DEFINE_XEN_GUEST_HANDLE(physdev_pci_device_add_t);
+
+#define PHYSDEVOP_pci_device_remove     26
+#define PHYSDEVOP_restore_msi_ext       27
+struct physdev_pci_device {
+    /* IN */
+    uint16_t seg;
+    uint8_t bus;
+    uint8_t devfn;
+};
+typedef struct physdev_pci_device physdev_pci_device_t;
+DEFINE_XEN_GUEST_HANDLE(physdev_pci_device_t);
+
 /*
  * Notify that some PIRQ-bound event channels have been unmasked.
  * ** This command is obsolete since interface version 0x00030202 and is **
diff -r e5263921c85e -r e2bd50b0843a xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/include/xen/pci.h	Sun Sep 18 00:12:19 2011 +0100
@@ -56,6 +56,7 @@
     spinlock_t msix_table_lock;
 
     struct domain *domain;
+    const u16 seg;
     const u8 bus;
     const u8 devfn;
     struct pci_dev_info info;
@@ -90,10 +91,11 @@
 
 void pci_release_devices(struct domain *d);
 int pci_add_segment(u16 seg);
-int pci_add_device(u8 bus, u8 devfn, const struct pci_dev_info *);
-int pci_remove_device(u8 bus, u8 devfn);
-struct pci_dev *pci_get_pdev(int bus, int devfn);
-struct pci_dev *pci_get_pdev_by_domain(struct domain *d, int bus, int devfn);
+int pci_add_device(u16 seg, u8 bus, u8 devfn, const struct pci_dev_info *);
+int pci_remove_device(u16 seg, u8 bus, u8 devfn);
+struct pci_dev *pci_get_pdev(int seg, int bus, int devfn);
+struct pci_dev *pci_get_pdev_by_domain(
+    struct domain *, int seg, int bus, int devfn);
 
 void disconnect_pci_devices(void);
 
diff -r e5263921c85e -r e2bd50b0843a xen/include/xlat.lst
--- a/xen/include/xlat.lst	Sun Sep 18 00:10:03 2011 +0100
+++ b/xen/include/xlat.lst	Sun Sep 18 00:12:19 2011 +0100
@@ -65,6 +65,8 @@
 ?	physdev_irq_status_query	physdev.h
 ?	physdev_manage_pci		physdev.h
 ?	physdev_manage_pci_ext		physdev.h
+?	physdev_pci_device		physdev.h
+?	physdev_pci_device_add		physdev.h
 ?	physdev_pci_mmcfg_reserved	physdev.h
 ?	physdev_unmap_pirq		physdev.h
 ?	physdev_restore_msi		physdev.h

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 21 09:44:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 21 Sep 2011 09:44:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6PuE-00030Y-EX; Wed, 21 Sep 2011 09:44:18 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6Pu9-0002zb-LJ
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 09:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1316623416!49005333!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8100 invoked from network); 21 Sep 2011 16:43:36 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Sep 2011 16:43:36 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6Pu6-0006xl-Fo
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 17:44:10 +0100
Message-Id: <E1R6Pu6-0006xl-Fo@xenbits.xen.org>
Date: Wed, 21 Sep 2011 17:44:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] convert more literal uses of
	cpumask_t to pointers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316301777 -3600
# Node ID 39d450853a3895fb50467997f029c698d5e5edb9
# Parent  cd730c6982998364eadb7ebbefd08b71d2cd8673
convert more literal uses of cpumask_t to pointers

This is particularly relevant as the number of CPUs to be supported
increases (as recently happened for the default thereof).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r cd730c698299 -r 39d450853a38 xen/arch/ia64/linux-xen/iosapic.c
--- a/xen/arch/ia64/linux-xen/iosapic.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/arch/ia64/linux-xen/iosapic.c	Sun Sep 18 00:22:57 2011 +0100
@@ -352,7 +352,7 @@
 
 
 static void
-iosapic_set_affinity (unsigned int irq, cpumask_t mask)
+iosapic_set_affinity (unsigned int irq, const cpumask_t *mask)
 {
 #ifdef CONFIG_SMP
 	unsigned long flags;
@@ -366,10 +366,10 @@
 	irq &= (~IA64_IRQ_REDIRECTED);
 	vec = irq_to_vector(irq);
 
-	if (cpus_empty(mask))
+	if (cpumask_empty(mask))
 		return;
 
-	dest = cpu_physical_id(first_cpu(mask));
+	dest = cpu_physical_id(cpumask_first(mask));
 
 	if (list_empty(&iosapic_intr_info[vec].rtes))
 		return;			/* not an IOSAPIC interrupt */
diff -r cd730c698299 -r 39d450853a38 xen/arch/ia64/linux-xen/mca.c
--- a/xen/arch/ia64/linux-xen/mca.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/arch/ia64/linux-xen/mca.c	Sun Sep 18 00:22:57 2011 +0100
@@ -1312,7 +1312,7 @@
 #ifndef XEN	/* XXX FIXME */
 			schedule_work(&cmc_disable_work);
 #else
-			cpumask_raise_softirq(cpu_online_map,
+			cpumask_raise_softirq(&cpu_online_map,
 			                      CMC_DISABLE_SOFTIRQ);
 #endif
 
@@ -1383,7 +1383,7 @@
 #ifndef XEN	/* XXX FIXME */
 			schedule_work(&cmc_enable_work);
 #else
-			cpumask_raise_softirq(cpu_online_map,
+			cpumask_raise_softirq(&cpu_online_map,
 			                      CMC_ENABLE_SOFTIRQ);
 #endif
 			cmc_polling_enabled = 0;
@@ -1904,7 +1904,7 @@
 #ifndef XEN	/* XXX FIXME */
 	schedule_work(&cmc_enable_work);
 #else
-	cpumask_raise_softirq(cpu_online_map, CMC_ENABLE_SOFTIRQ);
+	cpumask_raise_softirq(&cpu_online_map, CMC_ENABLE_SOFTIRQ);
 #endif
 
 	IA64_MCA_DEBUG("%s: CMCI/P setup and enabled.\n", __FUNCTION__);
diff -r cd730c698299 -r 39d450853a38 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/arch/x86/hpet.c	Sun Sep 18 00:22:57 2011 +0100
@@ -154,16 +154,16 @@
     return ret;
 }
 
-static void evt_do_broadcast(cpumask_t mask)
+static void evt_do_broadcast(cpumask_t *mask)
 {
     unsigned int cpu = smp_processor_id();
 
-    if ( cpu_test_and_clear(cpu, mask) )
+    if ( cpumask_test_and_clear_cpu(cpu, mask) )
         raise_softirq(TIMER_SOFTIRQ);
 
-    cpuidle_wakeup_mwait(&mask);
+    cpuidle_wakeup_mwait(mask);
 
-    if ( !cpus_empty(mask) )
+    if ( !cpumask_empty(mask) )
        cpumask_raise_softirq(mask, TIMER_SOFTIRQ);
 }
 
@@ -202,7 +202,7 @@
     }
 
     /* wakeup the cpus which have an expired event. */
-    evt_do_broadcast(mask);
+    evt_do_broadcast(&mask);
 
     if ( next_event != STIME_MAX )
     {
@@ -305,14 +305,14 @@
 {
 }
 
-static void hpet_msi_set_affinity(unsigned int irq, cpumask_t mask)
+static void hpet_msi_set_affinity(unsigned int irq, const cpumask_t *mask)
 {
     struct msi_msg msg;
     unsigned int dest;
     struct irq_desc * desc = irq_to_desc(irq);
     struct irq_cfg *cfg= desc->chip_data;
 
-    dest = set_desc_affinity(desc, &mask);
+    dest = set_desc_affinity(desc, mask);
     if (dest == BAD_APICID)
         return;
 
@@ -471,9 +471,7 @@
     if ( ch->cpu != cpu )
         return;
 
-    /* set irq affinity */
-    irq_desc[ch->irq].handler->
-        set_affinity(ch->irq, cpumask_of_cpu(ch->cpu));
+    hpet_msi_set_affinity(ch->irq, cpumask_of(ch->cpu));
 }
 
 static void hpet_detach_channel(unsigned int cpu,
@@ -495,9 +493,7 @@
     }
 
     ch->cpu = first_cpu(ch->cpumask);
-    /* set irq affinity */
-    irq_desc[ch->irq].handler->
-        set_affinity(ch->irq, cpumask_of_cpu(ch->cpu));
+    hpet_msi_set_affinity(ch->irq, cpumask_of(ch->cpu));
 }
 
 #include <asm/mc146818rtc.h>
diff -r cd730c698299 -r 39d450853a38 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Sun Sep 18 00:22:57 2011 +0100
@@ -697,13 +697,13 @@
 }
 
 static void
-set_ioapic_affinity_irq(unsigned int irq, const struct cpumask mask)
+set_ioapic_affinity_irq(unsigned int irq, const struct cpumask *mask)
 {
     struct irq_desc *desc;
 
     desc = irq_to_desc(irq);
 
-    set_ioapic_affinity_irq_desc(desc, &mask);
+    set_ioapic_affinity_irq_desc(desc, mask);
 }
 #endif /* CONFIG_SMP */
 
@@ -802,7 +802,7 @@
             irq = pin_2_irq(irq_entry, ioapic, pin);
             cfg = irq_cfg(irq);
             BUG_ON(cpus_empty(cfg->cpu_mask));
-            set_ioapic_affinity_irq(irq, cfg->cpu_mask);
+            set_ioapic_affinity_irq(irq, &cfg->cpu_mask);
         }
 
     }
@@ -2063,7 +2063,7 @@
     vector = FIRST_HIPRIORITY_VECTOR;
     clear_irq_vector(0);
 
-    if ((ret = bind_irq_vector(0, vector, mask_all)))
+    if ((ret = bind_irq_vector(0, vector, &mask_all)))
         printk(KERN_ERR"..IRQ0 is not set correctly with ioapic!!!, err:%d\n", ret);
     
     irq_desc[0].status &= ~IRQ_DISABLED;
diff -r cd730c698299 -r 39d450853a38 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/arch/x86/irq.c	Sun Sep 18 00:22:57 2011 +0100
@@ -108,7 +108,7 @@
     trace_var(event, 1, sizeof(d), &d);
 }
 
-static int __init __bind_irq_vector(int irq, int vector, cpumask_t cpu_mask)
+static int __init __bind_irq_vector(int irq, int vector, const cpumask_t *cpu_mask)
 {
     cpumask_t online_mask;
     int cpu;
@@ -117,7 +117,7 @@
     BUG_ON((unsigned)irq >= nr_irqs);
     BUG_ON((unsigned)vector >= NR_VECTORS);
 
-    cpus_and(online_mask, cpu_mask, cpu_online_map);
+    cpus_and(online_mask, *cpu_mask, cpu_online_map);
     if (cpus_empty(online_mask))
         return -EINVAL;
     if ((cfg->vector == vector) && cpus_equal(cfg->cpu_mask, online_mask))
@@ -140,7 +140,7 @@
     return 0;
 }
 
-int __init bind_irq_vector(int irq, int vector, cpumask_t cpu_mask)
+int __init bind_irq_vector(int irq, int vector, const cpumask_t *cpu_mask)
 {
     unsigned long flags;
     int ret;
@@ -583,7 +583,7 @@
      * For correct operation this depends on the caller masking the irqs.
      */
     if (likely(cpus_intersects(desc->pending_mask, cpu_online_map)))
-        desc->handler->set_affinity(irq, desc->pending_mask);
+        desc->handler->set_affinity(irq, &desc->pending_mask);
 
     cpus_clear(desc->pending_mask);
 }
@@ -1410,7 +1410,7 @@
         /* Attempt to bind the interrupt target to the correct CPU. */
         cpu_set(v->processor, cpumask);
         if ( !opt_noirqbalance && (desc->handler->set_affinity != NULL) )
-            desc->handler->set_affinity(irq, cpumask);
+            desc->handler->set_affinity(irq, &cpumask);
     }
     else if ( !will_share || !action->shareable )
     {
@@ -1964,7 +1964,7 @@
             desc->handler->disable(irq);
 
         if ( desc->handler->set_affinity )
-            desc->handler->set_affinity(irq, affinity);
+            desc->handler->set_affinity(irq, &affinity);
         else if ( !(warned++) )
             set_affinity = 0;
 
diff -r cd730c698299 -r 39d450853a38 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/arch/x86/msi.c	Sun Sep 18 00:22:57 2011 +0100
@@ -266,7 +266,7 @@
     }
 }
 
-void set_msi_affinity(unsigned int irq, cpumask_t mask)
+void set_msi_affinity(unsigned int irq, const cpumask_t *mask)
 {
     struct msi_msg msg;
     unsigned int dest;
@@ -274,7 +274,7 @@
     struct msi_desc *msi_desc = desc->msi_desc;
     struct irq_cfg *cfg = desc->chip_data;
 
-    dest = set_desc_affinity(desc, &mask);
+    dest = set_desc_affinity(desc, mask);
     if (dest == BAD_APICID || !msi_desc)
         return;
 
diff -r cd730c698299 -r 39d450853a38 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/arch/x86/time.c	Sun Sep 18 00:22:57 2011 +0100
@@ -195,7 +195,7 @@
 
     if ( !cpus_empty(mask) )
     {
-        cpumask_raise_softirq(mask, TIMER_SOFTIRQ);
+        cpumask_raise_softirq(&mask, TIMER_SOFTIRQ);
     }
 }
 
diff -r cd730c698299 -r 39d450853a38 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/common/keyhandler.c	Sun Sep 18 00:22:57 2011 +0100
@@ -207,10 +207,10 @@
     .desc = "reboot machine"
 };
 
-static void cpuset_print(char *set, int size, cpumask_t mask)
+static void cpuset_print(char *set, int size, const cpumask_t *mask)
 {
     *set++ = '{';
-    set += cpulist_scnprintf(set, size-2, mask);
+    set += cpulist_scnprintf(set, size-2, *mask);
     *set++ = '}';
     *set++ = '\0';
 }
@@ -244,7 +244,7 @@
     {
         unsigned int i;
         printk("General information for domain %u:\n", d->domain_id);
-        cpuset_print(tmpstr, sizeof(tmpstr), *d->domain_dirty_cpumask);
+        cpuset_print(tmpstr, sizeof(tmpstr), d->domain_dirty_cpumask);
         printk("    refcnt=%d dying=%d nr_pages=%d xenheap_pages=%d "
                "dirty_cpus=%s max_pages=%u\n",
                atomic_read(&d->refcnt), d->is_dying,
@@ -278,9 +278,9 @@
                    v->pause_flags, v->poll_evtchn,
                    vcpu_info(v, evtchn_upcall_pending),
                    vcpu_info(v, evtchn_upcall_mask));
-            cpuset_print(tmpstr, sizeof(tmpstr), *v->vcpu_dirty_cpumask);
+            cpuset_print(tmpstr, sizeof(tmpstr), v->vcpu_dirty_cpumask);
             printk("dirty_cpus=%s ", tmpstr);
-            cpuset_print(tmpstr, sizeof(tmpstr), *v->cpu_affinity);
+            cpuset_print(tmpstr, sizeof(tmpstr), v->cpu_affinity);
             printk("cpu_affinity=%s\n", tmpstr);
             arch_dump_vcpu_info(v);
             periodic_timer_print(tmpstr, sizeof(tmpstr), v->periodic_period);
diff -r cd730c698299 -r 39d450853a38 xen/common/rcupdate.c
--- a/xen/common/rcupdate.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/common/rcupdate.c	Sun Sep 18 00:22:57 2011 +0100
@@ -117,7 +117,7 @@
          */
         cpumask = rcp->cpumask;
         cpu_clear(rdp->cpu, cpumask);
-        cpumask_raise_softirq(cpumask, SCHEDULE_SOFTIRQ);
+        cpumask_raise_softirq(&cpumask, SCHEDULE_SOFTIRQ);
     }
 }
 
diff -r cd730c698299 -r 39d450853a38 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/common/sched_credit.c	Sun Sep 18 00:22:57 2011 +0100
@@ -310,7 +310,7 @@
 
     /* Send scheduler interrupts to designated CPUs */
     if ( !cpus_empty(mask) )
-        cpumask_raise_softirq(mask, SCHEDULE_SOFTIRQ);
+        cpumask_raise_softirq(&mask, SCHEDULE_SOFTIRQ);
 }
 
 static void
diff -r cd730c698299 -r 39d450853a38 xen/common/softirq.c
--- a/xen/common/softirq.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/common/softirq.c	Sun Sep 18 00:22:57 2011 +0100
@@ -68,15 +68,16 @@
     softirq_handlers[nr] = handler;
 }
 
-void cpumask_raise_softirq(cpumask_t mask, unsigned int nr)
+void cpumask_raise_softirq(const cpumask_t *mask, unsigned int nr)
 {
     int cpu;
+    cpumask_t send_mask = CPU_MASK_NONE;
 
-    for_each_cpu_mask(cpu, mask)
-        if ( test_and_set_bit(nr, &softirq_pending(cpu)) )
-            cpu_clear(cpu, mask);
+    for_each_cpu_mask(cpu, *mask)
+        if ( !test_and_set_bit(nr, &softirq_pending(cpu)) )
+            cpu_set(cpu, send_mask);
 
-    smp_send_event_check_mask(&mask);
+    smp_send_event_check_mask(&send_mask);
 }
 
 void cpu_raise_softirq(unsigned int cpu, unsigned int nr)
diff -r cd730c698299 -r 39d450853a38 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Sun Sep 18 00:22:57 2011 +0100
@@ -344,7 +344,7 @@
     set_iommu_event_log_control(iommu, IOMMU_CONTROL_ENABLED);
 }
 
-static void iommu_msi_set_affinity(unsigned int irq, cpumask_t mask)
+static void iommu_msi_set_affinity(unsigned int irq, const cpumask_t *mask)
 {
     struct msi_msg msg;
     unsigned int dest;
@@ -355,7 +355,7 @@
     u8 dev = PCI_SLOT(iommu->bdf & 0xff);
     u8 func = PCI_FUNC(iommu->bdf & 0xff);
 
-    dest = set_desc_affinity(desc, &mask);
+    dest = set_desc_affinity(desc, mask);
 
     if ( dest == BAD_APICID )
     {
@@ -591,7 +591,7 @@
     register_iommu_event_log_in_mmio_space(iommu);
     register_iommu_exclusion_range(iommu);
 
-    iommu_msi_set_affinity(iommu->irq, cpu_online_map);
+    iommu_msi_set_affinity(iommu->irq, &cpu_online_map);
     amd_iommu_msi_enable(iommu, IOMMU_CONTROL_ENABLED);
 
     set_iommu_command_buffer_control(iommu, IOMMU_CONTROL_ENABLED);
diff -r cd730c698299 -r 39d450853a38 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Sun Sep 18 00:22:57 2011 +0100
@@ -998,7 +998,7 @@
     ack_APIC_irq();
 }
 
-static void dma_msi_set_affinity(unsigned int irq, cpumask_t mask)
+static void dma_msi_set_affinity(unsigned int irq, const cpumask_t *mask)
 {
     struct msi_msg msg;
     unsigned int dest;
@@ -1009,7 +1009,7 @@
     struct irq_cfg *cfg = desc->chip_data;
 
 #ifdef CONFIG_X86
-    dest = set_desc_affinity(desc, &mask);
+    dest = set_desc_affinity(desc, mask);
     if (dest == BAD_APICID){
         dprintk(XENLOG_ERR VTDPREFIX, "Set iommu interrupt affinity error!\n");
         return;
@@ -1984,7 +1984,7 @@
         iommu = drhd->iommu;
 
         cfg = irq_cfg(iommu->irq);
-        dma_msi_set_affinity(iommu->irq, cfg->cpu_mask);
+        dma_msi_set_affinity(iommu->irq, &cfg->cpu_mask);
 
         clear_fault_bits(iommu);
 
diff -r cd730c698299 -r 39d450853a38 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/include/asm-x86/irq.h	Sun Sep 18 00:22:57 2011 +0100
@@ -176,7 +176,7 @@
 
 int __assign_irq_vector(int irq, struct irq_cfg *, const cpumask_t *);
 
-int bind_irq_vector(int irq, int vector, cpumask_t domain);
+int bind_irq_vector(int irq, int vector, const cpumask_t *);
 
 void irq_set_affinity(struct irq_desc *, const cpumask_t *mask);
 
diff -r cd730c698299 -r 39d450853a38 xen/include/asm-x86/msi.h
--- a/xen/include/asm-x86/msi.h	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/include/asm-x86/msi.h	Sun Sep 18 00:22:57 2011 +0100
@@ -78,7 +78,7 @@
 /* Helper functions */
 extern void mask_msi_irq(unsigned int irq);
 extern void unmask_msi_irq(unsigned int irq);
-extern void set_msi_affinity(unsigned int vector, cpumask_t mask);
+extern void set_msi_affinity(unsigned int vector, const cpumask_t *);
 extern int pci_enable_msi(struct msi_info *msi, struct msi_desc **desc);
 extern void pci_disable_msi(struct msi_desc *desc);
 extern void pci_cleanup_msi(struct pci_dev *pdev);
diff -r cd730c698299 -r 39d450853a38 xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/include/xen/irq.h	Sun Sep 18 00:22:57 2011 +0100
@@ -45,7 +45,7 @@
     void (*disable)(unsigned int irq);
     void (*ack)(unsigned int irq);
     void (*end)(unsigned int irq, u8 vector);
-    void (*set_affinity)(unsigned int irq, cpumask_t mask);
+    void (*set_affinity)(unsigned int irq, const cpumask_t *);
 };
 
 typedef const struct hw_interrupt_type hw_irq_controller;
@@ -176,11 +176,6 @@
     irq_desc[irq].affinity = *mask;
 }
 
-static inline void set_irq_info(int irq, cpumask_t mask)
-{
-    set_native_irq_info(irq, &mask);
-}
-
 unsigned int set_desc_affinity(struct irq_desc *, const cpumask_t *);
 
 #endif /* __XEN_IRQ_H__ */
diff -r cd730c698299 -r 39d450853a38 xen/include/xen/softirq.h
--- a/xen/include/xen/softirq.h	Sun Sep 18 00:21:23 2011 +0100
+++ b/xen/include/xen/softirq.h	Sun Sep 18 00:22:57 2011 +0100
@@ -27,7 +27,7 @@
 void open_softirq(int nr, softirq_handler handler);
 void softirq_init(void);
 
-void cpumask_raise_softirq(cpumask_t mask, unsigned int nr);
+void cpumask_raise_softirq(const cpumask_t *, unsigned int nr);
 void cpu_raise_softirq(unsigned int cpu, unsigned int nr);
 void raise_softirq(unsigned int nr);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 21 09:44:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 21 Sep 2011 09:44:28 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6PuO-00033Y-0z; Wed, 21 Sep 2011 09:44:28 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6PuA-0002zc-5W
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 09:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-21.messagelabs.com!1316623435!50820942!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22461 invoked from network); 21 Sep 2011 16:43:55 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Sep 2011 16:43:55 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6Pu7-0006yz-4L
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 17:44:11 +0100
Message-Id: <E1R6Pu7-0006yz-4L@xenbits.xen.org>
Date: Wed, 21 Sep 2011 17:44:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pass struct irq_desc * to
	set_affinity() IRQ accessors
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316301877 -3600
# Node ID 5f984c6735c96328f018d87b7e1b2025c3847d70
# Parent  39d450853a3895fb50467997f029c698d5e5edb9
pass struct irq_desc * to set_affinity() IRQ accessors

This is because the descriptor is generally more useful (with the IRQ
number being accessible in it if necessary) and going forward will
hopefully allow to remove all direct accesses to the IRQ descriptor
array, in turn making it possible to make this some other, more
efficient data structure.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 39d450853a38 -r 5f984c6735c9 xen/arch/ia64/linux-xen/iosapic.c
--- a/xen/arch/ia64/linux-xen/iosapic.c	Sun Sep 18 00:22:57 2011 +0100
+++ b/xen/arch/ia64/linux-xen/iosapic.c	Sun Sep 18 00:24:37 2011 +0100
@@ -352,18 +352,18 @@
 
 
 static void
-iosapic_set_affinity (unsigned int irq, const cpumask_t *mask)
+iosapic_set_affinity (struct irq_desc *desc, const cpumask_t *mask)
 {
 #ifdef CONFIG_SMP
 	unsigned long flags;
 	u32 high32, low32;
 	int dest, rte_index;
 	char __iomem *addr;
-	int redir = (irq & IA64_IRQ_REDIRECTED) ? 1 : 0;
+	int redir = (desc->irq & IA64_IRQ_REDIRECTED) ? 1 : 0;
+	unsigned int irq = desc->irq & ~IA64_IRQ_REDIRECTED;
 	ia64_vector vec;
 	struct iosapic_rte_info *rte;
 
-	irq &= (~IA64_IRQ_REDIRECTED);
 	vec = irq_to_vector(irq);
 
 	if (cpumask_empty(mask))
diff -r 39d450853a38 -r 5f984c6735c9 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Sun Sep 18 00:22:57 2011 +0100
+++ b/xen/arch/x86/hpet.c	Sun Sep 18 00:24:37 2011 +0100
@@ -258,24 +258,14 @@
     hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
 }
 
-static void hpet_msi_write(unsigned int irq, struct msi_msg *msg)
+static void hpet_msi_write(struct hpet_event_channel *ch, struct msi_msg *msg)
 {
-    unsigned int ch_idx = irq_to_channel(irq);
-    struct hpet_event_channel *ch = hpet_events + ch_idx;
-
-    BUG_ON(ch_idx >= num_hpets_used);
-
     hpet_write32(msg->data, HPET_Tn_ROUTE(ch->idx));
     hpet_write32(msg->address_lo, HPET_Tn_ROUTE(ch->idx) + 4);
 }
 
-static void hpet_msi_read(unsigned int irq, struct msi_msg *msg)
+static void hpet_msi_read(struct hpet_event_channel *ch, struct msi_msg *msg)
 {
-    unsigned int ch_idx = irq_to_channel(irq);
-    struct hpet_event_channel *ch = hpet_events + ch_idx;
-
-    BUG_ON(ch_idx >= num_hpets_used);
-
     msg->data = hpet_read32(HPET_Tn_ROUTE(ch->idx));
     msg->address_lo = hpet_read32(HPET_Tn_ROUTE(ch->idx) + 4);
     msg->address_hi = 0;
@@ -305,23 +295,22 @@
 {
 }
 
-static void hpet_msi_set_affinity(unsigned int irq, const cpumask_t *mask)
+static void hpet_msi_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
 {
     struct msi_msg msg;
     unsigned int dest;
-    struct irq_desc * desc = irq_to_desc(irq);
     struct irq_cfg *cfg= desc->chip_data;
 
     dest = set_desc_affinity(desc, mask);
     if (dest == BAD_APICID)
         return;
 
-    hpet_msi_read(irq, &msg);
+    hpet_msi_read(desc->action->dev_id, &msg);
     msg.data &= ~MSI_DATA_VECTOR_MASK;
     msg.data |= MSI_DATA_VECTOR(cfg->vector);
     msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
     msg.address_lo |= MSI_ADDR_DEST_ID(dest);
-    hpet_msi_write(irq, &msg);
+    hpet_msi_write(desc->action->dev_id, &msg);
 }
 
 /*
@@ -338,12 +327,12 @@
     .set_affinity   = hpet_msi_set_affinity,
 };
 
-static void __hpet_setup_msi_irq(unsigned int irq)
+static void __hpet_setup_msi_irq(struct irq_desc *desc)
 {
     struct msi_msg msg;
 
-    msi_compose_msg(irq, &msg);
-    hpet_msi_write(irq, &msg);
+    msi_compose_msg(desc->irq, &msg);
+    hpet_msi_write(desc->action->dev_id, &msg);
 }
 
 static int __init hpet_setup_msi_irq(unsigned int irq)
@@ -357,7 +346,7 @@
     if ( ret < 0 )
         return ret;
 
-    __hpet_setup_msi_irq(irq);
+    __hpet_setup_msi_irq(desc);
 
     return 0;
 }
@@ -471,7 +460,7 @@
     if ( ch->cpu != cpu )
         return;
 
-    hpet_msi_set_affinity(ch->irq, cpumask_of(ch->cpu));
+    hpet_msi_set_affinity(irq_to_desc(ch->irq), cpumask_of(ch->cpu));
 }
 
 static void hpet_detach_channel(unsigned int cpu,
@@ -493,7 +482,7 @@
     }
 
     ch->cpu = first_cpu(ch->cpumask);
-    hpet_msi_set_affinity(ch->irq, cpumask_of(ch->cpu));
+    hpet_msi_set_affinity(irq_to_desc(ch->irq), cpumask_of(ch->cpu));
 }
 
 #include <asm/mc146818rtc.h>
@@ -619,7 +608,7 @@
     for ( i = 0; i < n; i++ )
     {
         if ( hpet_events[i].irq >= 0 )
-            __hpet_setup_msi_irq(hpet_events[i].irq);
+            __hpet_setup_msi_irq(irq_to_desc(hpet_events[i].irq));
 
         /* set HPET Tn as oneshot */
         cfg = hpet_read32(HPET_Tn_CFG(hpet_events[i].idx));
diff -r 39d450853a38 -r 5f984c6735c9 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Sun Sep 18 00:22:57 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Sun Sep 18 00:24:37 2011 +0100
@@ -658,7 +658,7 @@
 }
 
 static void
-set_ioapic_affinity_irq_desc(struct irq_desc *desc, const cpumask_t *mask)
+set_ioapic_affinity_irq(struct irq_desc *desc, const cpumask_t *mask)
 {
     unsigned long flags;
     unsigned int dest;
@@ -695,16 +695,6 @@
     spin_unlock_irqrestore(&ioapic_lock, flags);
 
 }
-
-static void
-set_ioapic_affinity_irq(unsigned int irq, const struct cpumask *mask)
-{
-    struct irq_desc *desc;
-
-    desc = irq_to_desc(irq);
-
-    set_ioapic_affinity_irq_desc(desc, mask);
-}
 #endif /* CONFIG_SMP */
 
 /*
@@ -802,7 +792,7 @@
             irq = pin_2_irq(irq_entry, ioapic, pin);
             cfg = irq_cfg(irq);
             BUG_ON(cpus_empty(cfg->cpu_mask));
-            set_ioapic_affinity_irq(irq, &cfg->cpu_mask);
+            set_ioapic_affinity_irq(irq_to_desc(irq), &cfg->cpu_mask);
         }
 
     }
@@ -1780,7 +1770,7 @@
 
     if ((irq_desc[irq].status & IRQ_MOVE_PENDING) &&
        !io_apic_level_ack_pending(irq))
-        move_masked_irq(irq);
+        move_masked_irq(desc);
 
     if ( !(v & (1 << (i & 0x1f))) ) {
         spin_lock(&ioapic_lock);
@@ -1799,7 +1789,9 @@
     {
         if ( directed_eoi_enabled )
         {
-            if ( !(irq_desc[irq].status & (IRQ_DISABLED|IRQ_MOVE_PENDING)) )
+            struct irq_desc *desc = irq_to_desc(irq);
+
+            if ( !(desc->status & (IRQ_DISABLED|IRQ_MOVE_PENDING)) )
             {
                 eoi_IO_APIC_irq(irq);
                 return;
@@ -1807,9 +1799,9 @@
 
             mask_IO_APIC_irq(irq);
             eoi_IO_APIC_irq(irq);
-            if ( (irq_desc[irq].status & IRQ_MOVE_PENDING) &&
+            if ( (desc->status & IRQ_MOVE_PENDING) &&
                  !io_apic_level_ack_pending(irq) )
-                move_masked_irq(irq);
+                move_masked_irq(desc);
         }
 
         if ( !(irq_desc[irq].status & IRQ_DISABLED) )
diff -r 39d450853a38 -r 5f984c6735c9 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Sun Sep 18 00:22:57 2011 +0100
+++ b/xen/arch/x86/irq.c	Sun Sep 18 00:24:37 2011 +0100
@@ -558,10 +558,8 @@
     }
 }
 
-void move_masked_irq(int irq)
+void move_masked_irq(struct irq_desc *desc)
 {
-    struct irq_desc *desc = irq_to_desc(irq);
-
     if (likely(!(desc->status & IRQ_MOVE_PENDING)))
         return;
     
@@ -583,7 +581,7 @@
      * For correct operation this depends on the caller masking the irqs.
      */
     if (likely(cpus_intersects(desc->pending_mask, cpu_online_map)))
-        desc->handler->set_affinity(irq, &desc->pending_mask);
+        desc->handler->set_affinity(desc, &desc->pending_mask);
 
     cpus_clear(desc->pending_mask);
 }
@@ -599,7 +597,7 @@
         return;
 
     desc->handler->disable(irq);
-    move_masked_irq(irq);
+    move_masked_irq(desc);
     desc->handler->enable(irq);
 }
 
@@ -1410,7 +1408,7 @@
         /* Attempt to bind the interrupt target to the correct CPU. */
         cpu_set(v->processor, cpumask);
         if ( !opt_noirqbalance && (desc->handler->set_affinity != NULL) )
-            desc->handler->set_affinity(irq, &cpumask);
+            desc->handler->set_affinity(desc, &cpumask);
     }
     else if ( !will_share || !action->shareable )
     {
@@ -1964,7 +1962,7 @@
             desc->handler->disable(irq);
 
         if ( desc->handler->set_affinity )
-            desc->handler->set_affinity(irq, &affinity);
+            desc->handler->set_affinity(desc, &affinity);
         else if ( !(warned++) )
             set_affinity = 0;
 
diff -r 39d450853a38 -r 5f984c6735c9 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Sun Sep 18 00:22:57 2011 +0100
+++ b/xen/arch/x86/msi.c	Sun Sep 18 00:24:37 2011 +0100
@@ -266,11 +266,10 @@
     }
 }
 
-void set_msi_affinity(unsigned int irq, const cpumask_t *mask)
+void set_msi_affinity(struct irq_desc *desc, const cpumask_t *mask)
 {
     struct msi_msg msg;
     unsigned int dest;
-    struct irq_desc *desc = irq_to_desc(irq);
     struct msi_desc *msi_desc = desc->msi_desc;
     struct irq_cfg *cfg = desc->chip_data;
 
diff -r 39d450853a38 -r 5f984c6735c9 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Sun Sep 18 00:22:57 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Sun Sep 18 00:24:37 2011 +0100
@@ -344,12 +344,11 @@
     set_iommu_event_log_control(iommu, IOMMU_CONTROL_ENABLED);
 }
 
-static void iommu_msi_set_affinity(unsigned int irq, const cpumask_t *mask)
+static void iommu_msi_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
 {
     struct msi_msg msg;
     unsigned int dest;
-    struct amd_iommu *iommu = irq_to_iommu[irq];
-    struct irq_desc *desc = irq_to_desc(irq);
+    struct amd_iommu *iommu = desc->action->dev_id;
     struct irq_cfg *cfg = desc->chip_data;
     u8 bus = (iommu->bdf >> 8) & 0xff;
     u8 dev = PCI_SLOT(iommu->bdf & 0xff);
@@ -591,7 +590,7 @@
     register_iommu_event_log_in_mmio_space(iommu);
     register_iommu_exclusion_range(iommu);
 
-    iommu_msi_set_affinity(iommu->irq, &cpu_online_map);
+    iommu_msi_set_affinity(irq_to_desc(iommu->irq), &cpu_online_map);
     amd_iommu_msi_enable(iommu, IOMMU_CONTROL_ENABLED);
 
     set_iommu_command_buffer_control(iommu, IOMMU_CONTROL_ENABLED);
diff -r 39d450853a38 -r 5f984c6735c9 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Sun Sep 18 00:22:57 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Sun Sep 18 00:24:37 2011 +0100
@@ -998,14 +998,12 @@
     ack_APIC_irq();
 }
 
-static void dma_msi_set_affinity(unsigned int irq, const cpumask_t *mask)
+static void dma_msi_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
 {
     struct msi_msg msg;
     unsigned int dest;
     unsigned long flags;
-
-    struct iommu *iommu = irq_to_iommu[irq];
-    struct irq_desc *desc = irq_to_desc(irq);
+    struct iommu *iommu = desc->action->dev_id;
     struct irq_cfg *cfg = desc->chip_data;
 
 #ifdef CONFIG_X86
@@ -1984,7 +1982,7 @@
         iommu = drhd->iommu;
 
         cfg = irq_cfg(iommu->irq);
-        dma_msi_set_affinity(iommu->irq, &cfg->cpu_mask);
+        dma_msi_set_affinity(irq_to_desc(iommu->irq), &cfg->cpu_mask);
 
         clear_fault_bits(iommu);
 
diff -r 39d450853a38 -r 5f984c6735c9 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Sun Sep 18 00:22:57 2011 +0100
+++ b/xen/include/asm-x86/irq.h	Sun Sep 18 00:24:37 2011 +0100
@@ -172,7 +172,7 @@
 void __setup_vector_irq(int cpu);
 
 void move_native_irq(int irq);
-void move_masked_irq(int irq);
+void move_masked_irq(struct irq_desc *);
 
 int __assign_irq_vector(int irq, struct irq_cfg *, const cpumask_t *);
 
diff -r 39d450853a38 -r 5f984c6735c9 xen/include/asm-x86/msi.h
--- a/xen/include/asm-x86/msi.h	Sun Sep 18 00:22:57 2011 +0100
+++ b/xen/include/asm-x86/msi.h	Sun Sep 18 00:24:37 2011 +0100
@@ -78,7 +78,7 @@
 /* Helper functions */
 extern void mask_msi_irq(unsigned int irq);
 extern void unmask_msi_irq(unsigned int irq);
-extern void set_msi_affinity(unsigned int vector, const cpumask_t *);
+extern void set_msi_affinity(struct irq_desc *, const cpumask_t *);
 extern int pci_enable_msi(struct msi_info *msi, struct msi_desc **desc);
 extern void pci_disable_msi(struct msi_desc *desc);
 extern void pci_cleanup_msi(struct pci_dev *pdev);
diff -r 39d450853a38 -r 5f984c6735c9 xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Sun Sep 18 00:22:57 2011 +0100
+++ b/xen/include/xen/irq.h	Sun Sep 18 00:24:37 2011 +0100
@@ -33,6 +33,8 @@
 #define NEVER_ASSIGN_IRQ        (-2)
 #define FREE_TO_ASSIGN_IRQ      (-3)
 
+struct irq_desc;
+
 /*
  * Interrupt controller descriptor. This is all we need
  * to describe about the low-level hardware. 
@@ -45,7 +47,7 @@
     void (*disable)(unsigned int irq);
     void (*ack)(unsigned int irq);
     void (*end)(unsigned int irq, u8 vector);
-    void (*set_affinity)(unsigned int irq, const cpumask_t *);
+    void (*set_affinity)(struct irq_desc *, const cpumask_t *);
 };
 
 typedef const struct hw_interrupt_type hw_irq_controller;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 21 09:44:37 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 21 Sep 2011 09:44:37 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6PuX-00036d-2v; Wed, 21 Sep 2011 09:44:37 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6PuA-0002zd-Om
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 09:44:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1316623436!43379406!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11004 invoked from network); 21 Sep 2011 16:43:56 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Sep 2011 16:43:56 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6Pu7-0006zr-O9
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 17:44:11 +0100
Message-Id: <E1R6Pu7-0006zr-O9@xenbits.xen.org>
Date: Wed, 21 Sep 2011 17:44:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pass struct irq_desc * to all other
	IRQ accessors
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316301957 -3600
# Node ID 2dab09bcec8136a5962e71beed1f5dc06275a6b1
# Parent  5f984c6735c96328f018d87b7e1b2025c3847d70
pass struct irq_desc * to all other IRQ accessors

This is again because the descriptor is generally more useful (with
the IRQ number being accessible in it if necessary) and going forward
will hopefully allow to remove all direct accesses to the IRQ
descriptor array, in turn making it possible to make this some other,
more efficient data structure.

This additionally makes the .end() accessor optional, noting that in a
number of cases the functions were empty.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 5f984c6735c9 -r 2dab09bcec81 xen/arch/ia64/linux-xen/iosapic.c
--- a/xen/arch/ia64/linux-xen/iosapic.c	Sun Sep 18 00:24:37 2011 +0100
+++ b/xen/arch/ia64/linux-xen/iosapic.c	Sun Sep 18 00:25:57 2011 +0100
@@ -276,7 +276,7 @@
 }
 
 static void
-nop (unsigned int vector)
+nop (struct irq_desc *desc)
 {
 	/* do nothing... */
 }
@@ -300,13 +300,13 @@
 }
 
 static void
-mask_irq (unsigned int irq)
+mask_irq (struct irq_desc *desc)
 {
 	unsigned long flags;
 	char __iomem *addr;
 	u32 low32;
 	int rte_index;
-	ia64_vector vec = irq_to_vector(irq);
+	ia64_vector vec = irq_to_vector(desc->irq);
 	struct iosapic_rte_info *rte;
 
 	if (list_empty(&iosapic_intr_info[vec].rtes))
@@ -326,13 +326,13 @@
 }
 
 static void
-unmask_irq (unsigned int irq)
+unmask_irq (struct irq_desc *desc)
 {
 	unsigned long flags;
 	char __iomem *addr;
 	u32 low32;
 	int rte_index;
-	ia64_vector vec = irq_to_vector(irq);
+	ia64_vector vec = irq_to_vector(desc->irq);
 	struct iosapic_rte_info *rte;
 
 	if (list_empty(&iosapic_intr_info[vec].rtes))
@@ -408,19 +408,19 @@
  */
 
 static unsigned int
-iosapic_startup_level_irq (unsigned int irq)
+iosapic_startup_level_irq (struct irq_desc *desc)
 {
-	unmask_irq(irq);
+	unmask_irq(desc);
 	return 0;
 }
 
 static void
-iosapic_end_level_irq (unsigned int irq)
+iosapic_end_level_irq (struct irq_desc *desc)
 {
-	ia64_vector vec = irq_to_vector(irq);
+	ia64_vector vec = irq_to_vector(desc->irq);
 	struct iosapic_rte_info *rte;
 
-	move_irq(irq);
+	move_irq(desc->irq);
 	list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list)
 		iosapic_eoi(rte->addr, vec);
 }
diff -r 5f984c6735c9 -r 2dab09bcec81 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Sun Sep 18 00:24:37 2011 +0100
+++ b/xen/arch/x86/hpet.c	Sun Sep 18 00:25:57 2011 +0100
@@ -49,9 +49,6 @@
 
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
 
-static unsigned int *__read_mostly irq_channel;
-#define irq_to_channel(irq)   irq_channel[irq]
-
 unsigned long __read_mostly hpet_address;
 
 /*
@@ -232,26 +229,20 @@
     ch->event_handler(ch);
 }
 
-static void hpet_msi_unmask(unsigned int irq)
+static void hpet_msi_unmask(struct irq_desc *desc)
 {
     u32 cfg;
-    unsigned int ch_idx = irq_to_channel(irq);
-    struct hpet_event_channel *ch = hpet_events + ch_idx;
-
-    BUG_ON(ch_idx >= num_hpets_used);
+    struct hpet_event_channel *ch = desc->action->dev_id;
 
     cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
     cfg |= HPET_TN_FSB;
     hpet_write32(cfg, HPET_Tn_CFG(ch->idx));
 }
 
-static void hpet_msi_mask(unsigned int irq)
+static void hpet_msi_mask(struct irq_desc *desc)
 {
     u32 cfg;
-    unsigned int ch_idx = irq_to_channel(irq);
-    struct hpet_event_channel *ch = hpet_events + ch_idx;
-
-    BUG_ON(ch_idx >= num_hpets_used);
+    struct hpet_event_channel *ch = desc->action->dev_id;
 
     cfg = hpet_read32(HPET_Tn_CFG(ch->idx));
     cfg &= ~HPET_TN_FSB;
@@ -271,30 +262,21 @@
     msg->address_hi = 0;
 }
 
-static unsigned int hpet_msi_startup(unsigned int irq)
+static unsigned int hpet_msi_startup(struct irq_desc *desc)
 {
-    hpet_msi_unmask(irq);
+    hpet_msi_unmask(desc);
     return 0;
 }
 
-static void hpet_msi_shutdown(unsigned int irq)
+#define hpet_msi_shutdown hpet_msi_mask
+
+static void hpet_msi_ack(struct irq_desc *desc)
 {
-    hpet_msi_mask(irq);
-}
-
-static void hpet_msi_ack(unsigned int irq)
-{
-    struct irq_desc *desc = irq_to_desc(irq);
-
     irq_complete_move(desc);
-    move_native_irq(irq);
+    move_native_irq(desc);
     ack_APIC_irq();
 }
 
-static void hpet_msi_end(unsigned int irq, u8 vector)
-{
-}
-
 static void hpet_msi_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
 {
     struct msi_msg msg;
@@ -323,7 +305,6 @@
     .enable	    = hpet_msi_unmask,
     .disable    = hpet_msi_mask,
     .ack        = hpet_msi_ack,
-    .end        = hpet_msi_end,
     .set_affinity   = hpet_msi_set_affinity,
 };
 
@@ -335,14 +316,13 @@
     hpet_msi_write(desc->action->dev_id, &msg);
 }
 
-static int __init hpet_setup_msi_irq(unsigned int irq)
+static int __init hpet_setup_msi_irq(unsigned int irq, struct hpet_event_channel *ch)
 {
     int ret;
     irq_desc_t *desc = irq_to_desc(irq);
 
     desc->handler = &hpet_msi_type;
-    ret = request_irq(irq, hpet_interrupt_handler,
-                      0, "HPET", hpet_events + irq_channel[irq]);
+    ret = request_irq(irq, hpet_interrupt_handler, 0, "HPET", ch);
     if ( ret < 0 )
         return ret;
 
@@ -358,12 +338,9 @@
     if ( (irq = create_irq()) < 0 )
         return irq;
 
-    irq_channel[irq] = idx;
-
-    if ( hpet_setup_msi_irq(irq) )
+    if ( hpet_setup_msi_irq(irq, hpet_events + idx) )
     {
         destroy_irq(irq);
-        irq_channel[irq] = -1;
         return -EINVAL;
     }
 
@@ -511,11 +488,6 @@
     if ( hpet_rate == 0 )
         return;
 
-    irq_channel = xmalloc_array(unsigned int, nr_irqs);
-    BUG_ON(irq_channel == NULL);
-    for ( i = 0; i < nr_irqs; i++ )
-        irq_channel[i] = -1;
-
     cfg = hpet_read32(HPET_CFG);
 
     hpet_fsb_cap_lookup();
@@ -527,9 +499,6 @@
     }
     else
     {
-        xfree(irq_channel);
-        irq_channel = NULL;
-
         hpet_id = hpet_read32(HPET_ID);
         if ( !(hpet_id & HPET_ID_LEGSUP) )
             return;
diff -r 5f984c6735c9 -r 2dab09bcec81 xen/arch/x86/i8259.c
--- a/xen/arch/x86/i8259.c	Sun Sep 18 00:24:37 2011 +0100
+++ b/xen/arch/x86/i8259.c	Sun Sep 18 00:25:57 2011 +0100
@@ -85,18 +85,18 @@
 
 static DEFINE_SPINLOCK(i8259A_lock);
 
-static void mask_and_ack_8259A_irq(unsigned int irq);
+static void mask_and_ack_8259A_irq(struct irq_desc *);
 
-static unsigned int startup_8259A_irq(unsigned int irq)
+static unsigned int startup_8259A_irq(struct irq_desc *desc)
 {
-    enable_8259A_irq(irq);
+    enable_8259A_irq(desc);
     return 0; /* never anything pending */
 }
 
-static void end_8259A_irq(unsigned int irq, u8 vector)
+static void end_8259A_irq(struct irq_desc *desc, u8 vector)
 {
-    if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-        enable_8259A_irq(irq);
+    if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+        enable_8259A_irq(desc);
 }
 
 static struct hw_interrupt_type __read_mostly i8259A_irq_type = {
@@ -133,28 +133,28 @@
  */
 unsigned int __read_mostly io_apic_irqs;
 
-void disable_8259A_irq(unsigned int irq)
+void disable_8259A_irq(struct irq_desc *desc)
 {
-    unsigned int mask = 1 << irq;
+    unsigned int mask = 1 << desc->irq;
     unsigned long flags;
 
     spin_lock_irqsave(&i8259A_lock, flags);
     cached_irq_mask |= mask;
-    if (irq & 8)
+    if (desc->irq & 8)
         outb(cached_A1,0xA1);
     else
         outb(cached_21,0x21);
     spin_unlock_irqrestore(&i8259A_lock, flags);
 }
 
-void enable_8259A_irq(unsigned int irq)
+void enable_8259A_irq(struct irq_desc *desc)
 {
-    unsigned int mask = ~(1 << irq);
+    unsigned int mask = ~(1 << desc->irq);
     unsigned long flags;
 
     spin_lock_irqsave(&i8259A_lock, flags);
     cached_irq_mask &= mask;
-    if (irq & 8)
+    if (desc->irq & 8)
         outb(cached_A1,0xA1);
     else
         outb(cached_21,0x21);
@@ -226,9 +226,9 @@
  * first, _then_ send the EOI, and the order of EOI
  * to the two 8259s is important!
  */
-static void mask_and_ack_8259A_irq(unsigned int irq)
+static void mask_and_ack_8259A_irq(struct irq_desc *desc)
 {
-    unsigned int irqmask = 1 << irq;
+    unsigned int irqmask = 1 << desc->irq;
     unsigned long flags;
 
     spin_lock_irqsave(&i8259A_lock, flags);
@@ -252,15 +252,15 @@
     cached_irq_mask |= irqmask;
 
  handle_real_irq:
-    if (irq & 8) {
+    if (desc->irq & 8) {
         inb(0xA1);              /* DUMMY - (do we need this?) */
         outb(cached_A1,0xA1);
-        outb(0x60+(irq&7),0xA0);/* 'Specific EOI' to slave */
+        outb(0x60 + (desc->irq & 7), 0xA0);/* 'Specific EOI' to slave */
         outb(0x62,0x20);        /* 'Specific EOI' to master-IRQ2 */
     } else {
         inb(0x21);              /* DUMMY - (do we need this?) */
         outb(cached_21,0x21);
-        outb(0x60+irq,0x20);    /* 'Specific EOI' to master */
+        outb(0x60 + desc->irq, 0x20);/* 'Specific EOI' to master */
     }
     spin_unlock_irqrestore(&i8259A_lock, flags);
     return;
@@ -269,7 +269,7 @@
     /*
      * this is the slow path - should happen rarely.
      */
-    if (i8259A_irq_real(irq))
+    if (i8259A_irq_real(desc->irq))
         /*
          * oops, the IRQ _is_ in service according to the
          * 8259A - not spurious, go handle it.
@@ -283,7 +283,7 @@
          * lets ACK and report it. [once per IRQ]
          */
         if (!(spurious_irq_mask & irqmask)) {
-            printk("spurious 8259A interrupt: IRQ%d.\n", irq);
+            printk("spurious 8259A interrupt: IRQ%d.\n", desc->irq);
             spurious_irq_mask |= irqmask;
         }
         /*
diff -r 5f984c6735c9 -r 2dab09bcec81 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Sun Sep 18 00:24:37 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Sun Sep 18 00:25:57 2011 +0100
@@ -436,21 +436,21 @@
     __modify_IO_APIC_irq(irq, 0x00008000, 0);
 }
 
-static void mask_IO_APIC_irq (unsigned int irq)
+static void mask_IO_APIC_irq(struct irq_desc *desc)
 {
     unsigned long flags;
 
     spin_lock_irqsave(&ioapic_lock, flags);
-    __mask_IO_APIC_irq(irq);
+    __mask_IO_APIC_irq(desc->irq);
     spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
-static void unmask_IO_APIC_irq (unsigned int irq)
+static void unmask_IO_APIC_irq(struct irq_desc *desc)
 {
     unsigned long flags;
 
     spin_lock_irqsave(&ioapic_lock, flags);
-    __unmask_IO_APIC_irq(irq);
+    __unmask_IO_APIC_irq(desc->irq);
     spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
@@ -1145,7 +1145,7 @@
                 ioapic_register_intr(irq, IOAPIC_AUTO);
 
                 if (!apic && platform_legacy_irq(irq))
-                    disable_8259A_irq(irq);
+                    disable_8259A_irq(irq_to_desc(irq));
             }
             cfg = irq_cfg(irq);
             SET_DEST(entry.dest.dest32, entry.dest.logical.logical_dest,
@@ -1170,7 +1170,7 @@
 
     memset(&entry,0,sizeof(entry));
 
-    disable_8259A_irq(0);
+    disable_8259A_irq(irq_to_desc(0));
 
     /* mask LVT0 */
     apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
@@ -1199,7 +1199,7 @@
      */
     ioapic_write_entry(apic, pin, 0, entry);
 
-    enable_8259A_irq(0);
+    enable_8259A_irq(irq_to_desc(0));
 }
 
 static inline void UNEXPECTED_IO_APIC(void)
@@ -1627,18 +1627,18 @@
  * This is not complete - we should be able to fake
  * an edge even if it isn't on the 8259A...
  */
-static unsigned int startup_edge_ioapic_irq(unsigned int irq)
+static unsigned int startup_edge_ioapic_irq(struct irq_desc *desc)
 {
     int was_pending = 0;
     unsigned long flags;
 
     spin_lock_irqsave(&ioapic_lock, flags);
-    if (platform_legacy_irq(irq)) {
-        disable_8259A_irq(irq);
-        if (i8259A_irq_pending(irq))
+    if (platform_legacy_irq(desc->irq)) {
+        disable_8259A_irq(desc);
+        if (i8259A_irq_pending(desc->irq))
             was_pending = 1;
     }
-    __unmask_IO_APIC_irq(irq);
+    __unmask_IO_APIC_irq(desc->irq);
     spin_unlock_irqrestore(&ioapic_lock, flags);
 
     return was_pending;
@@ -1649,16 +1649,14 @@
  * interrupt for real. This prevents IRQ storms from unhandled
  * devices.
  */
-static void ack_edge_ioapic_irq(unsigned int irq)
+static void ack_edge_ioapic_irq(struct irq_desc *desc)
 {
-    struct irq_desc *desc = irq_to_desc(irq);
-    
     irq_complete_move(desc);
-    move_native_irq(irq);
+    move_native_irq(desc);
 
     if ((desc->status & (IRQ_PENDING | IRQ_DISABLED))
         == (IRQ_PENDING | IRQ_DISABLED))
-        mask_IO_APIC_irq(irq);
+        mask_IO_APIC_irq(desc);
     ack_APIC_irq();
 }
 
@@ -1676,9 +1674,9 @@
  * generic IRQ layer and by the fact that an unacked local
  * APIC does not accept IRQs.
  */
-static unsigned int startup_level_ioapic_irq (unsigned int irq)
+static unsigned int startup_level_ioapic_irq(struct irq_desc *desc)
 {
-    unmask_IO_APIC_irq(irq);
+    unmask_IO_APIC_irq(desc);
 
     return 0; /* don't check for pending */
 }
@@ -1726,11 +1724,10 @@
     return 0;
 }
 
-static void mask_and_ack_level_ioapic_irq (unsigned int irq)
+static void mask_and_ack_level_ioapic_irq(struct irq_desc *desc)
 {
     unsigned long v;
     int i;
-    struct irq_desc *desc = irq_to_desc(irq);
 
     irq_complete_move(desc);
 
@@ -1738,7 +1735,7 @@
         return;
 
     if ( !directed_eoi_enabled )
-        mask_IO_APIC_irq(irq);
+        mask_IO_APIC_irq(desc);
 
 /*
  * It appears there is an erratum which affects at least version 0x11
@@ -1759,7 +1756,7 @@
  * operation to prevent an edge-triggered interrupt escaping meanwhile.
  * The idea is from Manfred Spraul.  --macro
  */
-    i = IO_APIC_VECTOR(irq);
+    i = IO_APIC_VECTOR(desc->irq);
 
     v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
 
@@ -1768,19 +1765,19 @@
     if ( directed_eoi_enabled )
         return;
 
-    if ((irq_desc[irq].status & IRQ_MOVE_PENDING) &&
-       !io_apic_level_ack_pending(irq))
+    if ((desc->status & IRQ_MOVE_PENDING) &&
+       !io_apic_level_ack_pending(desc->irq))
         move_masked_irq(desc);
 
     if ( !(v & (1 << (i & 0x1f))) ) {
         spin_lock(&ioapic_lock);
-        __edge_IO_APIC_irq(irq);
-        __level_IO_APIC_irq(irq);
+        __edge_IO_APIC_irq(desc->irq);
+        __level_IO_APIC_irq(desc->irq);
         spin_unlock(&ioapic_lock);
     }
 }
 
-static void end_level_ioapic_irq (unsigned int irq, u8 vector)
+static void end_level_ioapic_irq(struct irq_desc *desc, u8 vector)
 {
     unsigned long v;
     int i;
@@ -1789,23 +1786,21 @@
     {
         if ( directed_eoi_enabled )
         {
-            struct irq_desc *desc = irq_to_desc(irq);
-
             if ( !(desc->status & (IRQ_DISABLED|IRQ_MOVE_PENDING)) )
             {
-                eoi_IO_APIC_irq(irq);
+                eoi_IO_APIC_irq(desc->irq);
                 return;
             }
 
-            mask_IO_APIC_irq(irq);
-            eoi_IO_APIC_irq(irq);
+            mask_IO_APIC_irq(desc);
+            eoi_IO_APIC_irq(desc->irq);
             if ( (desc->status & IRQ_MOVE_PENDING) &&
-                 !io_apic_level_ack_pending(irq) )
+                 !io_apic_level_ack_pending(desc->irq) )
                 move_masked_irq(desc);
         }
 
-        if ( !(irq_desc[irq].status & IRQ_DISABLED) )
-            unmask_IO_APIC_irq(irq);
+        if ( !(desc->status & IRQ_DISABLED) )
+            unmask_IO_APIC_irq(desc);
 
         return;
     }
@@ -1829,7 +1824,7 @@
  * operation to prevent an edge-triggered interrupt escaping meanwhile.
  * The idea is from Manfred Spraul.  --macro
  */
-    i = IO_APIC_VECTOR(irq);
+    i = IO_APIC_VECTOR(desc->irq);
 
     /* Manually EOI the old vector if we are moving to the new */
     if ( vector && i != vector )
@@ -1843,30 +1838,21 @@
 
     ack_APIC_irq();
 
-    if ((irq_desc[irq].status & IRQ_MOVE_PENDING) &&
-            !io_apic_level_ack_pending(irq))
-        move_native_irq(irq);
+    if ( (desc->status & IRQ_MOVE_PENDING) &&
+         !io_apic_level_ack_pending(desc->irq) )
+        move_native_irq(desc);
 
     if (!(v & (1 << (i & 0x1f)))) {
         spin_lock(&ioapic_lock);
-        __mask_IO_APIC_irq(irq);
-        __edge_IO_APIC_irq(irq);
-        __level_IO_APIC_irq(irq);
-        if ( !(irq_desc[irq].status & IRQ_DISABLED) )
-            __unmask_IO_APIC_irq(irq);
+        __mask_IO_APIC_irq(desc->irq);
+        __edge_IO_APIC_irq(desc->irq);
+        __level_IO_APIC_irq(desc->irq);
+        if ( !(desc->status & IRQ_DISABLED) )
+            __unmask_IO_APIC_irq(desc->irq);
         spin_unlock(&ioapic_lock);
     }
 }
 
-static void disable_edge_ioapic_irq(unsigned int irq)
-{
-}
-
-static void end_edge_ioapic_irq(unsigned int irq, u8 vector)
-{
-}
-
-
 /*
  * Level and edge triggered IO-APIC interrupts need different handling,
  * so we use two separate IRQ descriptors. Edge triggered IRQs can be
@@ -1878,11 +1864,10 @@
 static hw_irq_controller ioapic_edge_type = {
     .typename 	= "IO-APIC-edge",
     .startup 	= startup_edge_ioapic_irq,
-    .shutdown 	= disable_edge_ioapic_irq,
+    .shutdown 	= irq_shutdown_none,
     .enable 	= unmask_IO_APIC_irq,
-    .disable 	= disable_edge_ioapic_irq,
+    .disable 	= irq_disable_none,
     .ack 		= ack_edge_ioapic_irq,
-    .end 		= end_edge_ioapic_irq,
     .set_affinity 	= set_ioapic_affinity_irq,
 };
 
@@ -1897,26 +1882,24 @@
     .set_affinity 	= set_ioapic_affinity_irq,
 };
 
-static unsigned int startup_msi_irq(unsigned int irq)
+static unsigned int startup_msi_irq(struct irq_desc *desc)
 {
-    unmask_msi_irq(irq);
+    unmask_msi_irq(desc);
     return 0;
 }
 
-static void ack_msi_irq(unsigned int irq)
+static void ack_msi_irq(struct irq_desc *desc)
 {
-    struct irq_desc *desc = irq_to_desc(irq);
-
     irq_complete_move(desc);
-    move_native_irq(irq);
+    move_native_irq(desc);
 
     if ( msi_maskable_irq(desc->msi_desc) )
         ack_APIC_irq(); /* ACKTYPE_NONE */
 }
 
-static void end_msi_irq(unsigned int irq, u8 vector)
+static void end_msi_irq(struct irq_desc *desc, u8 vector)
 {
-    if ( !msi_maskable_irq(irq_desc[irq].msi_desc) )
+    if ( !msi_maskable_irq(desc->msi_desc) )
         ack_APIC_irq(); /* ACKTYPE_EOI */
 }
 
@@ -1946,7 +1929,7 @@
             make_8259A_irq(irq);
 }
 
-static void enable_lapic_irq(unsigned int irq)
+static void enable_lapic_irq(struct irq_desc *desc)
 {
     unsigned long v;
 
@@ -1954,7 +1937,7 @@
     apic_write_around(APIC_LVT0, v & ~APIC_LVT_MASKED);
 }
 
-static void disable_lapic_irq(unsigned int irq)
+static void disable_lapic_irq(struct irq_desc *desc)
 {
     unsigned long v;
 
@@ -1962,13 +1945,11 @@
     apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED);
 }
 
-static void ack_lapic_irq(unsigned int irq)
+static void ack_lapic_irq(struct irq_desc *desc)
 {
     ack_APIC_irq();
 }
 
-#define end_lapic_irq end_edge_ioapic_irq
-
 static hw_irq_controller lapic_irq_type = {
     .typename 	= "local-APIC-edge",
     .startup 	= NULL, /* startup_irq() not used for IRQ0 */
@@ -1976,7 +1957,6 @@
     .enable 	= enable_lapic_irq,
     .disable 	= disable_lapic_irq,
     .ack 		= ack_lapic_irq,
-    .end 		= end_lapic_irq,
 };
 
 /*
@@ -2051,7 +2031,7 @@
     /*
      * get/set the timer IRQ vector:
      */
-    disable_8259A_irq(0);
+    disable_8259A_irq(irq_to_desc(0));
     vector = FIRST_HIPRIORITY_VECTOR;
     clear_irq_vector(0);
 
@@ -2071,7 +2051,7 @@
     init_8259A(1);
     /* XEN: Ripped out the legacy missed-tick logic, so below is not needed. */
     /*timer_ack = 1;*/
-    /*enable_8259A_irq(0);*/
+    /*enable_8259A_irq(irq_to_desc(0));*/
 
     pin1  = find_isa_irq_pin(0, mp_INT);
     apic1 = find_isa_irq_apic(0, mp_INT);
@@ -2085,7 +2065,7 @@
         /*
          * Ok, does IRQ0 through the IOAPIC work?
          */
-        unmask_IO_APIC_irq(0);
+        unmask_IO_APIC_irq(irq_to_desc(0));
         if (timer_irq_works()) {
             local_irq_restore(flags);
             return;
@@ -2125,10 +2105,10 @@
 
     printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
 
-    disable_8259A_irq(0);
+    disable_8259A_irq(irq_to_desc(0));
     irq_desc[0].handler = &lapic_irq_type;
     apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector);	/* Fixed mode */
-    enable_8259A_irq(0);
+    enable_8259A_irq(irq_to_desc(0));
 
     if (timer_irq_works()) {
         local_irq_restore(flags);
@@ -2401,7 +2381,7 @@
     ioapic_register_intr(irq, edge_level);
 
     if (!ioapic && platform_legacy_irq(irq))
-        disable_8259A_irq(irq);
+        disable_8259A_irq(desc);
 
     spin_lock_irqsave(&ioapic_lock, flags);
     __ioapic_write_entry(ioapic, pin, 0, entry);
@@ -2410,7 +2390,7 @@
 
     spin_lock(&desc->lock);
     if (!(desc->status & (IRQ_DISABLED | IRQ_GUEST)))
-        desc->handler->startup(irq);
+        desc->handler->startup(desc);
     spin_unlock_irqrestore(&desc->lock, flags);
 
     return 0;
diff -r 5f984c6735c9 -r 2dab09bcec81 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Sun Sep 18 00:24:37 2011 +0100
+++ b/xen/arch/x86/irq.c	Sun Sep 18 00:25:57 2011 +0100
@@ -193,7 +193,7 @@
     spin_lock_irqsave(&desc->lock, flags);
     desc->status  |= IRQ_DISABLED;
     desc->status  &= ~IRQ_GUEST;
-    desc->handler->shutdown(irq);
+    desc->handler->shutdown(desc);
     action = desc->action;
     desc->action  = NULL;
     desc->msi_desc = NULL;
@@ -348,25 +348,20 @@
 
 void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs) { }
 
-static void enable_none(unsigned int vector) { }
-static void end_none(unsigned int irq, u8 vector) { }
-static unsigned int startup_none(unsigned int vector) { return 0; }
-static void disable_none(unsigned int vector) { }
-static void ack_none(unsigned int irq)
+void irq_actor_none(struct irq_desc *desc) { }
+unsigned int irq_startup_none(struct irq_desc *desc) { return 0; }
+static void ack_none(struct irq_desc *desc)
 {
-    ack_bad_irq(irq);
+    ack_bad_irq(desc->irq);
 }
 
-#define shutdown_none   disable_none
-
 hw_irq_controller no_irq_type = {
     "none",
-    startup_none,
-    shutdown_none,
-    enable_none,
-    disable_none,
+    irq_startup_none,
+    irq_shutdown_none,
+    irq_enable_none,
+    irq_disable_none,
     ack_none,
-    end_none
 };
 
 static vmask_t *irq_get_used_vector_mask(int irq)
@@ -586,19 +581,17 @@
     cpus_clear(desc->pending_mask);
 }
 
-void move_native_irq(int irq)
+void move_native_irq(struct irq_desc *desc)
 {
-    struct irq_desc *desc = irq_to_desc(irq);
-
     if (likely(!(desc->status & IRQ_MOVE_PENDING)))
         return;
 
     if (unlikely(desc->status & IRQ_DISABLED))
         return;
 
-    desc->handler->disable(irq);
+    desc->handler->disable(desc);
     move_masked_irq(desc);
-    desc->handler->enable(irq);
+    desc->handler->enable(desc);
 }
 
 /* For re-setting irq interrupt affinity for specific irq */
@@ -655,7 +648,7 @@
     desc = irq_to_desc(irq);
 
     spin_lock(&desc->lock);
-    desc->handler->ack(irq);
+    desc->handler->ack(desc);
 
     if ( likely(desc->status & IRQ_GUEST) )
     {
@@ -665,7 +658,7 @@
             s_time_t now = NOW();
             if ( now < (desc->rl_quantum_start + MILLISECS(10)) )
             {
-                desc->handler->disable(irq);
+                desc->handler->disable(desc);
                 /*
                  * If handler->disable doesn't actually mask the interrupt, a 
                  * disabled irq still can fire. This check also avoids possible 
@@ -717,7 +710,8 @@
     desc->status &= ~IRQ_INPROGRESS;
 
  out:
-    desc->handler->end(irq, regs->entry_vector);
+    if ( desc->handler->end )
+        desc->handler->end(desc, regs->entry_vector);
  out_no_end:
     spin_unlock(&desc->lock);
     irq_exit();
@@ -734,7 +728,7 @@
     list_for_each_entry_safe ( desc, tmp, &irq_ratelimit_list, rl_link )
     {
         spin_lock(&desc->lock);
-        desc->handler->enable(desc->irq);
+        desc->handler->enable(desc);
         list_del(&desc->rl_link);
         INIT_LIST_HEAD(&desc->rl_link);
         spin_unlock(&desc->lock);
@@ -797,7 +791,7 @@
     action = desc->action;
     desc->action  = NULL;
     desc->status |= IRQ_DISABLED;
-    desc->handler->shutdown(irq);
+    desc->handler->shutdown(desc);
     spin_unlock_irqrestore(&desc->lock,flags);
 
     /* Wait to make sure it's not being used on another CPU */
@@ -824,7 +818,7 @@
 
     desc->action  = new;
     desc->status &= ~IRQ_DISABLED;
-    desc->handler->startup(irq);
+    desc->handler->startup(desc);
 
     spin_unlock_irqrestore(&desc->lock,flags);
 
@@ -915,7 +909,8 @@
     switch ( action->ack_type )
     {
     case ACKTYPE_UNMASK:
-        desc->handler->end(irq, 0);
+        if ( desc->handler->end )
+            desc->handler->end(desc, 0);
         break;
     case ACKTYPE_EOI:
         cpu_eoi_map = action->cpu_eoi_map;
@@ -943,7 +938,8 @@
         /* An interrupt may slip through while freeing an ACKTYPE_EOI irq. */
         ASSERT(action->ack_type == ACKTYPE_EOI);
         ASSERT(desc->status & IRQ_DISABLED);
-        desc->handler->end(irq, vector);
+        if ( desc->handler->end )
+            desc->handler->end(desc, vector);
         return;
     }
 
@@ -1157,7 +1153,8 @@
         ASSERT(irq > 0);
         desc = irq_to_desc(irq);
         spin_lock(&desc->lock);
-        desc->handler->end(irq, peoi[sp].vector);
+        if ( desc->handler->end )
+            desc->handler->end(desc, peoi[sp].vector);
         spin_unlock(&desc->lock);
     }
 
@@ -1235,7 +1232,8 @@
     if ( action->ack_type == ACKTYPE_UNMASK )
     {
         ASSERT(cpus_empty(action->cpu_eoi_map));
-        desc->handler->end(irq, 0);
+        if ( desc->handler->end )
+            desc->handler->end(desc, 0);
         spin_unlock_irq(&desc->lock);
         return;
     }
@@ -1403,7 +1401,7 @@
 
         desc->status |= IRQ_GUEST;
         desc->status &= ~IRQ_DISABLED;
-        desc->handler->startup(irq);
+        desc->handler->startup(desc);
 
         /* Attempt to bind the interrupt target to the correct CPU. */
         cpu_set(v->processor, cpumask);
@@ -1487,8 +1485,9 @@
     {
     case ACKTYPE_UNMASK:
         if ( test_and_clear_bool(pirq->masked) &&
-             (--action->in_flight == 0) )
-            desc->handler->end(irq, 0);
+             (--action->in_flight == 0) &&
+             desc->handler->end )
+                desc->handler->end(desc, 0);
         break;
     case ACKTYPE_EOI:
         /* NB. If #guests == 0 then we clear the eoi_map later on. */
@@ -1517,7 +1516,7 @@
 
     /* Disabling IRQ before releasing the desc_lock avoids an IRQ storm. */
     desc->status |= IRQ_DISABLED;
-    desc->handler->disable(irq);
+    desc->handler->disable(desc);
 
     /*
      * Mark any remaining pending EOIs as ready to flush.
@@ -1539,7 +1538,7 @@
 
     desc->action = NULL;
     desc->status &= ~(IRQ_GUEST|IRQ_INPROGRESS);
-    desc->handler->shutdown(irq);
+    desc->handler->shutdown(desc);
 
     /* Caller frees the old guest descriptor block. */
     return action;
@@ -1959,7 +1958,7 @@
         }
 
         if ( desc->handler->disable )
-            desc->handler->disable(irq);
+            desc->handler->disable(desc);
 
         if ( desc->handler->set_affinity )
             desc->handler->set_affinity(desc, &affinity);
@@ -1967,7 +1966,7 @@
             set_affinity = 0;
 
         if ( desc->handler->enable )
-            desc->handler->enable(irq);
+            desc->handler->enable(desc);
 
         spin_unlock(&desc->lock);
 
diff -r 5f984c6735c9 -r 2dab09bcec81 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Sun Sep 18 00:24:37 2011 +0100
+++ b/xen/arch/x86/msi.c	Sun Sep 18 00:25:57 2011 +0100
@@ -336,11 +336,11 @@
            || entry->msi_attrib.maskbit;
 }
 
-static void msi_set_mask_bit(unsigned int irq, int flag)
+static void msi_set_mask_bit(struct irq_desc *desc, int flag)
 {
-    struct msi_desc *entry = irq_desc[irq].msi_desc;
+    struct msi_desc *entry = desc->msi_desc;
 
-    ASSERT(spin_is_locked(&irq_desc[irq].lock));
+    ASSERT(spin_is_locked(&desc->lock));
     BUG_ON(!entry || !entry->dev);
     switch (entry->msi_attrib.type) {
     case PCI_CAP_ID_MSI:
@@ -387,14 +387,14 @@
     return -1;
 }
 
-void mask_msi_irq(unsigned int irq)
+void mask_msi_irq(struct irq_desc *desc)
 {
-    msi_set_mask_bit(irq, 1);
+    msi_set_mask_bit(desc, 1);
 }
 
-void unmask_msi_irq(unsigned int irq)
+void unmask_msi_irq(struct irq_desc *desc)
 {
-    msi_set_mask_bit(irq, 0);
+    msi_set_mask_bit(desc, 0);
 }
 
 static struct msi_desc* alloc_msi_entry(void)
@@ -978,7 +978,7 @@
 
         write_msi_msg(entry, &entry->msg);
 
-        msi_set_mask_bit(irq, entry->msi_attrib.masked);
+        msi_set_mask_bit(desc, entry->msi_attrib.masked);
 
         if ( entry->msi_attrib.type == PCI_CAP_ID_MSI )
             msi_set_enable(pdev, 1);
diff -r 5f984c6735c9 -r 2dab09bcec81 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Sun Sep 18 00:24:37 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Sun Sep 18 00:25:57 2011 +0100
@@ -29,7 +29,6 @@
 #include <asm-x86/fixmap.h>
 #include <mach_apic.h>
 
-static struct amd_iommu **__read_mostly irq_to_iommu;
 static int __initdata nr_amd_iommus;
 
 unsigned short ivrs_bdf_entries;
@@ -403,10 +402,10 @@
         iommu->msi_cap + PCI_MSI_FLAGS, control);
 }
 
-static void iommu_msi_unmask(unsigned int irq)
+static void iommu_msi_unmask(struct irq_desc *desc)
 {
     unsigned long flags;
-    struct amd_iommu *iommu = irq_to_iommu[irq];
+    struct amd_iommu *iommu = desc->action->dev_id;
 
     /* FIXME: do not support mask bits at the moment */
     if ( iommu->maskbit )
@@ -417,11 +416,10 @@
     spin_unlock_irqrestore(&iommu->lock, flags);
 }
 
-static void iommu_msi_mask(unsigned int irq)
+static void iommu_msi_mask(struct irq_desc *desc)
 {
     unsigned long flags;
-    struct amd_iommu *iommu = irq_to_iommu[irq];
-    struct irq_desc *desc = irq_to_desc(irq);
+    struct amd_iommu *iommu = desc->action->dev_id;
 
     irq_complete_move(desc);
 
@@ -434,15 +432,15 @@
     spin_unlock_irqrestore(&iommu->lock, flags);
 }
 
-static unsigned int iommu_msi_startup(unsigned int irq)
+static unsigned int iommu_msi_startup(struct irq_desc *desc)
 {
-    iommu_msi_unmask(irq);
+    iommu_msi_unmask(desc);
     return 0;
 }
 
-static void iommu_msi_end(unsigned int irq, u8 vector)
+static void iommu_msi_end(struct irq_desc *desc, u8 vector)
 {
-    iommu_msi_unmask(irq);
+    iommu_msi_unmask(desc);
     ack_APIC_irq();
 }
 
@@ -557,13 +555,11 @@
     }
     
     irq_desc[irq].handler = &iommu_msi_type;
-    irq_to_iommu[irq] = iommu;
     ret = request_irq(irq, amd_iommu_page_fault, 0,
                              "amd_iommu", iommu);
     if ( ret )
     {
         irq_desc[irq].handler = &no_irq_type;
-        irq_to_iommu[irq] = NULL;
         destroy_irq(irq);
         AMD_IOMMU_DEBUG("can't request irq\n");
         return 0;
@@ -728,13 +724,6 @@
         ivrs_mappings = NULL;
     }
 
-    /* free irq_to_iommu[] */
-    if ( irq_to_iommu )
-    {
-        xfree(irq_to_iommu);
-        irq_to_iommu = NULL;
-    }
-
     iommu_enabled = 0;
     iommu_passthrough = 0;
     iommu_intremap = 0;
@@ -838,11 +827,6 @@
 
     BUG_ON( !iommu_found() );
 
-    irq_to_iommu = xmalloc_array(struct amd_iommu *, nr_irqs);
-    if ( irq_to_iommu == NULL )
-        goto error_out;
-    memset(irq_to_iommu, 0, nr_irqs * sizeof(struct iommu*));
-
     ivrs_bdf_entries = amd_iommu_get_ivrs_dev_entries();
 
     if ( !ivrs_bdf_entries )
diff -r 5f984c6735c9 -r 2dab09bcec81 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Sun Sep 18 00:24:37 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Sun Sep 18 00:25:57 2011 +0100
@@ -829,7 +829,6 @@
     }
 }
 
-static struct iommu **irq_to_iommu;
 static int iommu_page_fault_do_one(struct iommu *iommu, int type,
                                    u8 fault_reason, u16 source_id, u64 addr)
 {
@@ -961,9 +960,9 @@
     }
 }
 
-static void dma_msi_unmask(unsigned int irq)
+static void dma_msi_unmask(struct irq_desc *desc)
 {
-    struct iommu *iommu = irq_to_iommu[irq];
+    struct iommu *iommu = desc->action->dev_id;
     unsigned long flags;
 
     /* unmask it */
@@ -972,11 +971,10 @@
     spin_unlock_irqrestore(&iommu->register_lock, flags);
 }
 
-static void dma_msi_mask(unsigned int irq)
+static void dma_msi_mask(struct irq_desc *desc)
 {
     unsigned long flags;
-    struct iommu *iommu = irq_to_iommu[irq];
-    struct irq_desc *desc = irq_to_desc(irq);
+    struct iommu *iommu = desc->action->dev_id;
 
     irq_complete_move(desc);
 
@@ -986,15 +984,15 @@
     spin_unlock_irqrestore(&iommu->register_lock, flags);
 }
 
-static unsigned int dma_msi_startup(unsigned int irq)
+static unsigned int dma_msi_startup(struct irq_desc *desc)
 {
-    dma_msi_unmask(irq);
+    dma_msi_unmask(desc);
     return 0;
 }
 
-static void dma_msi_end(unsigned int irq, u8 vector)
+static void dma_msi_end(struct irq_desc *desc, u8 vector)
 {
-    dma_msi_unmask(irq);
+    dma_msi_unmask(desc);
     ack_APIC_irq();
 }
 
@@ -1071,7 +1069,6 @@
     }
 
     irq_desc[irq].handler = &dma_msi_type;
-    irq_to_iommu[irq] = iommu;
 #ifdef CONFIG_X86
     ret = request_irq(irq, iommu_page_fault, 0, "dmar", iommu);
 #else
@@ -1080,7 +1077,6 @@
     if ( ret )
     {
         irq_desc[irq].handler = &no_irq_type;
-        irq_to_iommu[irq] = NULL;
         destroy_irq(irq);
         dprintk(XENLOG_ERR VTDPREFIX, "IOMMU: can't request irq\n");
         return ret;
@@ -2091,13 +2087,6 @@
 
     platform_quirks_init();
 
-    irq_to_iommu = xmalloc_array(struct iommu*, nr_irqs);
-    BUG_ON(!irq_to_iommu);
-    memset(irq_to_iommu, 0, nr_irqs * sizeof(struct iommu*));
-
-    if(!irq_to_iommu)
-        return -ENOMEM;
-
     /* We enable the following features only if they are supported by all VT-d
      * engines: Snoop Control, DMA passthrough, Queued Invalidation and
      * Interrupt Remapping.
diff -r 5f984c6735c9 -r 2dab09bcec81 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Sun Sep 18 00:24:37 2011 +0100
+++ b/xen/include/asm-x86/irq.h	Sun Sep 18 00:25:57 2011 +0100
@@ -27,6 +27,8 @@
     DECLARE_BITMAP(_bits,NR_VECTORS);
 } vmask_t;
 
+struct irq_desc;
+
 struct irq_cfg {
         s16 vector;                  /* vector itself is only 8 bits, */
         s16 old_vector;              /* but we use -1 for unassigned  */
@@ -107,8 +109,8 @@
 
 asmlinkage void do_IRQ(struct cpu_user_regs *regs);
 
-void disable_8259A_irq(unsigned int irq);
-void enable_8259A_irq(unsigned int irq);
+void disable_8259A_irq(struct irq_desc *);
+void enable_8259A_irq(struct irq_desc *);
 int i8259A_irq_pending(unsigned int irq);
 void mask_8259A(void);
 void unmask_8259A(void);
@@ -161,7 +163,6 @@
 int create_irq(void);
 void destroy_irq(unsigned int irq);
 
-struct irq_desc;
 extern void irq_complete_move(struct irq_desc *);
 
 extern struct irq_desc *irq_desc;
@@ -171,7 +172,7 @@
 
 void __setup_vector_irq(int cpu);
 
-void move_native_irq(int irq);
+void move_native_irq(struct irq_desc *);
 void move_masked_irq(struct irq_desc *);
 
 int __assign_irq_vector(int irq, struct irq_cfg *, const cpumask_t *);
diff -r 5f984c6735c9 -r 2dab09bcec81 xen/include/asm-x86/msi.h
--- a/xen/include/asm-x86/msi.h	Sun Sep 18 00:24:37 2011 +0100
+++ b/xen/include/asm-x86/msi.h	Sun Sep 18 00:25:57 2011 +0100
@@ -76,8 +76,8 @@
 
 struct msi_desc;
 /* Helper functions */
-extern void mask_msi_irq(unsigned int irq);
-extern void unmask_msi_irq(unsigned int irq);
+extern void mask_msi_irq(struct irq_desc *);
+extern void unmask_msi_irq(struct irq_desc *);
 extern void set_msi_affinity(struct irq_desc *, const cpumask_t *);
 extern int pci_enable_msi(struct msi_info *msi, struct msi_desc **desc);
 extern void pci_disable_msi(struct msi_desc *desc);
diff -r 5f984c6735c9 -r 2dab09bcec81 xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Sun Sep 18 00:24:37 2011 +0100
+++ b/xen/include/xen/irq.h	Sun Sep 18 00:25:57 2011 +0100
@@ -41,12 +41,12 @@
  */
 struct hw_interrupt_type {
     const char *typename;
-    unsigned int (*startup)(unsigned int irq);
-    void (*shutdown)(unsigned int irq);
-    void (*enable)(unsigned int irq);
-    void (*disable)(unsigned int irq);
-    void (*ack)(unsigned int irq);
-    void (*end)(unsigned int irq, u8 vector);
+    unsigned int (*startup)(struct irq_desc *);
+    void (*shutdown)(struct irq_desc *);
+    void (*enable)(struct irq_desc *);
+    void (*disable)(struct irq_desc *);
+    void (*ack)(struct irq_desc *);
+    void (*end)(struct irq_desc *, u8 vector);
     void (*set_affinity)(struct irq_desc *, const cpumask_t *);
 };
 
@@ -133,6 +133,11 @@
 
 extern hw_irq_controller no_irq_type;
 extern void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs);
+extern unsigned int irq_startup_none(struct irq_desc *);
+extern void irq_actor_none(struct irq_desc *);
+#define irq_shutdown_none irq_actor_none
+#define irq_disable_none irq_actor_none
+#define irq_enable_none irq_actor_none
 
 struct domain;
 struct vcpu;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 21 09:44:54 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 21 Sep 2011 09:44:54 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6Pun-0003BJ-V0; Wed, 21 Sep 2011 09:44:53 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6PuB-0002ze-MW
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 09:44:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1316623452!28563819!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22920 invoked from network); 21 Sep 2011 16:44:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Sep 2011 16:44:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6Pu8-00070f-9m
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 17:44:12 +0100
Message-Id: <E1R6Pu8-00070f-9m@xenbits.xen.org>
Date: Wed, 21 Sep 2011 17:44:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: split MSI IRQ chip
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316302012 -3600
# Node ID a422e2a4451e16dc791b293f41966b842fa4781d
# Parent  2dab09bcec8136a5962e71beed1f5dc06275a6b1
x86: split MSI IRQ chip

With the .end() accessor having become optional and noting that
several of the accessors' behavior really depends on the result of
msi_maskable_irq(), the splits the MSI IRQ chip type into two - one
for the maskable ones, and the other for the (MSI only) non-maskable
ones.

At once the implementation of those methods gets moved from io_apic.c
to msi.c.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 2dab09bcec81 -r a422e2a4451e xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Sun Sep 18 00:25:57 2011 +0100
+++ b/xen/arch/x86/hpet.c	Sun Sep 18 00:26:52 2011 +0100
@@ -312,7 +312,7 @@
 {
     struct msi_msg msg;
 
-    msi_compose_msg(desc->irq, &msg);
+    msi_compose_msg(desc, &msg);
     hpet_msi_write(desc->action->dev_id, &msg);
 }
 
diff -r 2dab09bcec81 -r a422e2a4451e xen/arch/x86/hvm/vmsi.c
--- a/xen/arch/x86/hvm/vmsi.c	Sun Sep 18 00:25:57 2011 +0100
+++ b/xen/arch/x86/hvm/vmsi.c	Sun Sep 18 00:26:52 2011 +0100
@@ -382,7 +382,7 @@
         return r;
     }
 
-    if ( irq_desc->handler != &pci_msi_type )
+    if ( !irq_desc->msi_desc )
         goto out;
 
     msi_desc = irq_desc->msi_desc;
@@ -426,7 +426,7 @@
     if ( !irq_desc )
         return;
 
-    if ( irq_desc->handler != &pci_msi_type )
+    if ( !irq_desc->msi_desc )
         goto out;
 
     msi_desc = irq_desc->msi_desc;
diff -r 2dab09bcec81 -r a422e2a4451e xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Sun Sep 18 00:25:57 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Sun Sep 18 00:26:52 2011 +0100
@@ -1882,44 +1882,6 @@
     .set_affinity 	= set_ioapic_affinity_irq,
 };
 
-static unsigned int startup_msi_irq(struct irq_desc *desc)
-{
-    unmask_msi_irq(desc);
-    return 0;
-}
-
-static void ack_msi_irq(struct irq_desc *desc)
-{
-    irq_complete_move(desc);
-    move_native_irq(desc);
-
-    if ( msi_maskable_irq(desc->msi_desc) )
-        ack_APIC_irq(); /* ACKTYPE_NONE */
-}
-
-static void end_msi_irq(struct irq_desc *desc, u8 vector)
-{
-    if ( !msi_maskable_irq(desc->msi_desc) )
-        ack_APIC_irq(); /* ACKTYPE_EOI */
-}
-
-#define shutdown_msi_irq mask_msi_irq
-
-/*
- * IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices,
- * which implement the MSI or MSI-X Capability Structure.
- */
-hw_irq_controller pci_msi_type = {
-    .typename   = "PCI-MSI",
-    .startup    = startup_msi_irq,
-    .shutdown   = shutdown_msi_irq,
-    .enable	    = unmask_msi_irq,
-    .disable    = mask_msi_irq,
-    .ack        = ack_msi_irq,
-    .end        = end_msi_irq,
-    .set_affinity   = set_msi_affinity,
-};
-
 static inline void init_IO_APIC_traps(void)
 {
     int irq;
diff -r 2dab09bcec81 -r a422e2a4451e xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Sun Sep 18 00:25:57 2011 +0100
+++ b/xen/arch/x86/irq.c	Sun Sep 18 00:26:52 2011 +0100
@@ -1304,7 +1304,7 @@
      * MSIs are treated as edge-triggered interrupts, except
      * when there is no proper way to mask them.
      */
-    if ( desc->handler == &pci_msi_type )
+    if ( desc->msi_desc )
         return msi_maskable_irq(desc->msi_desc) ? ACKTYPE_NONE : ACKTYPE_EOI;
 
     /*
@@ -1723,7 +1723,7 @@
         if ( desc->handler != &no_irq_type )
             dprintk(XENLOG_G_ERR, "dom%d: irq %d in use\n",
                     d->domain_id, irq);
-        desc->handler = &pci_msi_type;
+        setup_msi_handler(desc, msi_desc);
 
         if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_PERDEV
              && !desc->chip_data->used_vectors )
@@ -1739,7 +1739,7 @@
         }
 
         set_domain_irq_pirq(d, irq, info);
-        setup_msi_irq(msi_desc, irq);
+        setup_msi_irq(desc);
         spin_unlock_irqrestore(&desc->lock, flags);
     }
     else
@@ -1807,6 +1807,12 @@
             radix_tree_int_to_ptr(-pirq));
     }
 
+    if ( msi_desc )
+    {
+        desc->handler = &no_irq_type;
+        desc->msi_desc = NULL;
+    }
+
     spin_unlock_irqrestore(&desc->lock, flags);
     if (msi_desc)
         msi_free_irq(msi_desc);
@@ -1819,9 +1825,6 @@
         dprintk(XENLOG_G_ERR, "dom%d: could not deny access to irq %d\n",
                 d->domain_id, pirq);
 
-    if ( desc->handler == &pci_msi_type )
-        desc->handler = &no_irq_type;
-
  done:
     return ret;
 }
diff -r 2dab09bcec81 -r a422e2a4451e xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Sun Sep 18 00:25:57 2011 +0100
+++ b/xen/arch/x86/msi.c	Sun Sep 18 00:26:52 2011 +0100
@@ -120,11 +120,11 @@
 /*
  * MSI message composition
  */
-void msi_compose_msg(int irq, struct msi_msg *msg)
+void msi_compose_msg(struct irq_desc *desc, struct msi_msg *msg)
 {
     unsigned dest;
     cpumask_t domain;
-    struct irq_cfg *cfg = irq_cfg(irq);
+    struct irq_cfg *cfg = desc->chip_data;
     int vector = cfg->vector;
     domain = cfg->cpu_mask;
 
@@ -205,19 +205,6 @@
         iommu_read_msi_from_ire(entry, msg);
 }
 
-static int set_irq_msi(struct msi_desc *entry)
-{
-    if ( entry->irq >= nr_irqs )
-    {
-        dprintk(XENLOG_ERR, "Trying to install msi data for irq %d\n",
-                entry->irq);
-        return -EINVAL;
-    }
-
-    irq_desc[entry->irq].msi_desc = entry;
-    return 0;
-}
-
 static void write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
 {
     entry->msg = *msg;
@@ -266,7 +253,7 @@
     }
 }
 
-void set_msi_affinity(struct irq_desc *desc, const cpumask_t *mask)
+static void set_msi_affinity(struct irq_desc *desc, const cpumask_t *mask)
 {
     struct msi_msg msg;
     unsigned int dest;
@@ -387,16 +374,65 @@
     return -1;
 }
 
-void mask_msi_irq(struct irq_desc *desc)
+static void mask_msi_irq(struct irq_desc *desc)
 {
     msi_set_mask_bit(desc, 1);
 }
 
-void unmask_msi_irq(struct irq_desc *desc)
+static void unmask_msi_irq(struct irq_desc *desc)
 {
     msi_set_mask_bit(desc, 0);
 }
 
+static unsigned int startup_msi_irq(struct irq_desc *desc)
+{
+    unmask_msi_irq(desc);
+    return 0;
+}
+
+static void ack_nonmaskable_msi_irq(struct irq_desc *desc)
+{
+    irq_complete_move(desc);
+    move_native_irq(desc);
+}
+
+static void ack_maskable_msi_irq(struct irq_desc *desc)
+{
+    ack_nonmaskable_msi_irq(desc);
+    ack_APIC_irq(); /* ACKTYPE_NONE */
+}
+
+static void end_nonmaskable_msi_irq(struct irq_desc *desc, u8 vector)
+{
+    ack_APIC_irq(); /* ACKTYPE_EOI */
+}
+
+/*
+ * IRQ chip for MSI PCI/PCI-X/PCI-Express devices,
+ * which implement the MSI or MSI-X capability structure.
+ */
+static hw_irq_controller pci_msi_maskable = {
+    .typename     = "PCI-MSI/-X",
+    .startup      = startup_msi_irq,
+    .shutdown     = mask_msi_irq,
+    .enable       = unmask_msi_irq,
+    .disable      = mask_msi_irq,
+    .ack          = ack_maskable_msi_irq,
+    .set_affinity = set_msi_affinity
+};
+
+/* As above, but without having masking capability. */
+static hw_irq_controller pci_msi_nonmaskable = {
+    .typename     = "PCI-MSI",
+    .startup      = irq_startup_none,
+    .shutdown     = irq_shutdown_none,
+    .enable       = irq_enable_none,
+    .disable      = irq_disable_none,
+    .ack          = ack_nonmaskable_msi_irq,
+    .end          = end_nonmaskable_msi_irq,
+    .set_affinity = set_msi_affinity
+};
+
 static struct msi_desc* alloc_msi_entry(void)
 {
     struct msi_desc *entry;
@@ -412,15 +448,19 @@
     return entry;
 }
 
-int setup_msi_irq(struct msi_desc *msidesc, int irq)
+void setup_msi_handler(struct irq_desc *desc, struct msi_desc *msidesc)
+{
+    desc->msi_desc = msidesc;
+    desc->handler = msi_maskable_irq(msidesc) ? &pci_msi_maskable
+                                              : &pci_msi_nonmaskable;
+}
+
+void setup_msi_irq(struct irq_desc *desc)
 {
     struct msi_msg msg;
 
-    msi_compose_msg(irq, &msg);
-    set_irq_msi(msidesc);
-    write_msi_msg(irq_desc[irq].msi_desc, &msg);
-
-    return 0;
+    msi_compose_msg(desc, &msg);
+    write_msi_msg(desc->msi_desc, &msg);
 }
 
 int msi_free_irq(struct msi_desc *entry)
@@ -1022,19 +1062,20 @@
     {
         struct irq_desc *desc = irq_to_desc(irq);
         const struct msi_desc *entry;
-        u32 addr, data;
+        u32 addr, data, dest32;
+        int mask;
+        struct msi_attrib attr;
         unsigned long flags;
         char type;
 
         spin_lock_irqsave(&desc->lock, flags);
 
         entry = desc->msi_desc;
-        type = desc->handler == &pci_msi_type && entry;
-
-        spin_unlock_irqrestore(&desc->lock, flags);
-
-        if ( !type )
+        if ( !entry )
+        {
+            spin_unlock_irqrestore(&desc->lock, flags);
             continue;
+        }
 
         switch ( entry->msi_attrib.type )
         {
@@ -1045,6 +1086,11 @@
 
         data = entry->msg.data;
         addr = entry->msg.address_lo;
+        dest32 = entry->msg.dest32;
+        attr = entry->msi_attrib;
+        mask = msi_get_mask_bit(entry);
+
+        spin_unlock_irqrestore(&desc->lock, flags);
 
         printk(" MSI%c %4u vec=%02x%7s%6s%3sassert%5s%7s"
                " dest=%08x mask=%d/%d/%d\n",
@@ -1055,9 +1101,7 @@
                data & MSI_DATA_LEVEL_ASSERT ? "" : "de",
                addr & MSI_ADDR_DESTMODE_LOGIC ? "log" : "phys",
                addr & MSI_ADDR_REDIRECTION_LOWPRI ? "lowest" : "cpu",
-               entry->msg.dest32,
-               entry->msi_attrib.maskbit, entry->msi_attrib.masked,
-               msi_get_mask_bit(entry));
+               dest32, attr.maskbit, attr.masked, mask);
     }
 }
 
diff -r 2dab09bcec81 -r a422e2a4451e xen/include/asm-x86/msi.h
--- a/xen/include/asm-x86/msi.h	Sun Sep 18 00:25:57 2011 +0100
+++ b/xen/include/asm-x86/msi.h	Sun Sep 18 00:26:52 2011 +0100
@@ -74,15 +74,14 @@
 	u32	dest32;		/* used when Interrupt Remapping with EIM is enabled */
 };
 
+struct irq_desc;
 struct msi_desc;
 /* Helper functions */
-extern void mask_msi_irq(struct irq_desc *);
-extern void unmask_msi_irq(struct irq_desc *);
-extern void set_msi_affinity(struct irq_desc *, const cpumask_t *);
 extern int pci_enable_msi(struct msi_info *msi, struct msi_desc **desc);
 extern void pci_disable_msi(struct msi_desc *desc);
 extern void pci_cleanup_msi(struct pci_dev *pdev);
-extern int setup_msi_irq(struct msi_desc *desc, int irq);
+extern void setup_msi_handler(struct irq_desc *, struct msi_desc *);
+extern void setup_msi_irq(struct irq_desc *);
 extern void teardown_msi_irq(int irq);
 extern int msi_free_vector(struct msi_desc *entry);
 extern int pci_restore_msi_state(struct pci_dev *pdev);
@@ -90,14 +89,14 @@
 extern unsigned int pci_msix_get_table_len(struct pci_dev *pdev);
 
 struct msi_desc {
-	struct {
+	struct msi_attrib {
 		__u8	type	: 5; 	/* {0: unused, 5h:MSI, 11h:MSI-X} */
 		__u8	maskbit	: 1; 	/* mask-pending bit supported ?   */
 		__u8	masked	: 1;
 		__u8	is_64	: 1;	/* Address size: 0=32bit 1=64bit  */
 		__u8	pos;	 	/* Location of the msi capability */
 		__u16	entry_nr;    	/* specific enabled entry 	  */
-	}msi_attrib;
+	} msi_attrib;
 
 	struct list_head list;
 
@@ -123,8 +122,6 @@
  */
 #define NR_HP_RESERVED_VECTORS 	20
 
-extern const struct hw_interrupt_type pci_msi_type;
-
 #define PCI_MSIX_ENTRY_SIZE			16
 #define  PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET	0
 #define  PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET	4
@@ -222,5 +219,6 @@
 	__u32 	hi_address;
 } __attribute__ ((packed));
 
-void msi_compose_msg(int irq, struct msi_msg *);
+void msi_compose_msg(struct irq_desc *, struct msi_msg *);
+
 #endif /* __ASM_MSI_H */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 21 13:11:33 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 21 Sep 2011 13:11:33 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6T8m-0004BA-E0; Wed, 21 Sep 2011 13:11:33 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6T8T-00045a-O0
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 13:11:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1316635870!19111006!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11172 invoked from network); 21 Sep 2011 20:11:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Sep 2011 20:11:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6T8Q-0001pn-7r
	for xen-changelog@lists.xensource.com; Wed, 21 Sep 2011 21:11:10 +0100
Message-Id: <E1R6T8Q-0001pn-7r@xenbits.xen.org>
Date: Wed, 21 Sep 2011 21:11:09 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] libxl: do not start a xenpv qemu
	solely for tap devices if blktap is available
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1316621578 -3600
# Node ID 2112db7c68b3423c7ff9ead91eff5de2d13a13b5
# Parent  7d13e08b51209721fde4979ae59cceda6854877a
libxl: do not start a xenpv qemu solely for tap devices if blktap is available

qemu is used as a fallback for DISK_BACKEND_TAP if no blktap is
available but if blktap is available, or for DISK_BACKEND_PHY, we
don't need a qemu process.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
xen-unstable changeset: 23044:d4ca456c0c25
xen-unstable date:      Tue Mar 15 18:19:47 2011 +0000
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 7d13e08b5120 -r 2112db7c68b3 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Sat Sep 17 16:38:31 2011 +0100
+++ b/tools/libxl/libxl_dm.c	Wed Sep 21 17:12:58 2011 +0100
@@ -828,8 +828,29 @@
         goto out;
     }
 
-    if (nr_disks > 0 && !libxl__blktap_enabled(&gc))
-        ret = 1;
+    if (nr_disks > 0) {
+        int blktap_enabled = -1;
+        for (i = 0; i < nr_disks; i++) {
+            switch (disks[i].backend) {
+            case DISK_BACKEND_TAP:
+                if (blktap_enabled == -1)
+                    blktap_enabled = libxl__blktap_enabled(&gc);
+                if (!blktap_enabled) {
+                    ret = 1;
+                    goto out;
+                }
+                break;
+
+            case DISK_BACKEND_QDISK:
+                ret = 1;
+                goto out;
+
+            case DISK_BACKEND_PHY:
+            case DISK_BACKEND_UNKNOWN:
+                break;
+            }
+        }
+    }
 
 out:
     libxl__free_all(&gc);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 22 11:13:26 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 22 Sep 2011 11:13:26 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6nm1-0006Ph-J0; Thu, 22 Sep 2011 11:13:25 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6njp-0005fB-2U
	for xen-changelog@lists.xensource.com; Thu, 22 Sep 2011 11:11:09 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1316715050!43545020!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22691 invoked from network); 22 Sep 2011 18:10:50 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Sep 2011 18:10:50 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6njm-0002kf-2C
	for xen-changelog@lists.xensource.com; Thu, 22 Sep 2011 19:11:06 +0100
Message-Id: <E1R6njm-0002kf-2C@xenbits.xen.org>
Date: Thu, 22 Sep 2011 19:11:05 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] linux-2.6.18:xen-kbdfront:
	re-enable REL_WHEEL event
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1316714300 -3600
# Node ID faa29a8c3c4b58143a7f0fc38965d12dc53a8a2d
# Parent  cea3ef79203d2fff373e6acafd997c8f88b6faed
linux-2.6.18:xen-kbdfront: re-enable REL_WHEEL event

In commit 1083:211849d9d511 the wheel event was lost due to an
incorrect backport of upstream commit
8c3c283e6bf463ab498d6e7823aff6c4762314b6.  With this change the wheel
event is available again in the guest.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---


diff -r cea3ef79203d -r faa29a8c3c4b drivers/xen/fbfront/xenkbd.c
--- a/drivers/xen/fbfront/xenkbd.c	Thu Sep 22 18:57:57 2011 +0100
+++ b/drivers/xen/fbfront/xenkbd.c	Thu Sep 22 18:58:20 2011 +0100
@@ -170,6 +170,7 @@
 		__set_bit(REL_Y, ptr->relbit);
 	}
 	__set_bit(REL_WHEEL, ptr->relbit);
+	__set_bit(EV_REL, ptr->evbit);
 
 	__set_bit(EV_KEY, ptr->evbit);
 	for (i = BTN_LEFT; i <= BTN_TASK; i++)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Thu Sep 22 11:13:33 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 22 Sep 2011 11:13:33 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R6nm9-0006Sh-E2; Thu, 22 Sep 2011 11:13:33 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R6njo-0005f2-WE
	for xen-changelog@lists.xensource.com; Thu, 22 Sep 2011 11:11:09 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1316715064!35124258!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16052 invoked from network); 22 Sep 2011 18:11:04 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	22 Sep 2011 18:11:04 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R6njl-0002jt-Ka
	for xen-changelog@lists.xensource.com; Thu, 22 Sep 2011 19:11:05 +0100
Message-Id: <E1R6njl-0002jt-Ka@xenbits.xen.org>
Date: Thu, 22 Sep 2011 19:11:05 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] linux-2.6.18/Input: mousedev -
	handle mice that use absolute
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1316714277 -3600
# Node ID cea3ef79203d2fff373e6acafd997c8f88b6faed
# Parent  f4f25124b1b6d926b6e19a499bf4a3fdc97f0157
linux-2.6.18/Input: mousedev - handle mice that use absolute
coordinates

After commit 1083:211849d9d511 the mouse multiplexer /dev/input/mice
does not receive updates because the base kernel lacks a change from
2.6.24. If xorg.conf uses the mouse driver instead of the evdev
driver,
the mouse is stuck because now the "Xen Virtual Pointer" is not seen
as
a mouse anymore.  Adding the backported patch below fixes it.

Mainline commit 6724f93463c332018e05f538a2ab3ce41eac0e8a

        Input: mousedev - handle mice that use absolute coordinates

        Devices like the HP Integrated Remote Console Virtual Mouse,
        which are
        standard equipment on all Proliant and Integrity servers,
        produce
        absolute coordinates instead of relative coordinates.  This is
        done to
        synchronize the position of the mouse cursor on the client
        desktop
        with the mouse cursor position on the server.  Mousedev is not
        designed to pass those absolute events directly to X, but it
        can
        translate them into relative movements.  It currently does
        this for
        tablet like devices and touchpads.  This patch merely tells it
        to also
        include a device with ABS_X, ABS_Y, and mouse buttons in its
        list of
        devices to process input for.

        This patch enables the mouse pointer to move when using the
        remote
        console.

        Signed-off-by: Micah Parrish <micah.parrish@hp.com>
        Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---


diff -r f4f25124b1b6 -r cea3ef79203d drivers/input/mousedev.c
--- a/drivers/input/mousedev.c	Sat Sep 17 16:29:02 2011 +0100
+++ b/drivers/input/mousedev.c	Thu Sep 22 18:57:57 2011 +0100
@@ -712,6 +712,12 @@
 		.keybit = { [LONG(BTN_TOOL_FINGER)] = BIT(BTN_TOOL_FINGER) },
 		.absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | BIT(ABS_TOOL_WIDTH) },
 	},	/* A touchpad */
+	{
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
+		.evbit = { BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_SYN) },
+		.keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) },
+		.absbit = { BIT(ABS_X) | BIT(ABS_Y) },
+	},	/* Mouse-like device with absolute X and Y but ordinary clicks, like hp ILO2 High Performance mouse */
 
 	{ }, 	/* Terminating entry */
 };

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 16:33:20 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 16:33:20 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8h9L-0005yU-Sg; Tue, 27 Sep 2011 16:33:19 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8h9I-0005xq-OE
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 16:33:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1317166393!16710966!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19805 invoked from network); 27 Sep 2011 23:33:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Sep 2011 23:33:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8h9E-0000PT-Oy
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 00:33:12 +0100
Message-Id: <E1R8h9E-0000PT-Oy@xenbits.xen.org>
Date: Wed, 28 Sep 2011 00:33:11 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] libxl: fix double free at
	get_all_assigned_devices
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Marek Marczykowski <marmarek@mimuw.edu.pl>
# Date 1317140837 -3600
# Node ID 5c395e993fe4064f0e3e13af70af9e440dc00689
# Parent  2112db7c68b3423c7ff9ead91eff5de2d13a13b5
libxl: fix double free at get_all_assigned_devices

Do not free() list manually - it will be freed by libxl__free_all.

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 2112db7c68b3 -r 5c395e993fe4 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Wed Sep 21 17:12:58 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Tue Sep 27 17:27:17 2011 +0100
@@ -469,7 +469,6 @@
     }
 
     if ( 0 == *num ) {
-        free(pcidevs);
         pcidevs = NULL;
     }else{
         *list = pcidevs;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:55:20 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:55:20 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jMm-0003AA-Iu; Tue, 27 Sep 2011 18:55:20 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMh-00039A-9j
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1317174911!17209921!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30810 invoked from network); 28 Sep 2011 01:55:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMd-0000Qx-Gy
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:11 +0100
Message-Id: <E1R8jMd-0000Qx-Gy@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PCI multi-seg: VT-d specific
	adjustments
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316712446 -3600
# Node ID 85418e16852723f6cc65082834061657f7149ea8
# Parent  ec7c81fbe0de9b18f38bf2592a9e44d0992821c9
PCI multi-seg: VT-d specific adjustments

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r ec7c81fbe0de -r 85418e168527 xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Thu Sep 22 18:26:54 2011 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Thu Sep 22 18:27:26 2011 +0100
@@ -188,6 +188,9 @@
 
     list_for_each_entry ( drhd, &acpi_drhd_units, list )
     {
+        if ( drhd->segment != pdev->seg )
+            continue;
+
         for (i = 0; i < drhd->scope.devices_cnt; i++)
             if ( drhd->scope.devices[i] == PCI_BDF2(bus, devfn) )
                 return drhd;
@@ -201,13 +204,16 @@
     return include_all;
 }
 
-struct acpi_atsr_unit * acpi_find_matched_atsr_unit(u8 bus, u8 devfn)
+struct acpi_atsr_unit * acpi_find_matched_atsr_unit(u16 seg, u8 bus, u8 devfn)
 {
     struct acpi_atsr_unit *atsr;
     struct acpi_atsr_unit *all_ports = NULL;
 
     list_for_each_entry ( atsr, &acpi_atsr_units, list )
     {
+        if ( atsr->segment != seg )
+            continue;
+
         if ( test_bit(bus, atsr->scope.buses) )
             return atsr;
 
@@ -269,8 +275,8 @@
 }
 
 
-static int __init acpi_parse_dev_scope(void *start, void *end,
-                                       void *acpi_entry, int type)
+static int __init acpi_parse_dev_scope(
+    void *start, void *end, void *acpi_entry, int type, u16 seg)
 {
     struct dmar_scope *scope = acpi_entry;
     struct acpi_ioapic_unit *acpi_ioapic_unit;
@@ -314,8 +320,8 @@
                 bus, path->dev, path->fn, PCI_SUBORDINATE_BUS);
             if ( iommu_verbose )
                 dprintk(VTDPREFIX,
-                        "  bridge: %x:%x.%x  start = %x sec = %x  sub = %x\n",
-                        bus, path->dev, path->fn,
+                        " bridge: %04x:%02x:%02x.%u start=%x sec=%x sub=%x\n",
+                        seg, bus, path->dev, path->fn,
                         acpi_scope->start_bus, sec_bus, sub_bus);
 
             dmar_scope_add_buses(scope, sec_bus, sub_bus);
@@ -323,20 +329,21 @@
 
         case ACPI_DEV_MSI_HPET:
             if ( iommu_verbose )
-                dprintk(VTDPREFIX, "  MSI HPET: %x:%x.%x\n",
-                        bus, path->dev, path->fn);
+                dprintk(VTDPREFIX, " MSI HPET: %04x:%02x:%02x.%u\n",
+                        seg, bus, path->dev, path->fn);
             break;
 
         case ACPI_DEV_ENDPOINT:
             if ( iommu_verbose )
-                dprintk(VTDPREFIX, "  endpoint: %x:%x.%x\n",
-                        bus, path->dev, path->fn);
+                dprintk(VTDPREFIX, " endpoint: %04x:%02x:%02x.%u\n",
+                        seg, bus, path->dev, path->fn);
 
             if ( type == DMAR_TYPE )
             {
                 struct acpi_drhd_unit *drhd = acpi_entry;
 
-                if ( (bus == 0) && (path->dev == 2) && (path->fn == 0) )
+                if ( (seg == 0) && (bus == 0) && (path->dev == 2) &&
+                     (path->fn == 0) )
                     igd_drhd_address = drhd->address;
             }
 
@@ -344,8 +351,8 @@
 
         case ACPI_DEV_IOAPIC:
             if ( iommu_verbose )
-                dprintk(VTDPREFIX, "  IOAPIC: %x:%x.%x\n",
-                        bus, path->dev, path->fn);
+                dprintk(VTDPREFIX, " IOAPIC: %04x:%02x:%02x.%u\n",
+                        seg, bus, path->dev, path->fn);
 
             if ( type == DMAR_TYPE )
             {
@@ -398,6 +405,7 @@
     memset(dmaru, 0, sizeof(struct acpi_drhd_unit));
 
     dmaru->address = drhd->address;
+    dmaru->segment = drhd->segment;
     dmaru->include_all = drhd->flags & 1; /* BIT0: INCLUDE_ALL */
     INIT_LIST_HEAD(&dmaru->ioapic_list);
     if ( iommu_verbose )
@@ -411,7 +419,7 @@
     dev_scope_start = (void *)(drhd + 1);
     dev_scope_end = ((void *)drhd) + header->length;
     ret = acpi_parse_dev_scope(dev_scope_start, dev_scope_end,
-                               dmaru, DMAR_TYPE);
+                               dmaru, DMAR_TYPE, drhd->segment);
 
     if ( dmaru->include_all )
     {
@@ -528,11 +536,12 @@
 
     rmrru->base_address = base_addr;
     rmrru->end_address = end_addr;
+    rmrru->segment = rmrr->segment;
 
     dev_scope_start = (void *)(rmrr + 1);
     dev_scope_end   = ((void *)rmrr) + header->length;
     ret = acpi_parse_dev_scope(dev_scope_start, dev_scope_end,
-                               rmrru, RMRR_TYPE);
+                               rmrru, RMRR_TYPE, rmrr->segment);
 
     if ( ret || (rmrru->scope.devices_cnt == 0) )
         xfree(rmrru);
@@ -609,6 +618,7 @@
         return -ENOMEM;
     memset(atsru, 0, sizeof(struct acpi_atsr_unit));
 
+    atsru->segment = atsr->segment;
     atsru->all_ports = atsr->flags & 1; /* BIT0: ALL_PORTS */
     if ( iommu_verbose )
         dprintk(VTDPREFIX,
@@ -618,7 +628,7 @@
         dev_scope_start = (void *)(atsr + 1);
         dev_scope_end   = ((void *)atsr) + header->length;
         ret = acpi_parse_dev_scope(dev_scope_start, dev_scope_end,
-                                   atsru, ATSR_TYPE);
+                                   atsru, ATSR_TYPE, atsr->segment);
     }
     else
     {
diff -r ec7c81fbe0de -r 85418e168527 xen/drivers/passthrough/vtd/dmar.h
--- a/xen/drivers/passthrough/vtd/dmar.h	Thu Sep 22 18:26:54 2011 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.h	Thu Sep 22 18:27:26 2011 +0100
@@ -49,6 +49,7 @@
     struct dmar_scope scope;            /* must be first member of struct */
     struct list_head list;
     u64    address;                     /* register base address of the unit */
+    u16    segment;
     u8     include_all:1;
     struct iommu *iommu;
     struct list_head ioapic_list;
@@ -59,12 +60,14 @@
     struct list_head list;
     u64    base_address;
     u64    end_address;
+    u16    segment;
     u8     allow_all:1;
 };
 
 struct acpi_atsr_unit {
     struct dmar_scope scope;            /* must be first member of struct */
     struct list_head list;
+    u16    segment;
     u8     all_ports:1;
 };
 
@@ -84,7 +87,7 @@
                  idx < rmrr->scope.devices_cnt; idx++)
 
 struct acpi_drhd_unit * acpi_find_matched_drhd_unit(struct pci_dev *pdev);
-struct acpi_atsr_unit * acpi_find_matched_atsr_unit(u8 bus, u8 devfn);
+struct acpi_atsr_unit * acpi_find_matched_atsr_unit(u16 seg, u8 bus, u8 devfn);
 
 #define DMAR_TYPE 1
 #define RMRR_TYPE 2
@@ -114,7 +117,7 @@
 
 int vtd_hw_check(void);
 void disable_pmr(struct iommu *iommu);
-int is_usb_device(u8 bus, u8 devfn);
+int is_usb_device(u16 seg, u8 bus, u8 devfn);
 int is_igd_drhd(struct acpi_drhd_unit *drhd);
 
 #endif /* _DMAR_H_ */
diff -r ec7c81fbe0de -r 85418e168527 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Thu Sep 22 18:26:54 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Sep 22 18:27:26 2011 +0100
@@ -834,16 +834,17 @@
 {
     const char *reason;
     int fault_type;
+    u16 seg = iommu->intel->drhd->segment;
     reason = iommu_get_fault_reason(fault_reason, &fault_type);
 
     if ( fault_type == DMA_REMAP )
     {
         INTEL_IOMMU_DEBUG(
-                "DMAR:[%s] Request device [%02x:%02x.%d] "
+                "DMAR:[%s] Request device [%04x:%02x:%02x.%u] "
                 "fault addr %"PRIx64", iommu reg = %p\n"
                 "DMAR:[fault reason %02xh] %s\n",
                 (type ? "DMA Read" : "DMA Write"),
-                (source_id >> 8), PCI_SLOT(source_id & 0xFF),
+                seg, (source_id >> 8), PCI_SLOT(source_id & 0xFF),
                 PCI_FUNC(source_id & 0xFF), addr, iommu->reg,
                 fault_reason, reason);
 #ifndef __i386__ /* map_domain_page() cannot be used in this context */
@@ -854,10 +855,10 @@
     }
     else
         INTEL_IOMMU_DEBUG(
-                "INTR-REMAP: Request device [%02x:%02x.%d] "
+                "INTR-REMAP: Request device [%04x:%02x:%02x.%u] "
                 "fault index %"PRIx64", iommu reg = %p\n"
                 "INTR-REMAP:[fault reason %02xh] %s\n",
-                (source_id >> 8), PCI_SLOT(source_id & 0xFF),
+                seg, (source_id >> 8), PCI_SLOT(source_id & 0xFF),
                 PCI_FUNC(source_id & 0xFF), addr >> 48, iommu->reg,
                 fault_reason, reason);
     return 0;
@@ -1252,6 +1253,7 @@
     struct hvm_iommu *hd = domain_hvm_iommu(domain);
     struct context_entry *context, *context_entries;
     u64 maddr, pgd_maddr;
+    u16 seg = iommu->intel->drhd->segment;
     int agaw;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
@@ -1267,7 +1269,7 @@
 
         /* First try to get domain ownership from device structure.  If that's
          * not available, try to read it from the context itself. */
-        pdev = pci_get_pdev(0, bus, devfn);
+        pdev = pci_get_pdev(seg, bus, devfn);
         if ( pdev )
         {
             if ( pdev->domain != domain )
@@ -1379,18 +1381,20 @@
 
     unmap_vtd_domain_page(context_entries);
 
-    me_wifi_quirk(domain, bus, devfn, MAP_ME_PHANTOM_FUNC);
+    if ( !seg )
+        me_wifi_quirk(domain, bus, devfn, MAP_ME_PHANTOM_FUNC);
 
     return 0;
 }
 
-static int domain_context_mapping(struct domain *domain, u8 bus, u8 devfn)
+static int domain_context_mapping(
+    struct domain *domain, u16 seg, u8 bus, u8 devfn)
 {
     struct acpi_drhd_unit *drhd;
     int ret = 0;
     u32 type;
     u8 secbus;
-    struct pci_dev *pdev = pci_get_pdev(0, bus, devfn);
+    struct pci_dev *pdev = pci_get_pdev(seg, bus, devfn);
 
     drhd = acpi_find_matched_drhd_unit(pdev);
     if ( !drhd )
@@ -1408,18 +1412,20 @@
 
     case DEV_TYPE_PCIe_ENDPOINT:
         if ( iommu_verbose )
-            dprintk(VTDPREFIX, "d%d:PCIe: map bdf = %x:%x.%x\n",
-                    domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            dprintk(VTDPREFIX, "d%d:PCIe: map %04x:%02x:%02x.%u\n",
+                    domain->domain_id, seg, bus,
+                    PCI_SLOT(devfn), PCI_FUNC(devfn));
         ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
-        if ( !ret && ats_device(0, bus, devfn) )
-            enable_ats_device(0, bus, devfn);
+        if ( !ret && ats_device(seg, bus, devfn) )
+            enable_ats_device(seg, bus, devfn);
 
         break;
 
     case DEV_TYPE_PCI:
         if ( iommu_verbose )
-            dprintk(VTDPREFIX, "d%d:PCI: map bdf = %x:%x.%x\n",
-                    domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            dprintk(VTDPREFIX, "d%d:PCI: map %04x:%02x:%02x.%u\n",
+                    domain->domain_id, seg, bus,
+                    PCI_SLOT(devfn), PCI_FUNC(devfn));
 
         ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
         if ( ret )
@@ -1442,9 +1448,9 @@
         break;
 
     default:
-        dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): bdf = %x:%x.%x\n",
+        dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): %04x:%02x:%02x.%u\n",
                 domain->domain_id, type,
-                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         ret = -EINVAL;
         break;
     }
@@ -1503,19 +1509,21 @@
     spin_unlock(&iommu->lock);
     unmap_vtd_domain_page(context_entries);
 
-    me_wifi_quirk(domain, bus, devfn, UNMAP_ME_PHANTOM_FUNC);
+    if ( !iommu->intel->drhd->segment )
+        me_wifi_quirk(domain, bus, devfn, UNMAP_ME_PHANTOM_FUNC);
 
     return 0;
 }
 
-static int domain_context_unmap(struct domain *domain, u8 bus, u8 devfn)
+static int domain_context_unmap(
+    struct domain *domain, u16 seg, u8 bus, u8 devfn)
 {
     struct acpi_drhd_unit *drhd;
     struct iommu *iommu;
     int ret = 0;
     u32 type;
     u8 tmp_bus, tmp_devfn, secbus;
-    struct pci_dev *pdev = pci_get_pdev(0, bus, devfn);
+    struct pci_dev *pdev = pci_get_pdev(seg, bus, devfn);
     int found = 0;
 
     BUG_ON(!pdev);
@@ -1535,18 +1543,19 @@
 
     case DEV_TYPE_PCIe_ENDPOINT:
         if ( iommu_verbose )
-            dprintk(VTDPREFIX, "d%d:PCIe: unmap bdf = %x:%x.%x\n",
-                    domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            dprintk(VTDPREFIX, "d%d:PCIe: unmap %04x:%02x:%02x.%u\n",
+                    domain->domain_id, seg, bus,
+                    PCI_SLOT(devfn), PCI_FUNC(devfn));
         ret = domain_context_unmap_one(domain, iommu, bus, devfn);
-        if ( !ret && ats_device(0, bus, devfn) )
-            disable_ats_device(0, bus, devfn);
+        if ( !ret && ats_device(seg, bus, devfn) )
+            disable_ats_device(seg, bus, devfn);
 
         break;
 
     case DEV_TYPE_PCI:
         if ( iommu_verbose )
-            dprintk(VTDPREFIX, "d%d:PCI: unmap bdf = %x:%x.%x\n",
-                    domain->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            dprintk(VTDPREFIX, "d%d:PCI: unmap %04x:%02x:%02x.%u\n",
+                    domain->domain_id, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         ret = domain_context_unmap_one(domain, iommu, bus, devfn);
         if ( ret )
             break;
@@ -1571,9 +1580,9 @@
         break;
 
     default:
-        dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): bdf = %x:%x.%x\n",
+        dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): %04x:%02x:%02x.%u\n",
                 domain->domain_id, type,
-                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         ret = -EINVAL;
         goto out;
     }
@@ -1584,7 +1593,7 @@
      */
     for_each_pdev ( domain, pdev )
     {
-        if ( pdev->bus == bus && pdev->devfn == devfn )
+        if ( pdev->seg == seg && pdev->bus == bus && pdev->devfn == devfn )
             continue;
 
         drhd = acpi_find_matched_drhd_unit(pdev);
@@ -1639,11 +1648,11 @@
     if ( (target != dom0) && !iommu_intremap )
         untrusted_msi = 1;
 
-    ret = domain_context_unmap(source, bus, devfn);
+    ret = domain_context_unmap(source, seg, bus, devfn);
     if ( ret )
         return ret;
 
-    ret = domain_context_mapping(target, bus, devfn);
+    ret = domain_context_mapping(target, seg, bus, devfn);
     if ( ret )
         return ret;
 
@@ -1878,7 +1887,8 @@
     if ( !pdev->domain )
         return -EINVAL;
 
-    ret = domain_context_mapping(pdev->domain, pdev->bus, pdev->devfn);
+    ret = domain_context_mapping(pdev->domain, pdev->seg, pdev->bus,
+                                 pdev->devfn);
     if ( ret )
     {
         dprintk(XENLOG_ERR VTDPREFIX, "d%d: context mapping failed\n",
@@ -1888,7 +1898,9 @@
 
     for_each_rmrr_device ( rmrr, bdf, i )
     {
-        if ( PCI_BUS(bdf) == pdev->bus && PCI_DEVFN2(bdf) == pdev->devfn )
+        if ( rmrr->segment == pdev->seg &&
+             PCI_BUS(bdf) == pdev->bus &&
+             PCI_DEVFN2(bdf) == pdev->devfn )
         {
             ret = rmrr_identity_mapping(pdev->domain, rmrr);
             if ( ret )
@@ -1916,13 +1928,15 @@
     {
         for_each_rmrr_device ( rmrr, bdf, i )
         {
-            if ( PCI_BUS(bdf) == pdev->bus &&
+            if ( rmrr->segment == pdev->seg &&
+                 PCI_BUS(bdf) == pdev->bus &&
                  PCI_DEVFN2(bdf) == pdev->devfn )
                 return 0;
         }
     }
 
-    return domain_context_unmap(pdev->domain, pdev->bus, pdev->devfn);
+    return domain_context_unmap(pdev->domain, pdev->seg, pdev->bus,
+                                pdev->devfn);
 }
 
 static void __init setup_dom0_devices(struct domain *d)
@@ -1941,7 +1955,7 @@
 
             pdev->domain = d;
             list_add(&pdev->domain_list, &d->arch.pdev_list);
-            domain_context_mapping(d, pdev->bus, pdev->devfn);
+            domain_context_mapping(d, pdev->seg, pdev->bus, pdev->devfn);
             pci_enable_acs(pdev);
             pci_vtd_quirk(pdev);
         }
@@ -2183,7 +2197,7 @@
     /* FIXME: Because USB RMRR conflicts with guest bios region,
      * ignore USB RMRR temporarily.
      */
-    if ( is_usb_device(bus, devfn) )
+    if ( is_usb_device(seg, bus, devfn) )
     {
         ret = 0;
         goto done;
@@ -2192,7 +2206,9 @@
     /* Setup rmrr identity mapping */
     for_each_rmrr_device( rmrr, bdf, i )
     {
-        if ( PCI_BUS(bdf) == bus && PCI_DEVFN2(bdf) == devfn )
+        if ( rmrr->segment == seg &&
+             PCI_BUS(bdf) == bus &&
+             PCI_DEVFN2(bdf) == devfn )
         {
             ret = rmrr_identity_mapping(d, rmrr);
             if ( ret )
diff -r ec7c81fbe0de -r 85418e168527 xen/drivers/passthrough/vtd/utils.c
--- a/xen/drivers/passthrough/vtd/utils.c	Thu Sep 22 18:26:54 2011 +0100
+++ b/xen/drivers/passthrough/vtd/utils.c	Thu Sep 22 18:27:26 2011 +0100
@@ -32,7 +32,7 @@
 #include <asm/io_apic.h>
 #endif
 
-int is_usb_device(u8 bus, u8 devfn)
+int is_usb_device(u16 seg, u8 bus, u8 devfn)
 {
     u16 class = pci_conf_read16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
                                 PCI_CLASS_DEVICE);
@@ -106,8 +106,9 @@
     u64 *l, val;
     u32 l_index, level;
 
-    printk("print_vtd_entries: iommu = %p bdf = %x:%x.%x gmfn = %"PRIx64"\n",
-           iommu, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), gmfn);
+    printk("print_vtd_entries: iommu %p dev %04x:%02x:%02x.%u gmfn %"PRIx64"\n",
+           iommu, iommu->intel->drhd->segment, bus,
+           PCI_SLOT(devfn), PCI_FUNC(devfn), gmfn);
 
     if ( iommu->root_maddr == 0 )
     {
diff -r ec7c81fbe0de -r 85418e168527 xen/drivers/passthrough/vtd/x86/ats.c
--- a/xen/drivers/passthrough/vtd/x86/ats.c	Thu Sep 22 18:26:54 2011 +0100
+++ b/xen/drivers/passthrough/vtd/x86/ats.c	Thu Sep 22 18:27:26 2011 +0100
@@ -104,7 +104,7 @@
          !ecap_dev_iotlb(drhd->iommu->ecap) )
         return 0;
 
-    if ( !acpi_find_matched_atsr_unit(bus, devfn) )
+    if ( !acpi_find_matched_atsr_unit(seg, bus, devfn) )
         return 0;
 
     ats_drhd = find_ats_dev_drhd(drhd->iommu);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:55:32 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:55:32 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jMx-0003E8-VV; Tue, 27 Sep 2011 18:55:32 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMh-00039C-Pz
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1317174897!55764295!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22278 invoked from network); 28 Sep 2011 01:54:57 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:54:57 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMe-0000SW-Kd
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:12 +0100
Message-Id: <E1R8jMe-0000SW-Kd@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PCI multi-seg: Pass-through
	adjustments
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316712518 -3600
# Node ID 314b147d524d8a9fbf7fdebbb1648845b8c02379
# Parent  9e0259239822535680b88ab81cd9084238a29efb
PCI multi-seg: Pass-through adjustments

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 9e0259239822 -r 314b147d524d xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Thu Sep 22 18:28:03 2011 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Thu Sep 22 18:28:38 2011 +0100
@@ -123,35 +123,17 @@
     spin_unlock_irqrestore(&iommu->lock, flags);
 }
 
-static void __init amd_iommu_setup_dom0_devices(struct domain *d)
+static void __init amd_iommu_setup_dom0_device(struct pci_dev *pdev)
 {
-    struct amd_iommu *iommu;
-    struct pci_dev *pdev;
-    int bus, devfn, bdf;
+    int bdf = (pdev->bus << 8) | pdev->devfn;
+    struct amd_iommu *iommu = find_iommu_for_device(pdev->seg, bdf);
 
-    spin_lock(&pcidevs_lock);
-    for ( bus = 0; bus < 256; bus++ )
-    {
-        for ( devfn = 0; devfn < 256; devfn++ )
-        {
-            pdev = pci_get_pdev(0, bus, devfn);
-            if ( !pdev )
-                continue;
-
-            pdev->domain = d;
-            list_add(&pdev->domain_list, &d->arch.pdev_list);
-
-            bdf = (bus << 8) | devfn;
-            iommu = find_iommu_for_device(pdev->seg, bdf);
-
-            if ( likely(iommu != NULL) )
-                amd_iommu_setup_domain_device(d, iommu, bdf);
-            else
-                AMD_IOMMU_DEBUG("No iommu for device %02x:%02x.%x\n",
-                                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
-        }
-    }
-    spin_unlock(&pcidevs_lock);
+    if ( likely(iommu != NULL) )
+        amd_iommu_setup_domain_device(pdev->domain, iommu, bdf);
+    else
+        AMD_IOMMU_DEBUG("No iommu for device %04x:%02x:%02x.%u\n",
+                        pdev->seg, pdev->bus,
+                        PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
 }
 
 int __init amd_iov_detect(void)
@@ -279,7 +261,7 @@
         }
     }
 
-    amd_iommu_setup_dom0_devices(d);
+    setup_dom0_pci_devices(d, amd_iommu_setup_dom0_device);
 }
 
 static void amd_iommu_disable_domain_device(
diff -r 9e0259239822 -r 314b147d524d xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Thu Sep 22 18:28:03 2011 +0100
+++ b/xen/drivers/passthrough/pci.c	Thu Sep 22 18:28:38 2011 +0100
@@ -202,9 +202,7 @@
 void pci_enable_acs(struct pci_dev *pdev)
 {
     int pos;
-    u16 cap;
-    u16 ctrl;
-
+    u16 cap, ctrl, seg = pdev->seg;
     u8 bus = pdev->bus;
     u8 dev = PCI_SLOT(pdev->devfn);
     u8 func = PCI_FUNC(pdev->devfn);
@@ -212,7 +210,7 @@
     if ( !iommu_enabled )
         return;
 
-    pos = pci_find_ext_capability(0, bus, pdev->devfn, PCI_EXT_CAP_ID_ACS);
+    pos = pci_find_ext_capability(seg, bus, pdev->devfn, PCI_EXT_CAP_ID_ACS);
     if (!pos)
         return;
 
@@ -453,7 +451,7 @@
 
 #define PCI_CLASS_BRIDGE_PCI     0x0604
 
-int pdev_type(u8 bus, u8 devfn)
+int pdev_type(u16 seg, u8 bus, u8 devfn)
 {
     u16 class_device;
     u16 status, creg;
@@ -488,9 +486,9 @@
  * return 1: find PCIe-to-PCI/PCIX bridge or PCI legacy bridge
  * return -1: fail
  */
-int find_upstream_bridge(u8 *bus, u8 *devfn, u8 *secbus)
+int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus)
 {
-    struct pci_seg *pseg = get_pseg(0);
+    struct pci_seg *pseg = get_pseg(seg);
     int ret = 0;
     int cnt = 0;
 
@@ -525,7 +523,7 @@
 /*
  * detect pci device, return 0 if it exists, or return 0
  */
-int __init pci_device_detect(u8 bus, u8 dev, u8 func)
+int __init pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func)
 {
     u32 vendor;
 
@@ -554,7 +552,7 @@
         {
             for ( func = 0; func < 8; func++ )
             {
-                if ( pci_device_detect(bus, dev, func) == 0 )
+                if ( pci_device_detect(pseg->nr, bus, dev, func) == 0 )
                     continue;
 
                 pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
@@ -565,7 +563,7 @@
                 }
 
                 /* build bus2bridge */
-                type = pdev_type(bus, PCI_DEVFN(dev, func));
+                type = pdev_type(pseg->nr, bus, PCI_DEVFN(dev, func));
                 switch ( type )
                 {
                     case DEV_TYPE_PCIe_BRIDGE:
@@ -594,8 +592,8 @@
                         break;
 
                     default:
-                        printk("%s: unknown type: bdf = %x:%x.%x\n",
-                               __func__, bus, dev, func);
+                        printk("%s: unknown type: %04x:%02x:%02x.%u\n",
+                               __func__, pseg->nr, bus, dev, func);
                         return -EINVAL;
                 }
 
@@ -620,6 +618,44 @@
     return ret;
 }
 
+struct setup_dom0 {
+    struct domain *d;
+    void (*handler)(struct pci_dev *);
+};
+
+static int __init _setup_dom0_pci_devices(struct pci_seg *pseg, void *arg)
+{
+    struct setup_dom0 *ctxt = arg;
+    int bus, devfn;
+
+    for ( bus = 0; bus < 256; bus++ )
+    {
+        for ( devfn = 0; devfn < 256; devfn++ )
+        {
+            struct pci_dev *pdev = pci_get_pdev(pseg->nr, bus, devfn);
+
+            if ( !pdev )
+                continue;
+
+            pdev->domain = ctxt->d;
+            list_add(&pdev->domain_list, &ctxt->d->arch.pdev_list);
+            ctxt->handler(pdev);
+        }
+    }
+
+    return 0;
+}
+
+void __init setup_dom0_pci_devices(
+    struct domain *d, void (*handler)(struct pci_dev *))
+{
+    struct setup_dom0 ctxt = { .d = d, .handler = handler };
+
+    spin_lock(&pcidevs_lock);
+    pci_segments_iterate(_setup_dom0_pci_devices, &ctxt);
+    spin_unlock(&pcidevs_lock);
+}
+
 /* Disconnect all PCI devices from the PCI buses. From the PCI spec:
  *   "When a 0 is written to [the COMMAND] register, the device is
  *    logically disconnected from the PCI bus for all accesses except
@@ -654,8 +690,9 @@
 
     list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
     {
-        printk("%02x:%02x.%x - dom %-3d - MSIs < ",
-               pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn),
+        printk("%04x:%02x:%02x.%u - dom %-3d - MSIs < ",
+               pseg->nr, pdev->bus,
+               PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn),
                pdev->domain ? pdev->domain->domain_id : -1);
         list_for_each_entry ( msi, &pdev->msi_list, list )
                printk("%d ", msi->irq);
diff -r 9e0259239822 -r 314b147d524d xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Thu Sep 22 18:28:03 2011 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Thu Sep 22 18:28:38 2011 +0100
@@ -457,11 +457,11 @@
             d = PCI_SLOT(dmaru->scope.devices[i]);
             f = PCI_FUNC(dmaru->scope.devices[i]);
 
-            if ( pci_device_detect(b, d, f) == 0 )
+            if ( pci_device_detect(drhd->segment, b, d, f) == 0 )
             {
                 dprintk(XENLOG_WARNING VTDPREFIX,
-                    "  Non-existent device (%x:%x.%x) is reported "
-                    "in this DRHD's scope!\n", b, d, f);
+                        " Non-existent device (%04x:%02x:%02x.%u) is reported"
+                        " in this DRHD's scope!\n", drhd->segment, b, d, f);
                 invalid_cnt++;
             }
         }
@@ -556,12 +556,13 @@
             d = PCI_SLOT(rmrru->scope.devices[i]);
             f = PCI_FUNC(rmrru->scope.devices[i]);
 
-            if ( pci_device_detect(b, d, f) == 0 )
+            if ( pci_device_detect(rmrr->segment, b, d, f) == 0 )
             {
                 dprintk(XENLOG_WARNING VTDPREFIX,
-                    "  Non-existent device (%x:%x.%x) is reported "
-                    "in RMRR (%"PRIx64", %"PRIx64")'s scope!\n",
-                    b, d, f, rmrru->base_address, rmrru->end_address);
+                        " Non-existent device (%04x:%02x:%02x.%u) is reported"
+                        " in RMRR (%"PRIx64", %"PRIx64")'s scope!\n",
+                        rmrr->segment, b, d, f,
+                        rmrru->base_address, rmrru->end_address);
                 ignore = 1;
             }
             else
diff -r 9e0259239822 -r 314b147d524d xen/drivers/passthrough/vtd/intremap.c
--- a/xen/drivers/passthrough/vtd/intremap.c	Thu Sep 22 18:28:03 2011 +0100
+++ b/xen/drivers/passthrough/vtd/intremap.c	Thu Sep 22 18:28:38 2011 +0100
@@ -448,15 +448,17 @@
 static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
 {
     int type;
+    u16 seg;
     u8 bus, devfn, secbus;
     int ret;
 
     if ( !pdev || !ire )
         return;
 
+    seg = pdev->seg;
     bus = pdev->bus;
     devfn = pdev->devfn;
-    type = pdev_type(bus, devfn);
+    type = pdev_type(seg, bus, devfn);
     switch ( type )
     {
     case DEV_TYPE_PCIe_BRIDGE:
@@ -469,7 +471,7 @@
         break;
 
     case DEV_TYPE_PCI:
-        ret = find_upstream_bridge(&bus, &devfn, &secbus);
+        ret = find_upstream_bridge(seg, &bus, &devfn, &secbus);
         if ( ret == 0 ) /* integrated PCI device */
         {
             set_ire_sid(ire, SVT_VERIFY_SID_SQ, SQ_ALL_16,
@@ -477,19 +479,20 @@
         }
         else if ( ret == 1 ) /* find upstream bridge */
         {
-            if ( pdev_type(bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE )
+            if ( pdev_type(seg, bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE )
                 set_ire_sid(ire, SVT_VERIFY_BUS, SQ_ALL_16,
                             (bus << 8) | pdev->bus);
-            else if ( pdev_type(bus, devfn) == DEV_TYPE_LEGACY_PCI_BRIDGE )
+            else if ( pdev_type(seg, bus, devfn) == DEV_TYPE_LEGACY_PCI_BRIDGE )
                 set_ire_sid(ire, SVT_VERIFY_BUS, SQ_ALL_16,
                             PCI_BDF2(bus, devfn));
         }
         break;
 
     default:
-        dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): bdf = %x:%x.%x\n",
+        dprintk(XENLOG_WARNING VTDPREFIX,
+                "d%d: unknown(%u): %04x:%02x:%02x.%u\n",
                 pdev->domain->domain_id, type,
-                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         break;
    }
 }
diff -r 9e0259239822 -r 314b147d524d xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Thu Sep 22 18:28:03 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Sep 22 18:28:38 2011 +0100
@@ -50,7 +50,7 @@
 
 int nr_iommus;
 
-static void setup_dom0_devices(struct domain *d);
+static void setup_dom0_device(struct pci_dev *);
 static void setup_dom0_rmrr(struct domain *d);
 
 static int domain_iommu_domid(struct domain *d,
@@ -1234,7 +1234,7 @@
         iommu_set_dom0_mapping(d);
     }
 
-    setup_dom0_devices(d);
+    setup_dom0_pci_devices(d, setup_dom0_device);
     setup_dom0_rmrr(d);
 
     iommu_flush_all();
@@ -1402,7 +1402,7 @@
 
     ASSERT(spin_is_locked(&pcidevs_lock));
 
-    type = pdev_type(bus, devfn);
+    type = pdev_type(seg, bus, devfn);
     switch ( type )
     {
     case DEV_TYPE_PCIe_BRIDGE:
@@ -1431,7 +1431,7 @@
         if ( ret )
             break;
 
-        if ( find_upstream_bridge(&bus, &devfn, &secbus) < 1 )
+        if ( find_upstream_bridge(seg, &bus, &devfn, &secbus) < 1 )
             break;
 
         ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
@@ -1441,7 +1441,7 @@
          * requester-id. It may originate from devfn=0 on the secondary bus
          * behind the bridge. Map that id as well if we didn't already.
          */
-        if ( !ret && pdev_type(bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE &&
+        if ( !ret && pdev_type(seg, bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE &&
              (secbus != pdev->bus || pdev->devfn != 0) )
             ret = domain_context_mapping_one(domain, drhd->iommu, secbus, 0);
 
@@ -1533,7 +1533,7 @@
         return -ENODEV;
     iommu = drhd->iommu;
 
-    type = pdev_type(bus, devfn);
+    type = pdev_type(seg, bus, devfn);
     switch ( type )
     {
     case DEV_TYPE_PCIe_BRIDGE:
@@ -1562,11 +1562,11 @@
 
         tmp_bus = bus;
         tmp_devfn = devfn;
-        if ( find_upstream_bridge(&tmp_bus, &tmp_devfn, &secbus) < 1 )
+        if ( find_upstream_bridge(seg, &tmp_bus, &tmp_devfn, &secbus) < 1 )
             break;
 
         /* PCIe to PCI/PCIx bridge */
-        if ( pdev_type(tmp_bus, tmp_devfn) == DEV_TYPE_PCIe2PCI_BRIDGE )
+        if ( pdev_type(seg, tmp_bus, tmp_devfn) == DEV_TYPE_PCIe2PCI_BRIDGE )
         {
             ret = domain_context_unmap_one(domain, iommu, tmp_bus, tmp_devfn);
             if ( ret )
@@ -1939,28 +1939,11 @@
                                 pdev->devfn);
 }
 
-static void __init setup_dom0_devices(struct domain *d)
+static void __init setup_dom0_device(struct pci_dev *pdev)
 {
-    struct pci_dev *pdev;
-    int bus, devfn;
-
-    spin_lock(&pcidevs_lock);
-    for ( bus = 0; bus < 256; bus++ )
-    {
-        for ( devfn = 0; devfn < 256; devfn++ )
-        {
-            pdev = pci_get_pdev(0, bus, devfn);
-            if ( !pdev )
-                continue;
-
-            pdev->domain = d;
-            list_add(&pdev->domain_list, &d->arch.pdev_list);
-            domain_context_mapping(d, pdev->seg, pdev->bus, pdev->devfn);
-            pci_enable_acs(pdev);
-            pci_vtd_quirk(pdev);
-        }
-    }
-    spin_unlock(&pcidevs_lock);
+    domain_context_mapping(pdev->domain, pdev->seg, pdev->bus, pdev->devfn);
+    pci_enable_acs(pdev);
+    pci_vtd_quirk(pdev);
 }
 
 void clear_fault_bits(struct iommu *iommu)
@@ -2227,7 +2210,7 @@
 static int intel_iommu_group_id(u16 seg, u8 bus, u8 devfn)
 {
     u8 secbus;
-    if ( find_upstream_bridge(&bus, &devfn, &secbus) < 0 )
+    if ( find_upstream_bridge(seg, &bus, &devfn, &secbus) < 0 )
         return -1;
     else
         return PCI_BDF2(bus, devfn);
diff -r 9e0259239822 -r 314b147d524d xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Thu Sep 22 18:28:03 2011 +0100
+++ b/xen/include/xen/pci.h	Thu Sep 22 18:28:38 2011 +0100
@@ -82,13 +82,15 @@
     DEV_TYPE_PCI,
 };
 
-int pci_device_detect(u8 bus, u8 dev, u8 func);
+int pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func);
 int scan_pci_devices(void);
-int pdev_type(u8 bus, u8 devfn);
-int find_upstream_bridge(u8 *bus, u8 *devfn, u8 *secbus);
-struct pci_dev *pci_lock_pdev(int bus, int devfn);
-struct pci_dev *pci_lock_domain_pdev(struct domain *d, int bus, int devfn);
+int pdev_type(u16 seg, u8 bus, u8 devfn);
+int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus);
+struct pci_dev *pci_lock_pdev(int seg, int bus, int devfn);
+struct pci_dev *pci_lock_domain_pdev(
+    struct domain *, int seg, int bus, int devfn);
 
+void setup_dom0_pci_devices(struct domain *, void (*)(struct pci_dev *));
 void pci_release_devices(struct domain *d);
 int pci_add_segment(u16 seg);
 int pci_add_device(u16 seg, u8 bus, u8 devfn, const struct pci_dev_info *);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:55:40 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:55:40 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jN6-0003HA-Gt; Tue, 27 Sep 2011 18:55:40 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMh-00039B-Mz
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1317174912!33001321!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8054 invoked from network); 28 Sep 2011 01:55:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMe-0000Rl-2k
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:12 +0100
Message-Id: <E1R8jMe-0000Rl-2k@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PCI multi-seg: AMD-IOMMU specific
	adjustments
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316712483 -3600
# Node ID 9e0259239822535680b88ab81cd9084238a29efb
# Parent  85418e16852723f6cc65082834061657f7149ea8
PCI multi-seg: AMD-IOMMU specific adjustments

There are two places here where it is entirely unclear to me where the
necessary PCI segment number should be taken from (as IVMD descriptors
don't have such, only IVHD ones do). AMD confirmed that for the time
being it is acceptable to imply that only segment 0 exists.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 85418e168527 -r 9e0259239822 xen/drivers/passthrough/amd/iommu_acpi.c
--- a/xen/drivers/passthrough/amd/iommu_acpi.c	Thu Sep 22 18:27:26 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c	Thu Sep 22 18:28:03 2011 +0100
@@ -30,6 +30,7 @@
 static void __init add_ivrs_mapping_entry(
     u16 bdf, u16 alias_id, u8 flags, struct amd_iommu *iommu)
 {
+    struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(iommu->seg);
     u8 sys_mgt, lint1_pass, lint0_pass, nmi_pass, ext_int_pass, init_pass;
     ASSERT( ivrs_mappings != NULL );
 
@@ -118,9 +119,10 @@
 }
 
 static void __init reserve_unity_map_for_device(
-    u16 bdf, unsigned long base,
+    u16 seg, u16 bdf, unsigned long base,
     unsigned long length, u8 iw, u8 ir)
 {
+    struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(seg);
     unsigned long old_top, new_top;
 
     /* need to extend unity-mapped range? */
@@ -147,6 +149,7 @@
 static int __init register_exclusion_range_for_all_devices(
     unsigned long base, unsigned long limit, u8 iw, u8 ir)
 {
+    int seg = 0; /* XXX */
     unsigned long range_top, iommu_top, length;
     struct amd_iommu *iommu;
     u16 bdf;
@@ -163,7 +166,7 @@
         /* reserve r/w unity-mapped page entries for devices */
         /* note: these entries are part of the exclusion range */
         for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
-            reserve_unity_map_for_device(bdf, base, length, iw, ir);
+            reserve_unity_map_for_device(seg, bdf, base, length, iw, ir);
         /* push 'base' just outside of virtual address space */
         base = iommu_top;
     }
@@ -180,11 +183,13 @@
 static int __init register_exclusion_range_for_device(
     u16 bdf, unsigned long base, unsigned long limit, u8 iw, u8 ir)
 {
+    int seg = 0; /* XXX */
+    struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(seg);
     unsigned long range_top, iommu_top, length;
     struct amd_iommu *iommu;
     u16 req;
 
-    iommu = find_iommu_for_device(bdf);
+    iommu = find_iommu_for_device(seg, bdf);
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("IVMD Error: No IOMMU for Dev_Id 0x%x!\n", bdf);
@@ -202,8 +207,8 @@
         length = range_top - base;
         /* reserve unity-mapped page entries for device */
         /* note: these entries are part of the exclusion range */
-        reserve_unity_map_for_device(bdf, base, length, iw, ir);
-        reserve_unity_map_for_device(req, base, length, iw, ir);
+        reserve_unity_map_for_device(seg, bdf, base, length, iw, ir);
+        reserve_unity_map_for_device(seg, req, base, length, iw, ir);
 
         /* push 'base' just outside of virtual address space */
         base = iommu_top;
@@ -240,11 +245,13 @@
         /* note: these entries are part of the exclusion range */
         for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
         {
-            if ( iommu == find_iommu_for_device(bdf) )
+            if ( iommu == find_iommu_for_device(iommu->seg, bdf) )
             {
-                reserve_unity_map_for_device(bdf, base, length, iw, ir);
-                req = ivrs_mappings[bdf].dte_requestor_id;
-                reserve_unity_map_for_device(req, base, length, iw, ir);
+                reserve_unity_map_for_device(iommu->seg, bdf, base, length,
+                                             iw, ir);
+                req = get_ivrs_mappings(iommu->seg)[bdf].dte_requestor_id;
+                reserve_unity_map_for_device(iommu->seg, req, base, length,
+                                             iw, ir);
             }
         }
 
@@ -627,7 +634,7 @@
 }
 
 static u16 __init parse_ivhd_device_special(
-    union acpi_ivhd_device *ivhd_device,
+    union acpi_ivhd_device *ivhd_device, u16 seg,
     u16 header_length, u16 block_length, struct amd_iommu *iommu)
 {
     u16 dev_length, bdf;
@@ -648,7 +655,8 @@
 
     add_ivrs_mapping_entry(bdf, bdf, ivhd_device->header.flags, iommu);
     /* set device id of ioapic */
-    ioapic_bdf[ivhd_device->special.handle] = bdf;
+    ioapic_sbdf[ivhd_device->special.handle].bdf = bdf;
+    ioapic_sbdf[ivhd_device->special.handle].seg = seg;
     return dev_length;
 }
 
@@ -729,7 +737,7 @@
             break;
         case AMD_IOMMU_ACPI_IVHD_DEV_SPECIAL:
             dev_length = parse_ivhd_device_special(
-                ivhd_device,
+                ivhd_device, ivhd_block->pci_segment,
                 ivhd_block->header.length, block_length, iommu);
             break;
         default:
diff -r 85418e168527 -r 9e0259239822 xen/drivers/passthrough/amd/iommu_detect.c
--- a/xen/drivers/passthrough/amd/iommu_detect.c	Thu Sep 22 18:27:26 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_detect.c	Thu Sep 22 18:28:03 2011 +0100
@@ -27,8 +27,8 @@
 #include <asm/hvm/svm/amd-iommu-proto.h>
 #include <asm/hvm/svm/amd-iommu-acpi.h>
 
-static int __init get_iommu_msi_capabilities(u8 bus, u8 dev, u8 func,
-            struct amd_iommu *iommu)
+static int __init get_iommu_msi_capabilities(
+    u16 seg, u8 bus, u8 dev, u8 func, struct amd_iommu *iommu)
 {
     int cap_ptr, cap_id;
     u32 cap_header;
@@ -66,8 +66,8 @@
     return 0;
 }
 
-static int __init get_iommu_capabilities(u8 bus, u8 dev, u8 func, u8 cap_ptr,
-                                  struct amd_iommu *iommu)
+static int __init get_iommu_capabilities(
+    u16 seg, u8 bus, u8 dev, u8 func, u8 cap_ptr, struct amd_iommu *iommu)
 {
     u32 cap_header, cap_range, misc_info;
 
@@ -121,6 +121,11 @@
 
     spin_lock_init(&iommu->lock);
 
+    iommu->seg = ivhd_block->pci_segment;
+    if (alloc_ivrs_mappings(ivhd_block->pci_segment)) {
+        xfree(iommu);
+        return -ENOMEM;
+    }
     iommu->bdf = ivhd_block->header.dev_id;
     iommu->cap_offset = ivhd_block->cap_offset;
     iommu->mmio_base_phys = ivhd_block->mmio_base;
@@ -147,8 +152,9 @@
     bus = iommu->bdf >> 8;
     dev = PCI_SLOT(iommu->bdf & 0xFF);
     func = PCI_FUNC(iommu->bdf & 0xFF);
-    get_iommu_capabilities(bus, dev, func, iommu->cap_offset, iommu);
-    get_iommu_msi_capabilities(bus, dev, func, iommu);
+    get_iommu_capabilities(iommu->seg, bus, dev, func,
+                           iommu->cap_offset, iommu);
+    get_iommu_msi_capabilities(iommu->seg, bus, dev, func, iommu);
 
     list_add_tail(&iommu->list, &amd_iommu_head);
 
diff -r 85418e168527 -r 9e0259239822 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Thu Sep 22 18:27:26 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Thu Sep 22 18:28:03 2011 +0100
@@ -32,7 +32,7 @@
 static int __initdata nr_amd_iommus;
 
 unsigned short ivrs_bdf_entries;
-struct ivrs_mappings *ivrs_mappings;
+static struct radix_tree_root ivrs_maps;
 struct list_head amd_iommu_head;
 struct table_struct device_table;
 
@@ -692,7 +692,6 @@
 static void __init amd_iommu_init_cleanup(void)
 {
     struct amd_iommu *iommu, *next;
-    int bdf;
 
     /* free amd iommu list */
     list_for_each_entry_safe ( iommu, next, &amd_iommu_head, list )
@@ -708,40 +707,84 @@
     }
 
     /* free interrupt remapping table */
-    for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
-    {
-        if ( ivrs_mappings[bdf].intremap_table )
-            amd_iommu_free_intremap_table(bdf);
-    }
+    iterate_ivrs_entries(amd_iommu_free_intremap_table);
 
     /* free device table */
     deallocate_iommu_table_struct(&device_table);
 
     /* free ivrs_mappings[] */
-    if ( ivrs_mappings )
-    {
-        xfree(ivrs_mappings);
-        ivrs_mappings = NULL;
-    }
+    radix_tree_destroy(&ivrs_maps, xfree);
 
     iommu_enabled = 0;
     iommu_passthrough = 0;
     iommu_intremap = 0;
 }
 
-static int __init init_ivrs_mapping(void)
+/*
+ * We allocate an extra array element to store the segment number
+ * (and in the future perhaps other global information).
+ */
+#define IVRS_MAPPINGS_SEG(m) m[ivrs_bdf_entries].dte_requestor_id
+
+struct ivrs_mappings *get_ivrs_mappings(u16 seg)
 {
+    return radix_tree_lookup(&ivrs_maps, seg);
+}
+
+int iterate_ivrs_mappings(int (*handler)(u16 seg, struct ivrs_mappings *))
+{
+    u16 seg = 0;
+    int rc = 0;
+
+    do {
+        struct ivrs_mappings *map;
+
+        if ( !radix_tree_gang_lookup(&ivrs_maps, (void **)&map, seg, 1) )
+            break;
+        seg = IVRS_MAPPINGS_SEG(map);
+        rc = handler(seg, map);
+    } while ( !rc && ++seg );
+
+    return rc;
+}
+
+int iterate_ivrs_entries(int (*handler)(u16 seg, struct ivrs_mappings *))
+{
+    u16 seg = 0;
+    int rc = 0;
+
+    do {
+        struct ivrs_mappings *map;
+        int bdf;
+
+        if ( !radix_tree_gang_lookup(&ivrs_maps, (void **)&map, seg, 1) )
+            break;
+        seg = IVRS_MAPPINGS_SEG(map);
+        for ( bdf = 0; !rc && bdf < ivrs_bdf_entries; ++bdf )
+            rc = handler(seg, map + bdf);
+    } while ( !rc && ++seg );
+
+    return rc;
+}
+
+int __init alloc_ivrs_mappings(u16 seg)
+{
+    struct ivrs_mappings *ivrs_mappings;
     int bdf;
 
     BUG_ON( !ivrs_bdf_entries );
 
-    ivrs_mappings = xmalloc_array( struct ivrs_mappings, ivrs_bdf_entries);
+    if ( get_ivrs_mappings(seg) )
+        return 0;
+
+    ivrs_mappings = xmalloc_array(struct ivrs_mappings, ivrs_bdf_entries + 1);
     if ( ivrs_mappings == NULL )
     {
         AMD_IOMMU_DEBUG("Error allocating IVRS Mappings table\n");
         return -ENOMEM;
     }
     memset(ivrs_mappings, 0, ivrs_bdf_entries * sizeof(struct ivrs_mappings));
+    IVRS_MAPPINGS_SEG(ivrs_mappings) = seg;
 
     /* assign default values for device entries */
     for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
@@ -763,10 +806,14 @@
         if ( amd_iommu_perdev_intremap )
             spin_lock_init(&ivrs_mappings[bdf].intremap_lock);
     }
+
+    radix_tree_insert(&ivrs_maps, seg, ivrs_mappings);
+
     return 0;
 }
 
-static int __init amd_iommu_setup_device_table(void)
+static int __init amd_iommu_setup_device_table(
+    u16 seg, struct ivrs_mappings *ivrs_mappings)
 {
     int bdf;
     void *intr_tb, *dte;
@@ -832,7 +879,8 @@
     if ( !ivrs_bdf_entries )
         goto error_out;
 
-    if ( init_ivrs_mapping() != 0 )
+    radix_tree_init(&ivrs_maps);
+    if ( alloc_ivrs_mappings(0) != 0 )
         goto error_out;
 
     if ( amd_iommu_update_ivrs_mapping_acpi() != 0 )
@@ -843,7 +891,7 @@
         goto error_out;
 
     /* allocate and initialize a global device table shared by all iommus */
-    if ( amd_iommu_setup_device_table() != 0 )
+    if ( iterate_ivrs_mappings(amd_iommu_setup_device_table) != 0 )
         goto error_out;
 
     /* per iommu initialization  */
@@ -888,7 +936,8 @@
         amd_iommu_flush_all_pages(d);
 }
 
-static void invalidate_all_devices(void)
+static int _invalidate_all_devices(
+    u16 seg, struct ivrs_mappings *ivrs_mappings)
 {
     int bdf, req_id;
     unsigned long flags;
@@ -896,7 +945,7 @@
 
     for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
     {
-        iommu = find_iommu_for_device(bdf);
+        iommu = find_iommu_for_device(seg, bdf);
         req_id = ivrs_mappings[bdf].dte_requestor_id;
         if ( iommu )
         {
@@ -907,6 +956,13 @@
             spin_unlock_irqrestore(&iommu->lock, flags);
         }
     }
+
+    return 0;
+}
+
+static void invalidate_all_devices(void)
+{
+    iterate_ivrs_mappings(_invalidate_all_devices);
 }
 
 void amd_iommu_suspend(void)
diff -r 85418e168527 -r 9e0259239822 xen/drivers/passthrough/amd/iommu_intr.c
--- a/xen/drivers/passthrough/amd/iommu_intr.c	Thu Sep 22 18:27:26 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_intr.c	Thu Sep 22 18:28:03 2011 +0100
@@ -27,21 +27,21 @@
 #define INTREMAP_LENGTH 0xB
 #define INTREMAP_ENTRIES (1 << INTREMAP_LENGTH)
 
-int ioapic_bdf[MAX_IO_APICS];
+struct ioapic_sbdf ioapic_sbdf[MAX_IO_APICS];
 void *shared_intremap_table;
 static DEFINE_SPINLOCK(shared_intremap_lock);
 
-static spinlock_t* get_intremap_lock(int req_id)
+static spinlock_t* get_intremap_lock(int seg, int req_id)
 {
     return (amd_iommu_perdev_intremap ?
-           &ivrs_mappings[req_id].intremap_lock:
+           &get_ivrs_mappings(seg)[req_id].intremap_lock:
            &shared_intremap_lock);
 }
 
-static int get_intremap_requestor_id(int bdf)
+static int get_intremap_requestor_id(int seg, int bdf)
 {
     ASSERT( bdf < ivrs_bdf_entries );
-    return ivrs_mappings[bdf].dte_requestor_id;
+    return get_ivrs_mappings(seg)[bdf].dte_requestor_id;
 }
 
 static int get_intremap_offset(u8 vector, u8 dm)
@@ -53,20 +53,20 @@
     return offset;
 }
 
-static u8 *get_intremap_entry(int bdf, int offset)
+static u8 *get_intremap_entry(int seg, int bdf, int offset)
 {
     u8 *table;
 
-    table = (u8*)ivrs_mappings[bdf].intremap_table;
+    table = (u8*)get_ivrs_mappings(seg)[bdf].intremap_table;
     ASSERT( (table != NULL) && (offset < INTREMAP_ENTRIES) );
 
     return (u8*) (table + offset);
 }
 
-static void free_intremap_entry(int bdf, int offset)
+static void free_intremap_entry(int seg, int bdf, int offset)
 {
     u32* entry;
-    entry = (u32*)get_intremap_entry(bdf, offset);
+    entry = (u32*)get_intremap_entry(seg, bdf, offset);
     memset(entry, 0, sizeof(u32));
 }
 
@@ -125,8 +125,8 @@
     spinlock_t *lock;
     int offset;
 
-    req_id = get_intremap_requestor_id(bdf);
-    lock = get_intremap_lock(req_id);
+    req_id = get_intremap_requestor_id(iommu->seg, bdf);
+    lock = get_intremap_lock(iommu->seg, req_id);
 
     delivery_mode = rte->delivery_mode;
     vector = rte->vector;
@@ -136,7 +136,7 @@
     spin_lock_irqsave(lock, flags);
 
     offset = get_intremap_offset(vector, delivery_mode);
-    entry = (u32*)get_intremap_entry(req_id, offset);
+    entry = (u32*)get_intremap_entry(iommu->seg, req_id, offset);
     update_intremap_entry(entry, vector, delivery_mode, dest_mode, dest);
 
     spin_unlock_irqrestore(lock, flags);
@@ -157,7 +157,7 @@
     u32* entry;
     int apic, pin;
     u8 delivery_mode, dest, vector, dest_mode;
-    u16 bdf, req_id;
+    u16 seg, bdf, req_id;
     struct amd_iommu *iommu;
     spinlock_t *lock;
     int offset;
@@ -174,17 +174,18 @@
                 continue;
 
             /* get device id of ioapic devices */
-            bdf = ioapic_bdf[IO_APIC_ID(apic)];
-            iommu = find_iommu_for_device(bdf);
+            bdf = ioapic_sbdf[IO_APIC_ID(apic)].bdf;
+            seg = ioapic_sbdf[IO_APIC_ID(apic)].seg;
+            iommu = find_iommu_for_device(seg, bdf);
             if ( !iommu )
             {
                 AMD_IOMMU_DEBUG("Fail to find iommu for ioapic "
-                                "device id = 0x%x\n", bdf);
+                                "device id = %04x:%04x\n", seg, bdf);
                 continue;
             }
 
-            req_id = get_intremap_requestor_id(bdf);
-            lock = get_intremap_lock(req_id);
+            req_id = get_intremap_requestor_id(iommu->seg, bdf);
+            lock = get_intremap_lock(iommu->seg, req_id);
 
             delivery_mode = rte.delivery_mode;
             vector = rte.vector;
@@ -193,7 +194,7 @@
 
             spin_lock_irqsave(lock, flags);
             offset = get_intremap_offset(vector, delivery_mode);
-            entry = (u32*)get_intremap_entry(req_id, offset);
+            entry = (u32*)get_intremap_entry(iommu->seg, req_id, offset);
             update_intremap_entry(entry, vector,
                                   delivery_mode, dest_mode, dest);
             spin_unlock_irqrestore(lock, flags);
@@ -216,7 +217,7 @@
     struct IO_APIC_route_entry old_rte = { 0 };
     struct IO_APIC_route_entry new_rte = { 0 };
     unsigned int rte_lo = (reg & 1) ? reg - 1 : reg;
-    int saved_mask, bdf;
+    int saved_mask, seg, bdf;
     struct amd_iommu *iommu;
 
     if ( !iommu_intremap )
@@ -226,12 +227,13 @@
     }
 
     /* get device id of ioapic devices */
-    bdf = ioapic_bdf[IO_APIC_ID(apic)];
-    iommu = find_iommu_for_device(bdf);
+    bdf = ioapic_sbdf[IO_APIC_ID(apic)].bdf;
+    seg = ioapic_sbdf[IO_APIC_ID(apic)].seg;
+    iommu = find_iommu_for_device(seg, bdf);
     if ( !iommu )
     {
-        AMD_IOMMU_DEBUG("Fail to find iommu for ioapic device id = 0x%x\n",
-                        bdf);
+        AMD_IOMMU_DEBUG("Fail to find iommu for ioapic device id ="
+                        " %04x:%04x\n", seg, bdf);
         __io_apic_write(apic, reg, value);
         return;
     }
@@ -289,28 +291,28 @@
     int offset;
 
     bdf = (pdev->bus << 8) | pdev->devfn;
-    req_id = get_dma_requestor_id(bdf);
-    alias_id = get_intremap_requestor_id(bdf);
+    req_id = get_dma_requestor_id(pdev->seg, bdf);
+    alias_id = get_intremap_requestor_id(pdev->seg, bdf);
 
     if ( msg == NULL )
     {
-        lock = get_intremap_lock(req_id);
+        lock = get_intremap_lock(iommu->seg, req_id);
         spin_lock_irqsave(lock, flags);
-        free_intremap_entry(req_id, msi_desc->remap_index);
+        free_intremap_entry(iommu->seg, req_id, msi_desc->remap_index);
         spin_unlock_irqrestore(lock, flags);
 
         if ( ( req_id != alias_id ) &&
-            ivrs_mappings[alias_id].intremap_table != NULL )
+             get_ivrs_mappings(pdev->seg)[alias_id].intremap_table != NULL )
         {
-            lock = get_intremap_lock(alias_id);
+            lock = get_intremap_lock(iommu->seg, alias_id);
             spin_lock_irqsave(lock, flags);
-            free_intremap_entry(alias_id, msi_desc->remap_index);
+            free_intremap_entry(iommu->seg, alias_id, msi_desc->remap_index);
             spin_unlock_irqrestore(lock, flags);
         }
         goto done;
     }
 
-    lock = get_intremap_lock(req_id);
+    lock = get_intremap_lock(iommu->seg, req_id);
 
     spin_lock_irqsave(lock, flags);
     dest_mode = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT) & 0x1;
@@ -320,7 +322,7 @@
     offset = get_intremap_offset(vector, delivery_mode);
     msi_desc->remap_index = offset;
 
-    entry = (u32*)get_intremap_entry(req_id, offset);
+    entry = (u32*)get_intremap_entry(iommu->seg, req_id, offset);
     update_intremap_entry(entry, vector, delivery_mode, dest_mode, dest);
     spin_unlock_irqrestore(lock, flags);
 
@@ -331,12 +333,12 @@
      * devices.
      */
 
-    lock = get_intremap_lock(alias_id);
+    lock = get_intremap_lock(iommu->seg, alias_id);
     if ( ( req_id != alias_id ) &&
-        ivrs_mappings[alias_id].intremap_table != NULL )
+         get_ivrs_mappings(pdev->seg)[alias_id].intremap_table != NULL )
     {
         spin_lock_irqsave(lock, flags);
-        entry = (u32*)get_intremap_entry(alias_id, offset);
+        entry = (u32*)get_intremap_entry(iommu->seg, alias_id, offset);
         update_intremap_entry(entry, vector, delivery_mode, dest_mode, dest);
         spin_unlock_irqrestore(lock, flags);
     }
@@ -362,7 +364,7 @@
     if ( !iommu_intremap )
         return;
 
-    iommu = find_iommu_for_device((pdev->bus << 8) | pdev->devfn);
+    iommu = find_iommu_for_device(pdev->seg, (pdev->bus << 8) | pdev->devfn);
 
     if ( !iommu )
     {
@@ -379,15 +381,18 @@
 {
 }
 
-void __init amd_iommu_free_intremap_table(int bdf)
+int __init amd_iommu_free_intremap_table(
+    u16 seg, struct ivrs_mappings *ivrs_mapping)
 {
-    void *tb = ivrs_mappings[bdf].intremap_table;
+    void *tb = ivrs_mapping->intremap_table;
 
     if ( tb )
     {
         __free_amd_iommu_tables(tb, INTREMAP_TABLE_ORDER);
-        ivrs_mappings[bdf].intremap_table = NULL;
+        ivrs_mapping->intremap_table = NULL;
     }
+
+    return 0;
 }
 
 void* __init amd_iommu_alloc_intremap_table(void)
diff -r 85418e168527 -r 9e0259239822 xen/drivers/passthrough/amd/iommu_map.c
--- a/xen/drivers/passthrough/amd/iommu_map.c	Thu Sep 22 18:27:26 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_map.c	Thu Sep 22 18:28:03 2011 +0100
@@ -719,8 +719,8 @@
         for_each_pdev( d, pdev )
         {
             bdf = (pdev->bus << 8) | pdev->devfn;
-            req_id = get_dma_requestor_id(bdf);
-            iommu = find_iommu_for_device(bdf);
+            req_id = get_dma_requestor_id(pdev->seg, bdf);
+            iommu = find_iommu_for_device(pdev->seg, bdf);
             if ( !iommu )
             {
                 AMD_IOMMU_DEBUG("%s Fail to find iommu.\n", __func__);
diff -r 85418e168527 -r 9e0259239822 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Thu Sep 22 18:27:26 2011 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Thu Sep 22 18:28:03 2011 +0100
@@ -29,10 +29,12 @@
 extern bool_t __read_mostly opt_irq_perdev_vector_map;
 extern bool_t __read_mostly iommu_amd_perdev_vector_map;
 
-struct amd_iommu *find_iommu_for_device(int bdf)
+struct amd_iommu *find_iommu_for_device(int seg, int bdf)
 {
+    struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(seg);
+
     BUG_ON ( bdf >= ivrs_bdf_entries );
-    return ivrs_mappings[bdf].iommu;
+    return ivrs_mappings ? ivrs_mappings[bdf].iommu : NULL;
 }
 
 /*
@@ -43,8 +45,9 @@
  * Return original device id, if device has valid interrupt remapping
  * table setup for both select entry and alias entry.
  */
-int get_dma_requestor_id(u16 bdf)
+int get_dma_requestor_id(u16 seg, u16 bdf)
 {
+    struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(seg);
     int req_id;
 
     BUG_ON ( bdf >= ivrs_bdf_entries );
@@ -95,7 +98,7 @@
         valid = 0;
 
     /* get device-table entry */
-    req_id = get_dma_requestor_id(bdf);
+    req_id = get_dma_requestor_id(iommu->seg, bdf);
     dte = iommu->dev_table.buffer + (req_id * IOMMU_DEV_TABLE_ENTRY_SIZE);
 
     spin_lock_irqsave(&iommu->lock, flags);
@@ -139,7 +142,7 @@
             list_add(&pdev->domain_list, &d->arch.pdev_list);
 
             bdf = (bus << 8) | devfn;
-            iommu = find_iommu_for_device(bdf);
+            iommu = find_iommu_for_device(pdev->seg, bdf);
 
             if ( likely(iommu != NULL) )
                 amd_iommu_setup_domain_device(d, iommu, bdf);
@@ -287,7 +290,7 @@
     int req_id;
 
     BUG_ON ( iommu->dev_table.buffer == NULL );
-    req_id = get_dma_requestor_id(bdf);
+    req_id = get_dma_requestor_id(iommu->seg, bdf);
     dte = iommu->dev_table.buffer + (req_id * IOMMU_DEV_TABLE_ENTRY_SIZE);
 
     spin_lock_irqsave(&iommu->lock, flags);
@@ -318,12 +321,12 @@
         return -ENODEV;
 
     bdf = (bus << 8) | devfn;
-    iommu = find_iommu_for_device(bdf);
+    iommu = find_iommu_for_device(seg, bdf);
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("Fail to find iommu."
-                        " %02x:%x02.%x cannot be assigned to domain %d\n", 
-                        bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                        " %04x:%02x:%x02.%x cannot be assigned to dom%d\n",
+                        seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
                         target->domain_id);
         return -ENODEV;
     }
@@ -339,8 +342,8 @@
         allocate_domain_resources(t);
 
     amd_iommu_setup_domain_device(target, iommu, bdf);
-    AMD_IOMMU_DEBUG("Re-assign %02x:%02x.%x from domain %d to domain %d\n",
-                    bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+    AMD_IOMMU_DEBUG("Re-assign %04x:%02x:%02x.%u from dom%d to dom%d\n",
+                    seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
                     source->domain_id, target->domain_id);
 
     return 0;
@@ -348,8 +351,9 @@
 
 static int amd_iommu_assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn)
 {
+    struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(seg);
     int bdf = (bus << 8) | devfn;
-    int req_id = get_dma_requestor_id(bdf);
+    int req_id = get_dma_requestor_id(seg, bdf);
 
     if ( ivrs_mappings[req_id].unity_map_enable )
     {
@@ -439,12 +443,12 @@
         return -EINVAL;
 
     bdf = (pdev->bus << 8) | pdev->devfn;
-    iommu = find_iommu_for_device(bdf);
+    iommu = find_iommu_for_device(pdev->seg, bdf);
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("Fail to find iommu."
-                        " %02x:%02x.%x cannot be assigned to domain %d\n", 
-                        pdev->bus, PCI_SLOT(pdev->devfn),
+                        " %04x:%02x:%02x.%u cannot be assigned to dom%d\n",
+                        pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
                         PCI_FUNC(pdev->devfn), pdev->domain->domain_id);
         return -ENODEV;
     }
@@ -461,12 +465,12 @@
         return -EINVAL;
 
     bdf = (pdev->bus << 8) | pdev->devfn;
-    iommu = find_iommu_for_device(bdf);
+    iommu = find_iommu_for_device(pdev->seg, bdf);
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("Fail to find iommu."
-                        " %02x:%02x.%x cannot be removed from domain %d\n", 
-                        pdev->bus, PCI_SLOT(pdev->devfn),
+                        " %04x:%02x:%02x.%u cannot be removed from dom%d\n",
+                        pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
                         PCI_FUNC(pdev->devfn), pdev->domain->domain_id);
         return -ENODEV;
     }
@@ -480,7 +484,7 @@
     int rt;
     int bdf = (bus << 8) | devfn;
     rt = ( bdf < ivrs_bdf_entries ) ?
-        get_dma_requestor_id(bdf) :
+        get_dma_requestor_id(seg, bdf) :
         bdf;
     return rt;
 }
diff -r 85418e168527 -r 9e0259239822 xen/include/asm-x86/amd-iommu.h
--- a/xen/include/asm-x86/amd-iommu.h	Thu Sep 22 18:27:26 2011 +0100
+++ b/xen/include/asm-x86/amd-iommu.h	Thu Sep 22 18:28:03 2011 +0100
@@ -40,6 +40,7 @@
     struct list_head list;
     spinlock_t lock; /* protect iommu */
 
+    u16 seg;
     u16 bdf;
     u8  cap_offset;
     u8  revision;
@@ -101,6 +102,10 @@
 };
 
 extern unsigned short ivrs_bdf_entries;
-extern struct ivrs_mappings *ivrs_mappings;
+
+int alloc_ivrs_mappings(u16 seg);
+struct ivrs_mappings *get_ivrs_mappings(u16 seg);
+int iterate_ivrs_mappings(int (*)(u16 seg, struct ivrs_mappings *));
+int iterate_ivrs_entries(int (*)(u16 seg, struct ivrs_mappings *));
 
 #endif /* _ASM_X86_64_AMD_IOMMU_H */
diff -r 85418e168527 -r 9e0259239822 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Thu Sep 22 18:27:26 2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Thu Sep 22 18:28:03 2011 +0100
@@ -65,7 +65,7 @@
 void amd_iommu_share_p2m(struct domain *d);
 
 /* device table functions */
-int get_dma_requestor_id(u16 bdf);
+int get_dma_requestor_id(u16 seg, u16 bdf);
 void amd_iommu_add_dev_table_entry(
     u32 *dte, u8 sys_mgt, u8 dev_ex, u8 lint1_pass, u8 lint0_pass, 
     u8 nmi_pass, u8 ext_int_pass, u8 init_pass);
@@ -80,12 +80,12 @@
 void flush_command_buffer(struct amd_iommu *iommu);
 
 /* find iommu for bdf */
-struct amd_iommu *find_iommu_for_device(int bdf);
+struct amd_iommu *find_iommu_for_device(int seg, int bdf);
 
 /* interrupt remapping */
 int amd_iommu_setup_ioapic_remapping(void);
 void *amd_iommu_alloc_intremap_table(void);
-void amd_iommu_free_intremap_table(int bdf);
+int amd_iommu_free_intremap_table(u16 seg, struct ivrs_mappings *);
 void invalidate_interrupt_table(struct amd_iommu *iommu, u16 device_id);
 void amd_iommu_ioapic_update_ire(
     unsigned int apic, unsigned int reg, unsigned int value);
@@ -94,7 +94,9 @@
 void amd_iommu_read_msi_from_ire(
     struct msi_desc *msi_desc, struct msi_msg *msg);
 
-extern int ioapic_bdf[MAX_IO_APICS];
+extern struct ioapic_sbdf {
+    u16 bdf, seg;
+} ioapic_sbdf[MAX_IO_APICS];
 extern void *shared_intremap_table;
 
 /* power management support */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:55:54 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:55:54 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jNJ-0003KU-8X; Tue, 27 Sep 2011 18:55:53 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMi-00039F-TH
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1317174913!16716170!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29366 invoked from network); 28 Sep 2011 01:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMf-0000U6-PV
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:13 +0100
Message-Id: <E1R8jMf-0000U6-PV@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: IO-APIC code has no dependency
	on PCI
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316712662 -3600
# Node ID 47ec1d405af9e9c0491681c50bb622d1c1f0904d
# Parent  d6e01c7853cfc35e946c6aa7ab3e70336d7c29b0
x86: IO-APIC code has no dependency on PCI

The IRQ handling code requires pcidevs_lock to be held only for MSI
interrupts.

As the handling of which was now fully moved into msi.c (i.e. while
applying fine without, the patch needs to be applied after the one
titled "x86: split MSI IRQ chip"), io_apic.c now also doesn't need to
include PCI headers anymore.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r d6e01c7853cf -r 47ec1d405af9 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Thu Sep 22 18:29:19 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Thu Sep 22 18:31:02 2011 +0100
@@ -27,8 +27,6 @@
 #include <xen/delay.h>
 #include <xen/sched.h>
 #include <xen/acpi.h>
-#include <xen/pci.h>
-#include <xen/pci_regs.h>
 #include <xen/keyhandler.h>
 #include <asm/mc146818rtc.h>
 #include <asm/smp.h>
@@ -2491,12 +2489,10 @@
 
         add_pin_to_irq(irq, apic, pin);
     }
-    spin_lock(&pcidevs_lock);
     spin_lock(&dom0->event_lock);
     ret = map_domain_pirq(dom0, pirq, irq,
             MAP_PIRQ_TYPE_GSI, NULL);
     spin_unlock(&dom0->event_lock);
-    spin_unlock(&pcidevs_lock);
     if ( ret < 0 )
         return ret;
 
diff -r d6e01c7853cf -r 47ec1d405af9 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Thu Sep 22 18:29:19 2011 +0100
+++ b/xen/arch/x86/irq.c	Thu Sep 22 18:31:02 2011 +0100
@@ -1662,10 +1662,7 @@
     struct pirq *info;
     struct irq_desc *desc;
     unsigned long flags;
-    struct msi_desc *msi_desc;
-    struct pci_dev *pdev = NULL;
 
-    ASSERT(spin_is_locked(&pcidevs_lock));
     ASSERT(spin_is_locked(&d->event_lock));
 
     if ( !IS_PRIV(current->domain) &&
@@ -1708,6 +1705,10 @@
     if ( type == MAP_PIRQ_TYPE_MSI )
     {
         struct msi_info *msi = (struct msi_info *)data;
+        struct msi_desc *msi_desc;
+        struct pci_dev *pdev;
+
+        ASSERT(spin_is_locked(&pcidevs_lock));
 
         ret = -ENODEV;
         if ( !cpu_has_apic )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:56:09 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:56:09 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jNY-0003PB-PM; Tue, 27 Sep 2011 18:56:08 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMi-00039E-I2
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1317174913!19835167!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24675 invoked from network); 28 Sep 2011 01:55:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMf-0000TL-7K
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:13 +0100
Message-Id: <E1R8jMf-0000TL-7K@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PCI multi-seg: config space accessor
	adjustments
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316712559 -3600
# Node ID d6e01c7853cfc35e946c6aa7ab3e70336d7c29b0
# Parent  314b147d524d8a9fbf7fdebbb1648845b8c02379
PCI multi-seg: config space accessor adjustments

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 314b147d524d -r d6e01c7853cf xen/arch/x86/cpu/amd.c
--- a/xen/arch/x86/cpu/amd.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/arch/x86/cpu/amd.c	Thu Sep 22 18:29:19 2011 +0100
@@ -262,15 +262,15 @@
 	int node, nr_nodes;
 
 	/* Read the number of nodes from the first Northbridge. */
-	nr_nodes = ((pci_conf_read32(0, 0x18, 0x0, 0x60)>>4)&0x07)+1;
+	nr_nodes = ((pci_conf_read32(0, 0, 0x18, 0x0, 0x60)>>4)&0x07)+1;
 	for (node = 0; node < nr_nodes; node++) {
 		/* PMM7: bus=0, dev=0x18+node, function=0x3, register=0x87. */
-		pmm7 = pci_conf_read8(0, 0x18+node, 0x3, 0x87);
+		pmm7 = pci_conf_read8(0, 0, 0x18+node, 0x3, 0x87);
 		/* Invalid read means we've updated every Northbridge. */
 		if (pmm7 == 0xFF)
 			break;
 		pmm7 &= 0xFC; /* clear pmm7[1:0] */
-		pci_conf_write8(0, 0x18+node, 0x3, 0x87, pmm7);
+		pci_conf_write8(0, 0, 0x18+node, 0x3, 0x87, pmm7);
 		printk ("AMD: Disabling C1 Clock Ramping Node #%x\n", node);
 	}
 }
diff -r 314b147d524d -r d6e01c7853cf xen/arch/x86/dmi_scan.c
--- a/xen/arch/x86/dmi_scan.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/arch/x86/dmi_scan.c	Thu Sep 22 18:29:19 2011 +0100
@@ -284,15 +284,15 @@
 {
     u32 port, smictl;
 
-    if ( pci_conf_read16(0, 0x1f, 0, PCI_VENDOR_ID) != 0x8086 )
+    if ( pci_conf_read16(0, 0, 0x1f, 0, PCI_VENDOR_ID) != 0x8086 )
         return 0;
 
-    switch ( pci_conf_read16(0, 0x1f, 0, PCI_DEVICE_ID) ) {
+    switch ( pci_conf_read16(0, 0, 0x1f, 0, PCI_DEVICE_ID) ) {
     case 0x3a14:
     case 0x3a16:
     case 0x3a18:
     case 0x3a1a:
-        port = (pci_conf_read16(0, 0x1f, 0, 0x40) & 0xff80) + 0x30;
+        port = (pci_conf_read16(0, 0, 0x1f, 0, 0x40) & 0xff80) + 0x30;
         smictl = inl(port);
         /* turn off LEGACY_USB{,2}_EN if enabled */
         if ( smictl & 0x20008 )
diff -r 314b147d524d -r d6e01c7853cf xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/arch/x86/msi.c	Thu Sep 22 18:29:19 2011 +0100
@@ -166,23 +166,25 @@
     {
         struct pci_dev *dev = entry->dev;
         int pos = entry->msi_attrib.pos;
-        u16 data;
+        u16 data, seg = dev->seg;
         u8 bus = dev->bus;
         u8 slot = PCI_SLOT(dev->devfn);
         u8 func = PCI_FUNC(dev->devfn);
 
-        msg->address_lo = pci_conf_read32(bus, slot, func,
+        msg->address_lo = pci_conf_read32(seg, bus, slot, func,
                                           msi_lower_address_reg(pos));
         if ( entry->msi_attrib.is_64 )
         {
-            msg->address_hi = pci_conf_read32(bus, slot, func,
+            msg->address_hi = pci_conf_read32(seg, bus, slot, func,
                                               msi_upper_address_reg(pos));
-            data = pci_conf_read16(bus, slot, func, msi_data_reg(pos, 1));
+            data = pci_conf_read16(seg, bus, slot, func,
+                                   msi_data_reg(pos, 1));
         }
         else
         {
             msg->address_hi = 0;
-            data = pci_conf_read16(bus, slot, func, msi_data_reg(pos, 0));
+            data = pci_conf_read16(seg, bus, slot, func,
+                                   msi_data_reg(pos, 0));
         }
         msg->data = data;
         break;
@@ -218,21 +220,22 @@
     {
         struct pci_dev *dev = entry->dev;
         int pos = entry->msi_attrib.pos;
+        u16 seg = dev->seg;
         u8 bus = dev->bus;
         u8 slot = PCI_SLOT(dev->devfn);
         u8 func = PCI_FUNC(dev->devfn);
 
-        pci_conf_write32(bus, slot, func, msi_lower_address_reg(pos),
+        pci_conf_write32(seg, bus, slot, func, msi_lower_address_reg(pos),
                          msg->address_lo);
         if ( entry->msi_attrib.is_64 )
         {
-            pci_conf_write32(bus, slot, func, msi_upper_address_reg(pos),
+            pci_conf_write32(seg, bus, slot, func, msi_upper_address_reg(pos),
                              msg->address_hi);
-            pci_conf_write16(bus, slot, func, msi_data_reg(pos, 1),
+            pci_conf_write16(seg, bus, slot, func, msi_data_reg(pos, 1),
                              msg->data);
         }
         else
-            pci_conf_write16(bus, slot, func, msi_data_reg(pos, 0),
+            pci_conf_write16(seg, bus, slot, func, msi_data_reg(pos, 0),
                              msg->data);
         break;
     }
@@ -281,38 +284,38 @@
 static void msi_set_enable(struct pci_dev *dev, int enable)
 {
     int pos;
-    u16 control;
+    u16 control, seg = dev->seg;
     u8 bus = dev->bus;
     u8 slot = PCI_SLOT(dev->devfn);
     u8 func = PCI_FUNC(dev->devfn);
 
-    pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSI);
+    pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSI);
     if ( pos )
     {
-        control = pci_conf_read16(bus, slot, func, pos + PCI_MSI_FLAGS);
+        control = pci_conf_read16(seg, bus, slot, func, pos + PCI_MSI_FLAGS);
         control &= ~PCI_MSI_FLAGS_ENABLE;
         if ( enable )
             control |= PCI_MSI_FLAGS_ENABLE;
-        pci_conf_write16(bus, slot, func, pos + PCI_MSI_FLAGS, control);
+        pci_conf_write16(seg, bus, slot, func, pos + PCI_MSI_FLAGS, control);
     }
 }
 
 static void msix_set_enable(struct pci_dev *dev, int enable)
 {
     int pos;
-    u16 control;
+    u16 control, seg = dev->seg;
     u8 bus = dev->bus;
     u8 slot = PCI_SLOT(dev->devfn);
     u8 func = PCI_FUNC(dev->devfn);
 
-    pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSIX);
+    pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX);
     if ( pos )
     {
-        control = pci_conf_read16(bus, slot, func, pos + PCI_MSIX_FLAGS);
+        control = pci_conf_read16(seg, bus, slot, func, pos + PCI_MSIX_FLAGS);
         control &= ~PCI_MSIX_FLAGS_ENABLE;
         if ( enable )
             control |= PCI_MSIX_FLAGS_ENABLE;
-        pci_conf_write16(bus, slot, func, pos + PCI_MSIX_FLAGS, control);
+        pci_conf_write16(seg, bus, slot, func, pos + PCI_MSIX_FLAGS, control);
     }
 }
 
@@ -334,15 +337,16 @@
         if (entry->msi_attrib.maskbit) {
             int pos;
             u32 mask_bits;
+            u16 seg = entry->dev->seg;
             u8 bus = entry->dev->bus;
             u8 slot = PCI_SLOT(entry->dev->devfn);
             u8 func = PCI_FUNC(entry->dev->devfn);
 
             pos = (long)entry->mask_base;
-            mask_bits = pci_conf_read32(bus, slot, func, pos);
+            mask_bits = pci_conf_read32(seg, bus, slot, func, pos);
             mask_bits &= ~(1);
             mask_bits |= flag;
-            pci_conf_write32(bus, slot, func, pos, mask_bits);
+            pci_conf_write32(seg, bus, slot, func, pos, mask_bits);
         }
         break;
     case PCI_CAP_ID_MSIX:
@@ -365,7 +369,8 @@
     case PCI_CAP_ID_MSI:
         if (!entry->dev || !entry->msi_attrib.maskbit)
             break;
-        return pci_conf_read32(entry->dev->bus, PCI_SLOT(entry->dev->devfn),
+        return pci_conf_read32(entry->dev->seg, entry->dev->bus,
+                               PCI_SLOT(entry->dev->devfn),
                                PCI_FUNC(entry->dev->devfn),
                                (unsigned long)entry->mask_base) & 1;
     case PCI_CAP_ID_MSIX:
@@ -512,14 +517,14 @@
 {
     struct msi_desc *entry;
     int pos;
-    u16 control;
+    u16 control, seg = dev->seg;
     u8 bus = dev->bus;
     u8 slot = PCI_SLOT(dev->devfn);
     u8 func = PCI_FUNC(dev->devfn);
 
     ASSERT(spin_is_locked(&pcidevs_lock));
-    pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSI);
-    control = pci_conf_read16(bus, slot, func, msi_control_reg(pos));
+    pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSI);
+    control = pci_conf_read16(seg, bus, slot, func, msi_control_reg(pos));
     /* MSI Entry Initialization */
     msi_set_enable(dev, 0); /* Ensure msi is disabled as I set it up */
 
@@ -542,12 +547,12 @@
     {
         unsigned int maskbits, temp;
         /* All MSIs are unmasked by default, Mask them all */
-        maskbits = pci_conf_read32(bus, slot, func,
+        maskbits = pci_conf_read32(seg, bus, slot, func,
                                    msi_mask_bits_reg(pos, is_64bit_address(control)));
         temp = (1 << multi_msi_capable(control));
         temp = ((temp - 1) & ~temp);
         maskbits |= temp;
-        pci_conf_write32(bus, slot, func,
+        pci_conf_write32(seg, bus, slot, func,
                          msi_mask_bits_reg(pos, is_64bit_address(control)),
                          maskbits);
     }
@@ -555,27 +560,28 @@
 
     *desc = entry;
     /* Restore the original MSI enabled bits  */
-    pci_conf_write16(bus, slot, func, msi_control_reg(pos), control);
+    pci_conf_write16(seg, bus, slot, func, msi_control_reg(pos), control);
 
     return 0;
 }
 
-static u64 read_pci_mem_bar(u8 bus, u8 slot, u8 func, u8 bir, int vf)
+static u64 read_pci_mem_bar(u16 seg, u8 bus, u8 slot, u8 func, u8 bir, int vf)
 {
     u8 limit;
     u32 addr, base = PCI_BASE_ADDRESS_0, disp = 0;
 
     if ( vf >= 0 )
     {
-        struct pci_dev *pdev = pci_get_pdev(0, bus, PCI_DEVFN(slot, func));
-        unsigned int pos = pci_find_ext_capability(0, bus,
+        struct pci_dev *pdev = pci_get_pdev(seg, bus, PCI_DEVFN(slot, func));
+        unsigned int pos = pci_find_ext_capability(seg, bus,
                                                    PCI_DEVFN(slot, func),
                                                    PCI_EXT_CAP_ID_SRIOV);
-        u16 ctrl = pci_conf_read16(bus, slot, func, pos + PCI_SRIOV_CTRL);
-        u16 num_vf = pci_conf_read16(bus, slot, func, pos + PCI_SRIOV_NUM_VF);
-        u16 offset = pci_conf_read16(bus, slot, func,
+        u16 ctrl = pci_conf_read16(seg, bus, slot, func, pos + PCI_SRIOV_CTRL);
+        u16 num_vf = pci_conf_read16(seg, bus, slot, func,
+                                     pos + PCI_SRIOV_NUM_VF);
+        u16 offset = pci_conf_read16(seg, bus, slot, func,
                                      pos + PCI_SRIOV_VF_OFFSET);
-        u16 stride = pci_conf_read16(bus, slot, func,
+        u16 stride = pci_conf_read16(seg, bus, slot, func,
                                      pos + PCI_SRIOV_VF_STRIDE);
 
         if ( !pdev || !pos ||
@@ -601,7 +607,8 @@
         disp = vf * pdev->vf_rlen[bir];
         limit = PCI_SRIOV_NUM_BARS;
     }
-    else switch ( pci_conf_read8(bus, slot, func, PCI_HEADER_TYPE) & 0x7f )
+    else switch ( pci_conf_read8(seg, bus, slot, func,
+                                 PCI_HEADER_TYPE) & 0x7f )
     {
     case PCI_HEADER_TYPE_NORMAL:
         limit = 6;
@@ -618,7 +625,7 @@
 
     if ( bir >= limit )
         return 0;
-    addr = pci_conf_read32(bus, slot, func, base + bir * 4);
+    addr = pci_conf_read32(seg, bus, slot, func, base + bir * 4);
     if ( (addr & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO )
         return 0;
     if ( (addr & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == PCI_BASE_ADDRESS_MEM_TYPE_64 )
@@ -627,7 +634,8 @@
         if ( ++bir >= limit )
             return 0;
         return addr + disp +
-               ((u64)pci_conf_read32(bus, slot, func, base + bir * 4) << 32);
+               ((u64)pci_conf_read32(seg, bus, slot, func,
+                                     base + bir * 4) << 32);
     }
     return (addr & PCI_BASE_ADDRESS_MEM_MASK) + disp;
 }
@@ -655,6 +663,7 @@
     u8 bir;
     void __iomem *base;
     int idx;
+    u16 seg = dev->seg;
     u8 bus = dev->bus;
     u8 slot = PCI_SLOT(dev->devfn);
     u8 func = PCI_FUNC(dev->devfn);
@@ -662,8 +671,8 @@
     ASSERT(spin_is_locked(&pcidevs_lock));
     ASSERT(desc);
 
-    pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSIX);
-    control = pci_conf_read16(bus, slot, func, msix_control_reg(pos));
+    pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX);
+    control = pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos));
     msix_set_enable(dev, 0);/* Ensure msix is disabled as I set it up */
 
     /* MSI-X Table Initialization */
@@ -672,7 +681,8 @@
         return -ENOMEM;
 
     /* Request & Map MSI-X table region */
-    table_offset = pci_conf_read32(bus, slot, func, msix_table_offset_reg(pos));
+    table_offset = pci_conf_read32(seg, bus, slot, func,
+                                   msix_table_offset_reg(pos));
     bir = (u8)(table_offset & PCI_MSIX_BIRMASK);
     table_offset &= ~PCI_MSIX_BIRMASK;
     entry_offset = msi->entry_nr * PCI_MSIX_ENTRY_SIZE;
@@ -724,7 +734,7 @@
 
         ASSERT(!dev->msix_used_entries);
         WARN_ON(msi->table_base !=
-                read_pci_mem_bar(pbus, pslot, pfunc, bir, vf));
+                read_pci_mem_bar(seg, pbus, pslot, pfunc, bir, vf));
 
         dev->msix_nr_entries = nr_entries;
         dev->msix_table.first = PFN_DOWN(table_paddr);
@@ -733,10 +743,10 @@
         WARN_ON(rangeset_overlaps_range(mmio_ro_ranges, dev->msix_table.first,
                                         dev->msix_table.last));
 
-        pba_offset = pci_conf_read32(bus, slot, func,
+        pba_offset = pci_conf_read32(seg, bus, slot, func,
                                      msix_pba_offset_reg(pos));
         bir = (u8)(pba_offset & PCI_MSIX_BIRMASK);
-        pba_paddr = read_pci_mem_bar(pbus, pslot, pfunc, bir, vf);
+        pba_paddr = read_pci_mem_bar(seg, pbus, pslot, pfunc, bir, vf);
         WARN_ON(!pba_paddr);
         pba_paddr += pba_offset & ~PCI_MSIX_BIRMASK;
 
@@ -783,7 +793,7 @@
 
     *desc = entry;
     /* Restore MSI-X enabled bits */
-    pci_conf_write16(bus, slot, func, msix_control_reg(pos), control);
+    pci_conf_write16(seg, bus, slot, func, msix_control_reg(pos), control);
 
     return 0;
 }
@@ -874,8 +884,9 @@
     if ( !pdev )
         return -ENODEV;
 
-    pos = pci_find_cap_offset(msi->bus, slot, func, PCI_CAP_ID_MSIX);
-    control = pci_conf_read16(msi->bus, slot, func, msix_control_reg(pos));
+    pos = pci_find_cap_offset(msi->seg, msi->bus, slot, func, PCI_CAP_ID_MSIX);
+    control = pci_conf_read16(msi->seg, msi->bus, slot, func,
+                              msix_control_reg(pos));
     nr_entries = multi_msix_capable(control);
     if (msi->entry_nr >= nr_entries)
         return -EINVAL;
@@ -909,23 +920,24 @@
 {
     struct pci_dev *dev;
     int pos;
-    u16 control;
+    u16 control, seg;
     u8 bus, slot, func;
 
     dev = entry->dev;
+    seg = dev->seg;
     bus = dev->bus;
     slot = PCI_SLOT(dev->devfn);
     func = PCI_FUNC(dev->devfn);
 
-    pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSIX);
-    control = pci_conf_read16(bus, slot, func, msix_control_reg(pos));
+    pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX);
+    control = pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos));
     msix_set_enable(dev, 0);
 
     BUG_ON(list_empty(&dev->msi_list));
 
     writel(1, entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
 
-    pci_conf_write16(bus, slot, func, msix_control_reg(pos), control);
+    pci_conf_write16(seg, bus, slot, func, msix_control_reg(pos), control);
 
     if ( !--dev->msix_used_entries )
     {
@@ -1034,7 +1046,7 @@
 unsigned int pci_msix_get_table_len(struct pci_dev *pdev)
 {
     int pos;
-    u16 control;
+    u16 control, seg = pdev->seg;
     u8 bus, slot, func;
     unsigned int len;
 
@@ -1042,11 +1054,11 @@
     slot = PCI_SLOT(pdev->devfn);
     func = PCI_FUNC(pdev->devfn);
 
-    pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSIX);
+    pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX);
     if ( !pos )
         return 0;
 
-    control = pci_conf_read16(bus, slot, func, msix_control_reg(pos));
+    control = pci_conf_read16(seg, bus, slot, func, msix_control_reg(pos));
     len = msix_table_size(control) * PCI_MSIX_ENTRY_SIZE;
 
     return len;
diff -r 314b147d524d -r d6e01c7853cf xen/arch/x86/oprofile/op_model_athlon.c
--- a/xen/arch/x86/oprofile/op_model_athlon.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/arch/x86/oprofile/op_model_athlon.c	Thu Sep 22 18:29:19 2011 +0100
@@ -470,7 +470,7 @@
 	for (bus = 0; bus < 256; bus++) {
 		for (dev = 0; dev < 32; dev++) {
 			for (func = 0; func < 8; func++) {
-				id = pci_conf_read32(bus, dev, func, PCI_VENDOR_ID);
+				id = pci_conf_read32(0, bus, dev, func, PCI_VENDOR_ID);
 
 				vendor_id = id & 0xffff;
 				dev_id = (id >> 16) & 0xffff;
@@ -478,10 +478,10 @@
 				if ((vendor_id == PCI_VENDOR_ID_AMD) &&
 					(dev_id == PCI_DEVICE_ID_AMD_10H_NB_MISC)) {
 
-					pci_conf_write32(bus, dev, func, IBSCTL,
+					pci_conf_write32(0, bus, dev, func, IBSCTL,
 						IBSCTL_LVTOFFSETVAL | APIC_EILVT_LVTOFF_IBS);
 
-					value = pci_conf_read32(bus, dev, func, IBSCTL);
+					value = pci_conf_read32(0, bus, dev, func, IBSCTL);
 
 					if (value != (IBSCTL_LVTOFFSETVAL |
 						APIC_EILVT_LVTOFF_IBS)) {
diff -r 314b147d524d -r d6e01c7853cf xen/arch/x86/x86_32/pci.c
--- a/xen/arch/x86/x86_32/pci.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/arch/x86/x86_32/pci.c	Thu Sep 22 18:29:19 2011 +0100
@@ -12,46 +12,61 @@
     (0x80000000 | (bus << 16) | (dev << 11) | (func << 8) | (reg & ~3))
 
 uint8_t pci_conf_read8(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg)
 {
+    if ( seg )
+        return ~0;
     BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
     return pci_conf_read(PCI_CONF_ADDRESS(bus, dev, func, reg), reg & 3, 1);
 }
 
 uint16_t pci_conf_read16(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg)
 {
+    if ( seg )
+        return ~0;
     BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
     return pci_conf_read(PCI_CONF_ADDRESS(bus, dev, func, reg), reg & 2, 2);
 }
 
 uint32_t pci_conf_read32(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg)
 {
+    if ( seg )
+        return ~0;
     BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
     return pci_conf_read(PCI_CONF_ADDRESS(bus, dev, func, reg), 0, 4);
 }
 
 void pci_conf_write8(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint8_t data)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint8_t data)
 {
+    if ( seg )
+        return;
     BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
     pci_conf_write(PCI_CONF_ADDRESS(bus, dev, func, reg), reg & 3, 1, data);
 }
 
 void pci_conf_write16(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint16_t data)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint16_t data)
 {
+    if ( seg )
+        return;
     BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
     pci_conf_write(PCI_CONF_ADDRESS(bus, dev, func, reg), reg & 2, 2, data);
 }
 
 void pci_conf_write32(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint32_t data)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint32_t data)
 {
+    if ( seg )
+        return;
     BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
     pci_conf_write(PCI_CONF_ADDRESS(bus, dev, func, reg), 0, 4, data);
 }
diff -r 314b147d524d -r d6e01c7853cf xen/arch/x86/x86_64/mmconf-fam10h.c
--- a/xen/arch/x86/x86_64/mmconf-fam10h.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/arch/x86/x86_64/mmconf-fam10h.c	Thu Sep 22 18:29:19 2011 +0100
@@ -51,7 +51,7 @@
 
 		bus = pci_probes[i].bus;
 		slot = pci_probes[i].slot;
-		id = pci_conf_read32(bus, slot, 0, PCI_VENDOR_ID);
+		id = pci_conf_read32(0, bus, slot, 0, PCI_VENDOR_ID);
 
 		vendor = id & 0xffff;
 		device = (id>>16) & 0xffff;
@@ -82,12 +82,12 @@
 	 * above 4G
 	 */
 	for (hi_mmio_num = i = 0; i < 8; i++) {
-		val = pci_conf_read32(bus, slot, 1, 0x80 + (i << 3));
+		val = pci_conf_read32(0, bus, slot, 1, 0x80 + (i << 3));
 		if (!(val & 3))
 			continue;
 
 		start = (val & 0xffffff00) << 8; /* 39:16 on 31:8*/
-		val = pci_conf_read32(bus, slot, 1, 0x84 + (i << 3));
+		val = pci_conf_read32(0, bus, slot, 1, 0x84 + (i << 3));
 		end = ((val & 0xffffff00) << 8) | 0xffff; /* 39:16 on 31:8*/
 
 		if (end < tom2)
diff -r 314b147d524d -r d6e01c7853cf xen/arch/x86/x86_64/mmconfig-shared.c
--- a/xen/arch/x86/x86_64/mmconfig-shared.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c	Thu Sep 22 18:29:19 2011 +0100
@@ -50,7 +50,7 @@
 static const char __init *pci_mmcfg_e7520(void)
 {
     u32 win;
-    win = pci_conf_read16(0, 0, 0, 0xce);
+    win = pci_conf_read16(0, 0, 0, 0, 0xce);
 
     win = win & 0xf000;
     if(win == 0x0000 || win == 0xf000)
@@ -76,7 +76,7 @@
 
     pci_mmcfg_config_num = 1;
 
-        pciexbar = pci_conf_read32(0, 0, 0, 0x48);
+    pciexbar = pci_conf_read32(0, 0, 0, 0, 0x48);
 
     /* Enable bit */
     if (!(pciexbar & 1))
@@ -201,14 +201,14 @@
         u32 l, extcfg;
         u16 vendor, device;
 
-        l = pci_conf_read32(bus, 0, 0, 0);
+        l = pci_conf_read32(0, bus, 0, 0, 0);
         vendor = l & 0xffff;
         device = (l >> 16) & 0xffff;
 
         if (PCI_VENDOR_ID_NVIDIA != vendor || 0x0369 != device)
             continue;
 
-        extcfg = pci_conf_read32(bus, 0, 0, extcfg_regnum);
+        extcfg = pci_conf_read32(0, bus, 0, 0, extcfg_regnum);
 
         if (extcfg & extcfg_enable_mask)
             i++;
@@ -227,14 +227,14 @@
         u16 vendor, device;
         int size_index;
 
-        l = pci_conf_read32(bus, 0, 0, 0);
+        l = pci_conf_read32(0, bus, 0, 0, 0);
         vendor = l & 0xffff;
         device = (l >> 16) & 0xffff;
 
         if (PCI_VENDOR_ID_NVIDIA != vendor || 0x0369 != device)
             continue;
 
-        extcfg = pci_conf_read32(bus, 0, 0, extcfg_regnum);
+        extcfg = pci_conf_read32(0, bus, 0, 0, extcfg_regnum);
 
         if (!(extcfg & extcfg_enable_mask))
             continue;
@@ -300,7 +300,7 @@
     for (i = 0; !name && i < ARRAY_SIZE(pci_mmcfg_probes); i++) {
         bus =  pci_mmcfg_probes[i].bus;
         devfn = pci_mmcfg_probes[i].devfn;
-        l = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0);
+        l = pci_conf_read32(0, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0);
         vendor = l & 0xffff;
         device = (l >> 16) & 0xffff;
 
@@ -473,7 +473,7 @@
     int ttl = 480; /* 3840 bytes, minimum 8 bytes per capability */
     int pos = 0x100;
 
-    header = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos);
+    header = pci_conf_read32(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos);
 
     /*
      * If we have no capabilities, this is indicated by cap ID,
@@ -488,7 +488,7 @@
         pos = PCI_EXT_CAP_NEXT(header);
         if ( pos < 0x100 )
             break;
-        header = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos);
+        header = pci_conf_read32(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos);
     }
     return 0;
 }
diff -r 314b147d524d -r d6e01c7853cf xen/arch/x86/x86_64/pci.c
--- a/xen/arch/x86/x86_64/pci.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/arch/x86/x86_64/pci.c	Thu Sep 22 18:29:19 2011 +0100
@@ -12,13 +12,14 @@
     (0x80000000 | (bus << 16) | (dev << 11) | (func << 8) | (reg & ~3))
 
 uint8_t pci_conf_read8(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg)
 {
     u32 value;
 
-    if ( reg > 255 )
+    if ( seg || reg > 255 )
     {
-        pci_mmcfg_read(0, bus, PCI_DEVFN(dev, func), reg, 1, &value);
+        pci_mmcfg_read(seg, bus, PCI_DEVFN(dev, func), reg, 1, &value);
         return value;
     }
     else
@@ -29,13 +30,14 @@
 }
 
 uint16_t pci_conf_read16(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg)
 {
     u32 value;
 
-    if ( reg > 255 )
+    if ( seg || reg > 255 )
     {
-        pci_mmcfg_read(0, bus, PCI_DEVFN(dev, func), reg, 2, &value);
+        pci_mmcfg_read(seg, bus, PCI_DEVFN(dev, func), reg, 2, &value);
         return value;
     }
     else
@@ -46,13 +48,14 @@
 }
 
 uint32_t pci_conf_read32(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg)
 {
     u32 value;
 
-    if ( reg > 255 )
+    if ( seg || reg > 255 )
     {
-        pci_mmcfg_read(0, bus, PCI_DEVFN(dev, func), reg, 4, &value);
+        pci_mmcfg_read(seg, bus, PCI_DEVFN(dev, func), reg, 4, &value);
         return value;
     }
     else
@@ -63,11 +66,11 @@
 }
 
 void pci_conf_write8(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint8_t data)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint8_t data)
 {
-    if ( reg > 255 )
-        pci_mmcfg_write(0, bus, PCI_DEVFN(dev, func), reg, 1, data);
+    if ( seg || reg > 255 )
+        pci_mmcfg_write(seg, bus, PCI_DEVFN(dev, func), reg, 1, data);
     else
     {
         BUG_ON((bus > 255) || (dev > 31) || (func > 7));
@@ -76,11 +79,11 @@
 }
 
 void pci_conf_write16(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint16_t data)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint16_t data)
 {
-    if ( reg > 255 )
-        pci_mmcfg_write(0, bus, PCI_DEVFN(dev, func), reg, 2, data);
+    if ( seg || reg > 255 )
+        pci_mmcfg_write(seg, bus, PCI_DEVFN(dev, func), reg, 2, data);
     else
     {
         BUG_ON((bus > 255) || (dev > 31) || (func > 7));
@@ -89,11 +92,11 @@
 }
 
 void pci_conf_write32(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint32_t data)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint32_t data)
 {
-    if ( reg > 255 )
-        pci_mmcfg_write(0, bus, PCI_DEVFN(dev, func), reg, 4, data);
+    if ( seg || reg > 255 )
+        pci_mmcfg_write(seg, bus, PCI_DEVFN(dev, func), reg, 4, data);
     else
     {
         BUG_ON((bus > 255) || (dev > 31) || (func > 7));
diff -r 314b147d524d -r d6e01c7853cf xen/drivers/acpi/reboot.c
--- a/xen/drivers/acpi/reboot.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/drivers/acpi/reboot.c	Thu Sep 22 18:29:19 2011 +0100
@@ -24,7 +24,7 @@
 	case ACPI_ADR_SPACE_PCI_CONFIG:
 		printk("Resetting with ACPI PCI RESET_REG.\n");
 		/* Write the value that resets us. */
-		pci_conf_write8(0,
+		pci_conf_write8(0, 0,
 				(rr->address >> 32) & 31,
 				(rr->address >> 16) & 7,
 				(rr->address & 255),
diff -r 314b147d524d -r d6e01c7853cf xen/drivers/char/ns16550.c
--- a/xen/drivers/char/ns16550.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/drivers/char/ns16550.c	Thu Sep 22 18:29:19 2011 +0100
@@ -212,12 +212,12 @@
         return;
     
     if ( uart->pb_bdf_enable )
-        pci_conf_write16(uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
+        pci_conf_write16(0, uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
             0x1c, (uart->io_base & 0xF000) | ((uart->io_base & 0xF000) >> 8));
 
-    pci_conf_write32(uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2],
+    pci_conf_write32(0, uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2],
         0x10, uart->io_base | 0x1);
-    pci_conf_write16(uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2],
+    pci_conf_write16(0, uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2],
         0x4, 0x1);
 }
 
@@ -329,10 +329,10 @@
     if ( uart->bar )
     {
        uart->bar = pci_conf_read32(
-           uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
+           0, uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
            PCI_BASE_ADDRESS_0 + uart->bar_idx*4);
        uart->cr = pci_conf_read32(
-           uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
+           0, uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
            PCI_COMMAND);
     }
 }
@@ -346,9 +346,9 @@
 
     if ( uart->bar )
     {
-       pci_conf_write32(uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
+       pci_conf_write32(0, uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
                         PCI_BASE_ADDRESS_0 + uart->bar_idx*4, uart->bar);
-       pci_conf_write32(uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
+       pci_conf_write32(0, uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
                         PCI_COMMAND, uart->cr);
     }
 }
@@ -467,19 +467,20 @@
         {
             for ( f = 0; f < 0x8; f++ )
             {
-                class = pci_conf_read16(b, d, f, PCI_CLASS_DEVICE);
+                class = pci_conf_read16(0, b, d, f, PCI_CLASS_DEVICE);
                 if ( class != 0x700 )
                     continue;
 
-                bar = pci_conf_read32(b, d, f, PCI_BASE_ADDRESS_0 + bar_idx*4);
+                bar = pci_conf_read32(0, b, d, f,
+                                      PCI_BASE_ADDRESS_0 + bar_idx*4);
 
                 /* Not IO */
                 if ( !(bar & 1) )
                     continue;
 
-                pci_conf_write32(b, d, f, PCI_BASE_ADDRESS_0, ~0u);
-                len = pci_conf_read32(b, d, f, PCI_BASE_ADDRESS_0);
-                pci_conf_write32(b, d, f, PCI_BASE_ADDRESS_0 + bar_idx*4, bar);
+                pci_conf_write32(0, b, d, f, PCI_BASE_ADDRESS_0, ~0u);
+                len = pci_conf_read32(0, b, d, f, PCI_BASE_ADDRESS_0);
+                pci_conf_write32(0, b, d, f, PCI_BASE_ADDRESS_0 + bar_idx*4, bar);
 
                 /* Not 8 bytes */
                 if ( (len & 0xffff) != 0xfff9 )
diff -r 314b147d524d -r d6e01c7853cf xen/drivers/passthrough/amd/iommu_detect.c
--- a/xen/drivers/passthrough/amd/iommu_detect.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_detect.c	Thu Sep 22 18:29:19 2011 +0100
@@ -35,14 +35,14 @@
     u16 control;
     int count = 0;
 
-    cap_ptr = pci_conf_read8(bus, dev, func,
+    cap_ptr = pci_conf_read8(seg, bus, dev, func,
             PCI_CAPABILITY_LIST);
 
     while ( cap_ptr >= PCI_MIN_CAP_OFFSET &&
         count < PCI_MAX_CAP_BLOCKS )
     {
         cap_ptr &= PCI_CAP_PTR_MASK;
-        cap_header = pci_conf_read32(bus, dev, func, cap_ptr);
+        cap_header = pci_conf_read32(seg, bus, dev, func, cap_ptr);
         cap_id = get_field_from_reg_u32(cap_header,
                 PCI_CAP_ID_MASK, PCI_CAP_ID_SHIFT);
 
@@ -60,7 +60,7 @@
         return -ENODEV;
 
     AMD_IOMMU_DEBUG("Found MSI capability block \n");
-    control = pci_conf_read16(bus, dev, func,
+    control = pci_conf_read16(seg, bus, dev, func,
             iommu->msi_cap + PCI_MSI_FLAGS);
     iommu->maskbit = control & PCI_MSI_FLAGS_MASKBIT;
     return 0;
@@ -71,18 +71,18 @@
 {
     u32 cap_header, cap_range, misc_info;
 
-    cap_header = pci_conf_read32(bus, dev, func, cap_ptr);
+    cap_header = pci_conf_read32(seg, bus, dev, func, cap_ptr);
     iommu->revision = get_field_from_reg_u32(
         cap_header, PCI_CAP_REV_MASK, PCI_CAP_REV_SHIFT);
     iommu->pte_not_present_cached = get_field_from_reg_u32(
         cap_header, PCI_CAP_NP_CACHE_MASK, PCI_CAP_NP_CACHE_SHIFT);
 
-    cap_range = pci_conf_read32(bus, dev, func,
+    cap_range = pci_conf_read32(seg, bus, dev, func,
                                 cap_ptr + PCI_CAP_RANGE_OFFSET);
     iommu->unit_id = get_field_from_reg_u32(
         cap_range, PCI_CAP_UNIT_ID_MASK, PCI_CAP_UNIT_ID_SHIFT);
 
-    misc_info = pci_conf_read32(bus, dev, func,
+    misc_info = pci_conf_read32(seg, bus, dev, func,
                                 cap_ptr + PCI_MISC_INFO_OFFSET);
     iommu->msi_number = get_field_from_reg_u32(
         misc_info, PCI_CAP_MSI_NUMBER_MASK, PCI_CAP_MSI_NUMBER_SHIFT);
diff -r 314b147d524d -r d6e01c7853cf xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Thu Sep 22 18:29:19 2011 +0100
@@ -268,7 +268,7 @@
     writel(entry, iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
 }
 
-static void parse_event_log_entry(u32 entry[]);
+static void parse_event_log_entry(struct amd_iommu *, u32 entry[]);
 
 static int amd_iommu_read_event_log(struct amd_iommu *iommu)
 {
@@ -289,7 +289,7 @@
                            (iommu->event_log_head *
                            IOMMU_EVENT_LOG_ENTRY_SIZE));
 
-        parse_event_log_entry(event_log);
+        parse_event_log_entry(iommu, event_log);
 
         if ( ++iommu->event_log_head == iommu->event_log.entries )
             iommu->event_log_head = 0;
@@ -349,6 +349,7 @@
     unsigned int dest;
     struct amd_iommu *iommu = desc->action->dev_id;
     struct irq_cfg *cfg = desc->chip_data;
+    u16 seg = iommu->seg;
     u8 bus = (iommu->bdf >> 8) & 0xff;
     u8 dev = PCI_SLOT(iommu->bdf & 0xff);
     u8 func = PCI_FUNC(iommu->bdf & 0xff);
@@ -377,11 +378,11 @@
                     MSI_ADDR_REDIRECTION_LOWPRI;
     msg.address_lo |= MSI_ADDR_DEST_ID(dest & 0xff);
 
-    pci_conf_write32(bus, dev, func,
+    pci_conf_write32(seg, bus, dev, func,
         iommu->msi_cap + PCI_MSI_DATA_64, msg.data);
-    pci_conf_write32(bus, dev, func,
+    pci_conf_write32(seg, bus, dev, func,
         iommu->msi_cap + PCI_MSI_ADDRESS_LO, msg.address_lo);
-    pci_conf_write32(bus, dev, func,
+    pci_conf_write32(seg, bus, dev, func,
         iommu->msi_cap + PCI_MSI_ADDRESS_HI, msg.address_hi);
     
 }
@@ -393,12 +394,12 @@
     int dev = PCI_SLOT(iommu->bdf & 0xff);
     int func = PCI_FUNC(iommu->bdf & 0xff);
 
-    control = pci_conf_read16(bus, dev, func,
+    control = pci_conf_read16(iommu->seg, bus, dev, func,
         iommu->msi_cap + PCI_MSI_FLAGS);
     control &= ~(1);
     if ( flag )
         control |= flag;
-    pci_conf_write16(bus, dev, func,
+    pci_conf_write16(iommu->seg, bus, dev, func,
         iommu->msi_cap + PCI_MSI_FLAGS, control);
 }
 
@@ -456,7 +457,7 @@
     .set_affinity = iommu_msi_set_affinity,
 };
 
-static void parse_event_log_entry(u32 entry[])
+static void parse_event_log_entry(struct amd_iommu *iommu, u32 entry[])
 {
     u16 domain_id, device_id, bdf, cword;
     u32 code;
@@ -497,11 +498,12 @@
         /* Tell the device to stop DMAing; we can't rely on the guest to
          * control it for us. */
         for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
-            if ( get_dma_requestor_id(bdf) == device_id ) 
+            if ( get_dma_requestor_id(iommu->seg, bdf) == device_id )
             {
-                cword = pci_conf_read16(PCI_BUS(bdf), PCI_SLOT(bdf), 
-                                PCI_FUNC(bdf), PCI_COMMAND);
-                pci_conf_write16(PCI_BUS(bdf), PCI_SLOT(bdf), 
+                cword = pci_conf_read16(iommu->seg, PCI_BUS(bdf),
+                                        PCI_SLOT(bdf), PCI_FUNC(bdf),
+                                        PCI_COMMAND);
+                pci_conf_write16(iommu->seg, PCI_BUS(bdf), PCI_SLOT(bdf),
                                  PCI_FUNC(bdf), PCI_COMMAND, 
                                  cword & ~PCI_COMMAND_MASTER);
             }
diff -r 314b147d524d -r d6e01c7853cf xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/drivers/passthrough/pci.c	Thu Sep 22 18:29:19 2011 +0100
@@ -214,8 +214,8 @@
     if (!pos)
         return;
 
-    cap = pci_conf_read16(bus, dev, func, pos + PCI_ACS_CAP);
-    ctrl = pci_conf_read16(bus, dev, func, pos + PCI_ACS_CTRL);
+    cap = pci_conf_read16(seg, bus, dev, func, pos + PCI_ACS_CAP);
+    ctrl = pci_conf_read16(seg, bus, dev, func, pos + PCI_ACS_CTRL);
 
     /* Source Validation */
     ctrl |= (cap & PCI_ACS_SV);
@@ -229,7 +229,7 @@
     /* Upstream Forwarding */
     ctrl |= (cap & PCI_ACS_UF);
 
-    pci_conf_write16(bus, dev, func, pos + PCI_ACS_CTRL, ctrl);
+    pci_conf_write16(seg, bus, dev, func, pos + PCI_ACS_CTRL, ctrl);
 }
 
 int pci_add_device(u16 seg, u8 bus, u8 devfn, const struct pci_dev_info *info)
@@ -273,7 +273,7 @@
     {
         unsigned int pos = pci_find_ext_capability(seg, bus, devfn,
                                                    PCI_EXT_CAP_ID_SRIOV);
-        u16 ctrl = pci_conf_read16(bus, slot, func, pos + PCI_SRIOV_CTRL);
+        u16 ctrl = pci_conf_read16(seg, bus, slot, func, pos + PCI_SRIOV_CTRL);
 
         if ( !pos )
             /* Nothing */;
@@ -285,7 +285,7 @@
             for ( i = 0; i < PCI_SRIOV_NUM_BARS; ++i )
             {
                 unsigned int idx = pos + PCI_SRIOV_BAR + i * 4;
-                u32 bar = pci_conf_read32(bus, slot, func, idx);
+                u32 bar = pci_conf_read32(seg, bus, slot, func, idx);
                 u32 hi = 0;
 
                 if ( (bar & PCI_BASE_ADDRESS_SPACE) ==
@@ -297,7 +297,7 @@
                            seg, bus, slot, func, i);
                     continue;
                 }
-                pci_conf_write32(bus, slot, func, idx, ~0);
+                pci_conf_write32(seg, bus, slot, func, idx, ~0);
                 if ( (bar & PCI_BASE_ADDRESS_MEM_TYPE_MASK) ==
                      PCI_BASE_ADDRESS_MEM_TYPE_64 )
                 {
@@ -309,21 +309,22 @@
                                seg, bus, slot, func);
                         break;
                     }
-                    hi = pci_conf_read32(bus, slot, func, idx + 4);
-                    pci_conf_write32(bus, slot, func, idx + 4, ~0);
+                    hi = pci_conf_read32(seg, bus, slot, func, idx + 4);
+                    pci_conf_write32(seg, bus, slot, func, idx + 4, ~0);
                 }
-                pdev->vf_rlen[i] = pci_conf_read32(bus, slot, func, idx) &
+                pdev->vf_rlen[i] = pci_conf_read32(seg, bus, slot, func, idx) &
                                    PCI_BASE_ADDRESS_MEM_MASK;
                 if ( (bar & PCI_BASE_ADDRESS_MEM_TYPE_MASK) ==
                      PCI_BASE_ADDRESS_MEM_TYPE_64 )
                 {
-                    pdev->vf_rlen[i] |= (u64)pci_conf_read32(bus, slot, func,
+                    pdev->vf_rlen[i] |= (u64)pci_conf_read32(seg, bus,
+                                                             slot, func,
                                                              idx + 4) << 32;
-                    pci_conf_write32(bus, slot, func, idx + 4, hi);
+                    pci_conf_write32(seg, bus, slot, func, idx + 4, hi);
                 }
                 else if ( pdev->vf_rlen[i] )
                     pdev->vf_rlen[i] |= (u64)~0 << 32;
-                pci_conf_write32(bus, slot, func, idx, bar);
+                pci_conf_write32(seg, bus, slot, func, idx, bar);
                 pdev->vf_rlen[i] = -pdev->vf_rlen[i];
                 if ( (bar & PCI_BASE_ADDRESS_MEM_TYPE_MASK) ==
                      PCI_BASE_ADDRESS_MEM_TYPE_64 )
@@ -458,23 +459,24 @@
     int pos;
     u8 d = PCI_SLOT(devfn), f = PCI_FUNC(devfn);
 
-    class_device = pci_conf_read16(bus, d, f, PCI_CLASS_DEVICE);
+    class_device = pci_conf_read16(seg, bus, d, f, PCI_CLASS_DEVICE);
     if ( class_device == PCI_CLASS_BRIDGE_PCI )
     {
-        pos = pci_find_next_cap(bus, devfn,
+        pos = pci_find_next_cap(seg, bus, devfn,
                                 PCI_CAPABILITY_LIST, PCI_CAP_ID_EXP);
         if ( !pos )
             return DEV_TYPE_LEGACY_PCI_BRIDGE;
-        creg = pci_conf_read16(bus, d, f, pos + PCI_EXP_FLAGS);
+        creg = pci_conf_read16(seg, bus, d, f, pos + PCI_EXP_FLAGS);
         return ((creg & PCI_EXP_FLAGS_TYPE) >> 4) == PCI_EXP_TYPE_PCI_BRIDGE ?
             DEV_TYPE_PCIe2PCI_BRIDGE : DEV_TYPE_PCIe_BRIDGE;
     }
 
-    status = pci_conf_read16(bus, d, f, PCI_STATUS);
+    status = pci_conf_read16(seg, bus, d, f, PCI_STATUS);
     if ( !(status & PCI_STATUS_CAP_LIST) )
         return DEV_TYPE_PCI;
 
-    if ( pci_find_next_cap(bus, devfn, PCI_CAPABILITY_LIST, PCI_CAP_ID_EXP) )
+    if ( pci_find_next_cap(seg, bus, devfn, PCI_CAPABILITY_LIST,
+                           PCI_CAP_ID_EXP) )
         return DEV_TYPE_PCIe_ENDPOINT;
 
     return DEV_TYPE_PCI;
@@ -527,7 +529,7 @@
 {
     u32 vendor;
 
-    vendor = pci_conf_read32(bus, dev, func, PCI_VENDOR_ID);
+    vendor = pci_conf_read32(seg, bus, dev, func, PCI_VENDOR_ID);
     /* some broken boards return 0 or ~0 if a slot is empty: */
     if ( (vendor == 0xffffffff) || (vendor == 0x00000000) ||
          (vendor == 0x0000ffff) || (vendor == 0xffff0000) )
@@ -571,9 +573,9 @@
 
                     case DEV_TYPE_PCIe2PCI_BRIDGE:
                     case DEV_TYPE_LEGACY_PCI_BRIDGE:
-                        sec_bus = pci_conf_read8(bus, dev, func,
+                        sec_bus = pci_conf_read8(pseg->nr, bus, dev, func,
                                                  PCI_SECONDARY_BUS);
-                        sub_bus = pci_conf_read8(bus, dev, func,
+                        sub_bus = pci_conf_read8(pseg->nr, bus, dev, func,
                                                  PCI_SUBORDINATE_BUS);
 
                         spin_lock(&pseg->bus2bridge_lock);
@@ -597,7 +599,7 @@
                         return -EINVAL;
                 }
 
-                if ( !func && !(pci_conf_read8(bus, dev, func,
+                if ( !func && !(pci_conf_read8(pseg->nr, bus, dev, func,
                                                PCI_HEADER_TYPE) & 0x80) )
                     break;
             }
@@ -667,7 +669,7 @@
     struct pci_dev *pdev;
 
     list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-        pci_conf_write16(pdev->bus, PCI_SLOT(pdev->devfn),
+        pci_conf_write16(pseg->nr, pdev->bus, PCI_SLOT(pdev->devfn),
                          PCI_FUNC(pdev->devfn), PCI_COMMAND, 0);
 
     return 0;
diff -r 314b147d524d -r d6e01c7853cf xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Thu Sep 22 18:29:19 2011 +0100
@@ -307,17 +307,18 @@
 
         while ( --depth > 0 )
         {
-            bus = pci_conf_read8(bus, path->dev, path->fn, PCI_SECONDARY_BUS);
+            bus = pci_conf_read8(seg, bus, path->dev, path->fn,
+                                 PCI_SECONDARY_BUS);
             path++;
         }
 
         switch ( acpi_scope->dev_type )
         {
         case ACPI_DEV_P2PBRIDGE:
-            sec_bus = pci_conf_read8(
-                bus, path->dev, path->fn, PCI_SECONDARY_BUS);
-            sub_bus = pci_conf_read8(
-                bus, path->dev, path->fn, PCI_SUBORDINATE_BUS);
+            sec_bus = pci_conf_read8(seg, bus, path->dev, path->fn,
+                                     PCI_SECONDARY_BUS);
+            sub_bus = pci_conf_read8(seg, bus, path->dev, path->fn,
+                                     PCI_SUBORDINATE_BUS);
             if ( iommu_verbose )
                 dprintk(VTDPREFIX,
                         " bridge: %04x:%02x:%02x.%u start=%x sec=%x sub=%x\n",
diff -r 314b147d524d -r d6e01c7853cf xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Sep 22 18:29:19 2011 +0100
@@ -940,11 +940,12 @@
 
         /* Tell the device to stop DMAing; we can't rely on the guest to
          * control it for us. */
-        cword = pci_conf_read16(PCI_BUS(source_id), PCI_SLOT(source_id), 
+        cword = pci_conf_read16(iommu->intel->drhd->segment,
+                                PCI_BUS(source_id), PCI_SLOT(source_id),
                                 PCI_FUNC(source_id), PCI_COMMAND);
-        pci_conf_write16(PCI_BUS(source_id), PCI_SLOT(source_id), 
-                         PCI_FUNC(source_id), PCI_COMMAND, 
-                         cword & ~PCI_COMMAND_MASTER);
+        pci_conf_write16(iommu->intel->drhd->segment, PCI_BUS(source_id),
+                         PCI_SLOT(source_id), PCI_FUNC(source_id),
+                         PCI_COMMAND, cword & ~PCI_COMMAND_MASTER);
 
         fault_index++;
         if ( fault_index > cap_num_fault_regs(iommu->cap) )
diff -r 314b147d524d -r d6e01c7853cf xen/drivers/passthrough/vtd/quirks.c
--- a/xen/drivers/passthrough/vtd/quirks.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/drivers/passthrough/vtd/quirks.c	Thu Sep 22 18:29:19 2011 +0100
@@ -70,7 +70,7 @@
         return 1;
 
     /* integrated graphics on Intel platforms is located at 0:2.0 */
-    ggc = pci_conf_read16(0, IGD_DEV, 0, GGC);
+    ggc = pci_conf_read16(0, 0, IGD_DEV, 0, GGC);
     return ( ggc & GGC_MEMORY_VT_ENABLED ? 1 : 0 );
 }
 
@@ -84,12 +84,12 @@
     u16 vid;
     u8 did_hi, rid;
 
-    vid = pci_conf_read16(0, IGD_DEV, 0, 0);
+    vid = pci_conf_read16(0, 0, IGD_DEV, 0, 0);
     if ( vid != 0x8086 )
         return;
 
-    did_hi = pci_conf_read8(0, IGD_DEV, 0, 3);
-    rid = pci_conf_read8(0, IGD_DEV, 0, 8);
+    did_hi = pci_conf_read8(0, 0, IGD_DEV, 0, 3);
+    rid = pci_conf_read8(0, 0, IGD_DEV, 0, 8);
 
     if ( (did_hi == 0x2A) && (rid == 0x7) )
         is_cantiga_b3 = 1;
@@ -125,8 +125,8 @@
         return;
 
     /* get IGD mmio address in PCI BAR */
-    igd_mmio = ((u64)pci_conf_read32(0, IGD_DEV, 0, 0x14) << 32) +
-                     pci_conf_read32(0, IGD_DEV, 0, 0x10);
+    igd_mmio = ((u64)pci_conf_read32(0, 0, IGD_DEV, 0, 0x14) << 32) +
+                     pci_conf_read32(0, 0, IGD_DEV, 0, 0x10);
 
     /* offset of IGD regster we want to access is in 0x2000 range */
     igd_reg = (igd_mmio & IGD_BAR_MASK) + 0x2000;
@@ -251,8 +251,8 @@
 /* initialize platform identification flags */
 void __init platform_quirks_init(void)
 {
-    ioh_id = pci_conf_read32(0, IOH_DEV, 0, 0);
-    igd_id = pci_conf_read32(0, IGD_DEV, 0, 0);
+    ioh_id = pci_conf_read32(0, 0, IOH_DEV, 0, 0);
+    igd_id = pci_conf_read32(0, 0, IGD_DEV, 0, 0);
 
     /* Mobile 4 Series Chipset neglects to set RWBF capability. */
     if ( ioh_id == 0x2a408086 )
@@ -302,15 +302,15 @@
 {
     u32 id;
 
-    id = pci_conf_read32(0, 0, 0, 0);
+    id = pci_conf_read32(0, 0, 0, 0, 0);
     if ( IS_CTG(id) )
     {
         /* quit if ME does not exist */
-        if ( pci_conf_read32(0, 3, 0, 0) == 0xffffffff )
+        if ( pci_conf_read32(0, 0, 3, 0, 0) == 0xffffffff )
             return;
 
         /* if device is WLAN device, map ME phantom device 0:3.7 */
-        id = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0);
+        id = pci_conf_read32(0, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0);
         switch (id)
         {
             case 0x42328086:
@@ -330,11 +330,11 @@
     else if ( IS_ILK(id) || IS_CPT(id) )
     {
         /* quit if ME does not exist */
-        if ( pci_conf_read32(0, 22, 0, 0) == 0xffffffff )
+        if ( pci_conf_read32(0, 0, 22, 0, 0) == 0xffffffff )
             return;
 
         /* if device is WLAN device, map ME phantom device 0:22.7 */
-        id = pci_conf_read32(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0);
+        id = pci_conf_read32(0, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 0);
         switch (id)
         {
             case 0x00878086:        /* Kilmer Peak */
@@ -364,16 +364,17 @@
 void __init pci_vtd_quirk(struct pci_dev *pdev)
 {
 #ifdef CONFIG_X86_64
+    int seg = pdev->seg;
     int bus = pdev->bus;
     int dev = PCI_SLOT(pdev->devfn);
     int func = PCI_FUNC(pdev->devfn);
     int id, val;
 
-    id = pci_conf_read32(bus, dev, func, 0);
+    id = pci_conf_read32(seg, bus, dev, func, 0);
     if ( id == 0x342e8086 || id == 0x3c288086 )
     {
-        val = pci_conf_read32(bus, dev, func, 0x1AC);
-        pci_conf_write32(bus, dev, func, 0x1AC, val | (1 << 31));
+        val = pci_conf_read32(seg, bus, dev, func, 0x1AC);
+        pci_conf_write32(seg, bus, dev, func, 0x1AC, val | (1 << 31));
     }
 #endif
 }
diff -r 314b147d524d -r d6e01c7853cf xen/drivers/passthrough/vtd/utils.c
--- a/xen/drivers/passthrough/vtd/utils.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/drivers/passthrough/vtd/utils.c	Thu Sep 22 18:29:19 2011 +0100
@@ -34,7 +34,7 @@
 
 int is_usb_device(u16 seg, u8 bus, u8 devfn)
 {
-    u16 class = pci_conf_read16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+    u16 class = pci_conf_read16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
                                 PCI_CLASS_DEVICE);
     return (class == 0xc03);
 }
diff -r 314b147d524d -r d6e01c7853cf xen/drivers/passthrough/vtd/x86/ats.c
--- a/xen/drivers/passthrough/vtd/x86/ats.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/drivers/passthrough/vtd/x86/ats.c	Thu Sep 22 18:29:19 2011 +0100
@@ -135,8 +135,7 @@
                 "%04x:%02x:%02x.%u: ATS capability found\n",
                 seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
 
-    /* BUGBUG: add back seg when multi-seg platform support is enabled */
-    value = pci_conf_read16(bus, PCI_SLOT(devfn),
+    value = pci_conf_read16(seg, bus, PCI_SLOT(devfn),
                             PCI_FUNC(devfn), pos + ATS_REG_CTL);
     if ( value & ATS_ENABLE )
     {
@@ -157,7 +156,7 @@
     if ( !(value & ATS_ENABLE) )
     {
         value |= ATS_ENABLE;
-        pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+        pci_conf_write16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
                          pos + ATS_REG_CTL, value);
     }
 
@@ -166,7 +165,7 @@
         pdev->seg = seg;
         pdev->bus = bus;
         pdev->devfn = devfn;
-        value = pci_conf_read16(bus, PCI_SLOT(devfn),
+        value = pci_conf_read16(seg, bus, PCI_SLOT(devfn),
                                 PCI_FUNC(devfn), pos + ATS_REG_CAP);
         pdev->ats_queue_depth = value & ATS_QUEUE_DEPTH_MASK;
         list_add(&pdev->list, &ats_devices);
@@ -190,11 +189,10 @@
     pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
     BUG_ON(!pos);
 
-    /* BUGBUG: add back seg when multi-seg platform support is enabled */
-    value = pci_conf_read16(bus, PCI_SLOT(devfn),
+    value = pci_conf_read16(seg, bus, PCI_SLOT(devfn),
                             PCI_FUNC(devfn), pos + ATS_REG_CTL);
     value &= ~ATS_ENABLE;
-    pci_conf_write16(bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+    pci_conf_write16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
                      pos + ATS_REG_CTL, value);
 
     list_for_each_entry ( pdev, &ats_devices, list )
diff -r 314b147d524d -r d6e01c7853cf xen/drivers/pci/pci.c
--- a/xen/drivers/pci/pci.c	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/drivers/pci/pci.c	Thu Sep 22 18:29:19 2011 +0100
@@ -7,25 +7,25 @@
 #include <xen/pci.h>
 #include <xen/pci_regs.h>
 
-int pci_find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap)
+int pci_find_cap_offset(u16 seg, u8 bus, u8 dev, u8 func, u8 cap)
 {
     u8 id;
     int max_cap = 48;
     u8 pos = PCI_CAPABILITY_LIST;
     u16 status;
 
-    status = pci_conf_read16(bus, dev, func, PCI_STATUS);
+    status = pci_conf_read16(seg, bus, dev, func, PCI_STATUS);
     if ( (status & PCI_STATUS_CAP_LIST) == 0 )
         return 0;
 
     while ( max_cap-- )
     {
-        pos = pci_conf_read8(bus, dev, func, pos);
+        pos = pci_conf_read8(seg, bus, dev, func, pos);
         if ( pos < 0x40 )
             break;
 
         pos &= ~3;
-        id = pci_conf_read8(bus, dev, func, pos + PCI_CAP_LIST_ID);
+        id = pci_conf_read8(seg, bus, dev, func, pos + PCI_CAP_LIST_ID);
 
         if ( id == 0xff )
             break;
@@ -38,19 +38,19 @@
     return 0;
 }
 
-int pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap)
+int pci_find_next_cap(u16 seg, u8 bus, unsigned int devfn, u8 pos, int cap)
 {
     u8 id;
     int ttl = 48;
 
     while ( ttl-- )
     {
-        pos = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos);
+        pos = pci_conf_read8(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos);
         if ( pos < 0x40 )
             break;
 
         pos &= ~3;
-        id = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+        id = pci_conf_read8(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
                             pos + PCI_CAP_LIST_ID);
 
         if ( id == 0xff )
diff -r 314b147d524d -r d6e01c7853cf xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Thu Sep 22 18:28:38 2011 +0100
+++ b/xen/include/xen/pci.h	Thu Sep 22 18:29:19 2011 +0100
@@ -102,28 +102,31 @@
 void disconnect_pci_devices(void);
 
 uint8_t pci_conf_read8(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg);
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg);
 uint16_t pci_conf_read16(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg);
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg);
 uint32_t pci_conf_read32(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg);
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg);
 void pci_conf_write8(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint8_t data);
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint8_t data);
 void pci_conf_write16(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint16_t data);
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint16_t data);
 void pci_conf_write32(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint32_t data);
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint32_t data);
 uint32_t pci_conf_read(uint32_t cf8, uint8_t offset, uint8_t bytes);
 void pci_conf_write(uint32_t cf8, uint8_t offset, uint8_t bytes, uint32_t data);
 int pci_mmcfg_read(unsigned int seg, unsigned int bus,
                    unsigned int devfn, int reg, int len, u32 *value);
 int pci_mmcfg_write(unsigned int seg, unsigned int bus,
                     unsigned int devfn, int reg, int len, u32 value);
-int pci_find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap);
-int pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap);
+int pci_find_cap_offset(u16 seg, u8 bus, u8 dev, u8 func, u8 cap);
+int pci_find_next_cap(u16 seg, u8 bus, unsigned int devfn, u8 pos, int cap);
 int pci_find_ext_capability(int seg, int bus, int devfn, int cap);
 
 struct pirq;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:56:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:56:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jNh-0003S3-3B; Tue, 27 Sep 2011 18:56:17 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMj-00039G-QQ
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1317174914!19295105!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27216 invoked from network); 28 Sep 2011 01:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMg-0000Ur-Av
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:14 +0100
Message-Id: <E1R8jMg-0000Ur-Av@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] VT-d: eliminate a mis-use of
	pcidevs_lock
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316712704 -3600
# Node ID 571b6e90dfb463b4a56b2a1c8d7d00f7741ca692
# Parent  47ec1d405af9e9c0491681c50bb622d1c1f0904d
VT-d: eliminate a mis-use of pcidevs_lock

dma_pte_clear_one() shouldn't acquire this global lock for the purpose
of processing a per-domain list. Furthermore the function a few lines
earlier has a comment stating that acquiring pcidevs_lock isn't
necessary here (whether that's really correct is another question).

Use the domain's mappin_lock instead to protect the mapped_rmrrs list.
Fold domain_rmrr_mapped() into its sole caller so that the otherwise
implicit dependency on pcidevs_lock there becomes more obvious (see
the comment there).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 47ec1d405af9 -r 571b6e90dfb4 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Thu Sep 22 18:31:02 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Sep 22 18:31:44 2011 +0100
@@ -589,7 +589,6 @@
     u64 pg_maddr;
     int flush_dev_iotlb;
     int iommu_domid;
-    struct list_head *rmrr_list, *tmp;
     struct mapped_rmrr *mrmrr;
 
     spin_lock(&hd->mapping_lock);
@@ -636,10 +635,9 @@
     /* if the cleared address is between mapped RMRR region,
      * remove the mapped RMRR
      */
-    spin_lock(&pcidevs_lock);
-    list_for_each_safe ( rmrr_list, tmp, &hd->mapped_rmrrs )
+    spin_lock(&hd->mapping_lock);
+    list_for_each_entry ( mrmrr, &hd->mapped_rmrrs, list )
     {
-        mrmrr = list_entry(rmrr_list, struct mapped_rmrr, list);
         if ( addr >= mrmrr->base && addr <= mrmrr->end )
         {
             list_del(&mrmrr->list);
@@ -647,7 +645,7 @@
             break;
         }
     }
-    spin_unlock(&pcidevs_lock);
+    spin_unlock(&hd->mapping_lock);
 }
 
 static void iommu_free_pagetable(u64 pt_maddr, int level)
@@ -1824,22 +1822,6 @@
     hd->pgd_maddr = pagetable_get_paddr(pagetable_from_mfn(pgd_mfn));
 }
 
-static int domain_rmrr_mapped(struct domain *d,
-                              struct acpi_rmrr_unit *rmrr)
-{
-    struct hvm_iommu *hd = domain_hvm_iommu(d);
-    struct mapped_rmrr *mrmrr;
-
-    list_for_each_entry( mrmrr, &hd->mapped_rmrrs, list )
-    {
-        if ( mrmrr->base == rmrr->base_address &&
-             mrmrr->end == rmrr->end_address )
-            return 1;
-    }
-
-    return 0;
-}
-
 static int rmrr_identity_mapping(struct domain *d,
                                  struct acpi_rmrr_unit *rmrr)
 {
@@ -1851,8 +1833,16 @@
     ASSERT(spin_is_locked(&pcidevs_lock));
     ASSERT(rmrr->base_address < rmrr->end_address);
 
-    if ( domain_rmrr_mapped(d, rmrr) )
-        return 0;
+    /*
+     * No need to acquire hd->mapping_lock, as the only theoretical race is
+     * with the insertion below (impossible due to holding pcidevs_lock).
+     */
+    list_for_each_entry( mrmrr, &hd->mapped_rmrrs, list )
+    {
+        if ( mrmrr->base == rmrr->base_address &&
+             mrmrr->end == rmrr->end_address )
+            return 0;
+    }
 
     base = rmrr->base_address & PAGE_MASK_4K;
     base_pfn = base >> PAGE_SHIFT_4K;
@@ -1872,7 +1862,9 @@
         return -ENOMEM;
     mrmrr->base = rmrr->base_address;
     mrmrr->end = rmrr->end_address;
+    spin_lock(&hd->mapping_lock);
     list_add_tail(&mrmrr->list, &hd->mapped_rmrrs);
+    spin_unlock(&hd->mapping_lock);
 
     return 0;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:56:29 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:56:29 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jNt-0003W3-Fs; Tue, 27 Sep 2011 18:56:29 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMl-00039T-6g
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1317174881!49778700!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5354 invoked from network); 28 Sep 2011 01:54:41 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:54:41 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMc-0000Pi-TB
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:10 +0100
Message-Id: <E1R8jMc-0000Pi-TB@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] PCI multi-seg: adjust domctl
	interface
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316712414 -3600
# Node ID ec7c81fbe0de9b18f38bf2592a9e44d0992821c9
# Parent  a422e2a4451e16dc791b293f41966b842fa4781d
PCI multi-seg: adjust domctl interface

Again, a couple of directly related functions at once get adjusted to
account for the segment number.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r a422e2a4451e -r ec7c81fbe0de tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c	Sun Sep 18 00:26:52 2011 +0100
+++ b/tools/libxc/xc_domain.c	Thu Sep 22 18:26:54 2011 +0100
@@ -1132,13 +1132,13 @@
 int xc_assign_device(
     xc_interface *xch,
     uint32_t domid,
-    uint32_t machine_bdf)
+    uint32_t machine_sbdf)
 {
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_assign_device;
     domctl.domain = domid;
-    domctl.u.assign_device.machine_bdf = machine_bdf;
+    domctl.u.assign_device.machine_sbdf = machine_sbdf;
 
     return do_domctl(xch, &domctl);
 }
@@ -1146,7 +1146,7 @@
 int xc_get_device_group(
     xc_interface *xch,
     uint32_t domid,
-    uint32_t machine_bdf,
+    uint32_t machine_sbdf,
     uint32_t max_sdevs,
     uint32_t *num_sdevs,
     uint32_t *sdev_array)
@@ -1164,7 +1164,7 @@
     domctl.cmd = XEN_DOMCTL_get_device_group;
     domctl.domain = (domid_t)domid;
 
-    domctl.u.get_device_group.machine_bdf = machine_bdf;
+    domctl.u.get_device_group.machine_sbdf = machine_sbdf;
     domctl.u.get_device_group.max_sdevs = max_sdevs;
 
     set_xen_guest_handle(domctl.u.get_device_group.sdev_array, sdev_array);
@@ -1181,13 +1181,13 @@
 int xc_test_assign_device(
     xc_interface *xch,
     uint32_t domid,
-    uint32_t machine_bdf)
+    uint32_t machine_sbdf)
 {
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_test_assign_device;
     domctl.domain = domid;
-    domctl.u.assign_device.machine_bdf = machine_bdf;
+    domctl.u.assign_device.machine_sbdf = machine_sbdf;
 
     return do_domctl(xch, &domctl);
 }
@@ -1195,13 +1195,13 @@
 int xc_deassign_device(
     xc_interface *xch,
     uint32_t domid,
-    uint32_t machine_bdf)
+    uint32_t machine_sbdf)
 {
     DECLARE_DOMCTL;
 
     domctl.cmd = XEN_DOMCTL_deassign_device;
     domctl.domain = domid;
-    domctl.u.assign_device.machine_bdf = machine_bdf;
+    domctl.u.assign_device.machine_sbdf = machine_sbdf;
  
     return do_domctl(xch, &domctl);
 }
diff -r a422e2a4451e -r ec7c81fbe0de tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Sun Sep 18 00:26:52 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Thu Sep 22 18:26:54 2011 +0100
@@ -45,10 +45,10 @@
 {
     unsigned int value;
 
-    value = 0;
-    value |= (pcidev->bus & 0xff) << 16;
-    value |= (pcidev->dev & 0x1f) << (8+3);
-    value |= (pcidev->func & 0x7) << (8+0);
+    value = pcidev->domain << 16;
+    value |= (pcidev->bus & 0xff) << 8;
+    value |= (pcidev->dev & 0x1f) << 3;
+    value |= (pcidev->func & 0x7);
 
     return value;
 }
diff -r a422e2a4451e -r ec7c81fbe0de tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c	Sun Sep 18 00:26:52 2011 +0100
+++ b/tools/python/xen/lowlevel/xc/xc.c	Thu Sep 22 18:26:54 2011 +0100
@@ -609,7 +609,7 @@
 {
     uint32_t dom;
     char *pci_str;
-    int32_t bdf = 0;
+    int32_t sbdf = 0;
     int seg, bus, dev, func;
 
     static char *kwd_list[] = { "domid", "pci", NULL };
@@ -619,20 +619,21 @@
 
     while ( next_bdf(&pci_str, &seg, &bus, &dev, &func) )
     {
-        bdf |= (bus & 0xff) << 16;
-        bdf |= (dev & 0x1f) << 11;
-        bdf |= (func & 0x7) << 8;
-
-        if ( xc_test_assign_device(self->xc_handle, dom, bdf) != 0 )
+        sbdf = seg << 16;
+        sbdf |= (bus & 0xff) << 8;
+        sbdf |= (dev & 0x1f) << 3;
+        sbdf |= (func & 0x7);
+
+        if ( xc_test_assign_device(self->xc_handle, dom, sbdf) != 0 )
         {
             if (errno == ENOSYS)
-                bdf = -1;
+                sbdf = -1;
             break;
         }
-        bdf = 0;
+        sbdf = 0;
     }
 
-    return Py_BuildValue("i", bdf);
+    return Py_BuildValue("i", sbdf);
 }
 
 static PyObject *pyxc_assign_device(XcObject *self,
@@ -641,7 +642,7 @@
 {
     uint32_t dom;
     char *pci_str;
-    int32_t bdf = 0;
+    int32_t sbdf = 0;
     int seg, bus, dev, func;
 
     static char *kwd_list[] = { "domid", "pci", NULL };
@@ -651,20 +652,21 @@
 
     while ( next_bdf(&pci_str, &seg, &bus, &dev, &func) )
     {
-        bdf |= (bus & 0xff) << 16;
-        bdf |= (dev & 0x1f) << 11;
-        bdf |= (func & 0x7) << 8;
-
-        if ( xc_assign_device(self->xc_handle, dom, bdf) != 0 )
+        sbdf = seg << 16;
+        sbdf |= (bus & 0xff) << 8;
+        sbdf |= (dev & 0x1f) << 3;
+        sbdf |= (func & 0x7);
+
+        if ( xc_assign_device(self->xc_handle, dom, sbdf) != 0 )
         {
             if (errno == ENOSYS)
-                bdf = -1;
+                sbdf = -1;
             break;
         }
-        bdf = 0;
+        sbdf = 0;
     }
 
-    return Py_BuildValue("i", bdf);
+    return Py_BuildValue("i", sbdf);
 }
 
 static PyObject *pyxc_deassign_device(XcObject *self,
@@ -673,7 +675,7 @@
 {
     uint32_t dom;
     char *pci_str;
-    int32_t bdf = 0;
+    int32_t sbdf = 0;
     int seg, bus, dev, func;
 
     static char *kwd_list[] = { "domid", "pci", NULL };
@@ -683,26 +685,27 @@
 
     while ( next_bdf(&pci_str, &seg, &bus, &dev, &func) )
     {
-        bdf |= (bus & 0xff) << 16;
-        bdf |= (dev & 0x1f) << 11;
-        bdf |= (func & 0x7) << 8;
-
-        if ( xc_deassign_device(self->xc_handle, dom, bdf) != 0 )
+        sbdf = seg << 16;
+        sbdf |= (bus & 0xff) << 8;
+        sbdf |= (dev & 0x1f) << 3;
+        sbdf |= (func & 0x7);
+
+        if ( xc_deassign_device(self->xc_handle, dom, sbdf) != 0 )
         {
             if (errno == ENOSYS)
-                bdf = -1;
+                sbdf = -1;
             break;
         }
-        bdf = 0;
+        sbdf = 0;
     }
 
-    return Py_BuildValue("i", bdf);
+    return Py_BuildValue("i", sbdf);
 }
 
 static PyObject *pyxc_get_device_group(XcObject *self,
                                          PyObject *args)
 {
-    uint32_t bdf = 0;
+    uint32_t sbdf;
     uint32_t max_sdevs, num_sdevs;
     int domid, seg, bus, dev, func, rc, i;
     PyObject *Pystr;
@@ -720,12 +723,13 @@
     if (sdev_array == NULL)
         return PyErr_NoMemory();
 
-    bdf |= (bus & 0xff) << 16;
-    bdf |= (dev & 0x1f) << 11;
-    bdf |= (func & 0x7) << 8;
+    sbdf = seg << 16;
+    sbdf |= (bus & 0xff) << 8;
+    sbdf |= (dev & 0x1f) << 3;
+    sbdf |= (func & 0x7);
 
     rc = xc_get_device_group(self->xc_handle,
-        domid, bdf, max_sdevs, &num_sdevs, sdev_array);
+        domid, sbdf, max_sdevs, &num_sdevs, sdev_array);
 
     if ( rc < 0 )
     {
diff -r a422e2a4451e -r ec7c81fbe0de xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c	Sun Sep 18 00:26:52 2011 +0100
+++ b/xen/arch/ia64/xen/dom0_ops.c	Thu Sep 22 18:26:54 2011 +0100
@@ -258,138 +258,6 @@
     }
     break;
 
-    case XEN_DOMCTL_get_device_group:
-    {
-        struct domain *d;
-        u32 max_sdevs;
-        u8 bus, devfn;
-        XEN_GUEST_HANDLE_64(uint32) sdevs;
-        int num_sdevs;
-
-        ret = -ENOSYS;
-        if ( !iommu_enabled )
-            break;
-
-        ret = -EINVAL;
-        if ( (d = rcu_lock_domain_by_id(op->domain)) == NULL )
-            break;
-
-        bus = (op->u.get_device_group.machine_bdf >> 16) & 0xff;
-        devfn = (op->u.get_device_group.machine_bdf >> 8) & 0xff;
-        max_sdevs = op->u.get_device_group.max_sdevs;
-        sdevs = op->u.get_device_group.sdev_array;
-
-        num_sdevs = iommu_get_device_group(d, bus, devfn, sdevs, max_sdevs);
-        if ( num_sdevs < 0 )
-        {
-            dprintk(XENLOG_ERR, "iommu_get_device_group() failed!\n");
-            ret = -EFAULT;
-            op->u.get_device_group.num_sdevs = 0;
-        }
-        else
-        {
-            ret = 0;
-            op->u.get_device_group.num_sdevs = num_sdevs;
-        }
-        if ( copy_to_guest(u_domctl, op, 1) )
-            ret = -EFAULT;
-        rcu_unlock_domain(d);
-    }
-    break;
-
-    case XEN_DOMCTL_test_assign_device:
-    {
-        u8 bus, devfn;
-
-        ret = -ENOSYS;
-        if ( !iommu_enabled )
-            break;
-
-        ret = -EINVAL;
-        bus = (op->u.assign_device.machine_bdf >> 16) & 0xff;
-        devfn = (op->u.assign_device.machine_bdf >> 8) & 0xff;
-
-        if ( device_assigned(bus, devfn) )
-        {
-            printk( "XEN_DOMCTL_test_assign_device: "
-                     "%x:%x.%x already assigned, or non-existent\n",
-                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
-            break;
-        }
-        ret = 0;
-    }
-    break;
-
-    case XEN_DOMCTL_assign_device:
-    {
-        struct domain *d;
-        u8 bus, devfn;
-
-        ret = -ENOSYS;
-        if ( !iommu_enabled )
-            break;
-
-        ret = -EINVAL;
-        if ( unlikely((d = get_domain_by_id(op->domain)) == NULL) )
-        {
-            gdprintk(XENLOG_ERR,
-                "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n");
-            break;
-        }
-        bus = (op->u.assign_device.machine_bdf >> 16) & 0xff;
-        devfn = (op->u.assign_device.machine_bdf >> 8) & 0xff;
-
-        if ( device_assigned(bus, devfn) )
-        {
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: "
-                     "%x:%x.%x already assigned, or non-existent\n",
-                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
-            break;
-        }
-
-        ret = assign_device(d, bus, devfn);
-        if ( ret )
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: "
-                     "assign device (%x:%x.%x) failed\n",
-                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
-        put_domain(d);
-    }
-    break;
-
-    case XEN_DOMCTL_deassign_device:
-    {
-        struct domain *d;
-        u8 bus, devfn;
-
-        ret = -ENOSYS;
-        if ( !iommu_enabled )
-            break;
-
-        ret = -EINVAL;
-        if ( unlikely((d = get_domain_by_id(op->domain)) == NULL) )
-        {
-            gdprintk(XENLOG_ERR,
-                "XEN_DOMCTL_deassign_device: get_domain_by_id() failed\n");
-            break;
-        }
-        bus = (op->u.assign_device.machine_bdf >> 16) & 0xff;
-        devfn = (op->u.assign_device.machine_bdf >> 8) & 0xff;
-
-        if ( !device_assigned(bus, devfn) )
-            break;
-
-        spin_lock(&pcidevs_lock);
-        ret = deassign_device(d, bus, devfn);
-        spin_unlock(&pcidevs_lock);
-        if ( ret )
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_deassign_device: "
-                     "deassign device (%x:%x.%x) failed\n",
-                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
-
-        put_domain(d);
-    }
-    break;
-
     case XEN_DOMCTL_bind_pt_irq:
     {
         struct domain * d;
@@ -707,8 +575,8 @@
     break;
 
     default:
-        printk("arch_do_domctl: unrecognized domctl: %d!!!\n",op->cmd);
-        ret = -ENOSYS;
+        ret = iommu_do_domctl(op, u_domctl);
+        break;
 
     }
 
diff -r a422e2a4451e -r ec7c81fbe0de xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Sun Sep 18 00:26:52 2011 +0100
+++ b/xen/arch/x86/domctl.c	Thu Sep 22 18:26:54 2011 +0100
@@ -742,144 +742,6 @@
     }
     break;
 
-    case XEN_DOMCTL_get_device_group:
-    {
-        struct domain *d;
-        u32 max_sdevs;
-        u8 bus, devfn;
-        XEN_GUEST_HANDLE_64(uint32) sdevs;
-        int num_sdevs;
-
-        ret = -ENOSYS;
-        if ( !iommu_enabled )
-            break;
-
-        ret = -EINVAL;
-        if ( (d = rcu_lock_domain_by_id(domctl->domain)) == NULL )
-            break;
-
-        bus = (domctl->u.get_device_group.machine_bdf >> 16) & 0xff;
-        devfn = (domctl->u.get_device_group.machine_bdf >> 8) & 0xff;
-        max_sdevs = domctl->u.get_device_group.max_sdevs;
-        sdevs = domctl->u.get_device_group.sdev_array;
-
-        num_sdevs = iommu_get_device_group(d, bus, devfn, sdevs, max_sdevs);
-        if ( num_sdevs < 0 )
-        {
-            dprintk(XENLOG_ERR, "iommu_get_device_group() failed!\n");
-            ret = -EFAULT;
-            domctl->u.get_device_group.num_sdevs = 0;
-        }
-        else
-        {
-            ret = 0;
-            domctl->u.get_device_group.num_sdevs = num_sdevs;
-        }
-        if ( copy_to_guest(u_domctl, domctl, 1) )
-            ret = -EFAULT;
-        rcu_unlock_domain(d);
-    }
-    break;
-
-    case XEN_DOMCTL_test_assign_device:
-    {
-        u8 bus, devfn;
-
-        ret = -ENOSYS;
-        if ( !iommu_enabled )
-            break;
-
-        ret = xsm_test_assign_device(domctl->u.assign_device.machine_bdf);
-        if ( ret )
-            break;
-
-        ret = -EINVAL;
-        bus = (domctl->u.assign_device.machine_bdf >> 16) & 0xff;
-        devfn = (domctl->u.assign_device.machine_bdf >> 8) & 0xff;
-
-        if ( device_assigned(bus, devfn) )
-        {
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_test_assign_device: "
-                     "%x:%x.%x already assigned, or non-existent\n",
-                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
-            break;
-        }
-        ret = 0;
-    }
-    break;
-
-    case XEN_DOMCTL_assign_device:
-    {
-        struct domain *d;
-        u8 bus, devfn;
-
-        ret = -ENOSYS;
-        if ( !iommu_enabled )
-            break;
-
-        ret = -EINVAL;
-        if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) )
-        {
-            gdprintk(XENLOG_ERR,
-                "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n");
-            break;
-        }
-
-        ret = xsm_assign_device(d, domctl->u.assign_device.machine_bdf);
-        if ( ret )
-            goto assign_device_out;
-
-        bus = (domctl->u.assign_device.machine_bdf >> 16) & 0xff;
-        devfn = (domctl->u.assign_device.machine_bdf >> 8) & 0xff;
-
-        ret = assign_device(d, bus, devfn);
-        if ( ret )
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: "
-                     "assign device (%x:%x.%x) failed\n",
-                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
-
-    assign_device_out:
-        put_domain(d);
-    }
-    break;
-
-    case XEN_DOMCTL_deassign_device:
-    {
-        struct domain *d;
-        u8 bus, devfn;
-
-        ret = -ENOSYS;
-        if ( !iommu_enabled )
-            break;
-
-        ret = -EINVAL;
-        if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) )
-        {
-            gdprintk(XENLOG_ERR,
-                "XEN_DOMCTL_deassign_device: get_domain_by_id() failed\n");
-            break;
-        }
-
-        ret = xsm_assign_device(d, domctl->u.assign_device.machine_bdf);
-        if ( ret )
-            goto deassign_device_out;
-
-        bus = (domctl->u.assign_device.machine_bdf >> 16) & 0xff;
-        devfn = (domctl->u.assign_device.machine_bdf >> 8) & 0xff;
-
-        spin_lock(&pcidevs_lock);
-        ret = deassign_device(d, bus, devfn);
-        spin_unlock(&pcidevs_lock);
-        if ( ret )
-            gdprintk(XENLOG_ERR, "XEN_DOMCTL_deassign_device: "
-                     "deassign device (%x:%x.%x) failed\n",
-                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
-
-    deassign_device_out:
-        put_domain(d);
-    }
-    break;
-
     case XEN_DOMCTL_bind_pt_irq:
     {
         struct domain * d;
@@ -1601,7 +1463,7 @@
     break;
 
     default:
-        ret = -ENOSYS;
+        ret = iommu_do_domctl(domctl, u_domctl);
         break;
     }
 
diff -r a422e2a4451e -r ec7c81fbe0de xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Sun Sep 18 00:26:52 2011 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Thu Sep 22 18:26:54 2011 +0100
@@ -305,7 +305,7 @@
 }
 
 static int reassign_device( struct domain *source, struct domain *target,
-                            u8 bus, u8 devfn)
+                            u16 seg, u8 bus, u8 devfn)
 {
     struct pci_dev *pdev;
     struct amd_iommu *iommu;
@@ -313,7 +313,7 @@
     struct hvm_iommu *t = domain_hvm_iommu(target);
 
     ASSERT(spin_is_locked(&pcidevs_lock));
-    pdev = pci_get_pdev_by_domain(source, 0, bus, devfn);
+    pdev = pci_get_pdev_by_domain(source, seg, bus, devfn);
     if ( !pdev )
         return -ENODEV;
 
@@ -346,7 +346,7 @@
     return 0;
 }
 
-static int amd_iommu_assign_device(struct domain *d, u8 bus, u8 devfn)
+static int amd_iommu_assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn)
 {
     int bdf = (bus << 8) | devfn;
     int req_id = get_dma_requestor_id(bdf);
@@ -361,7 +361,7 @@
             ivrs_mappings[req_id].read_permission);
     }
 
-    return reassign_device(dom0, d, bus, devfn);
+    return reassign_device(dom0, d, seg, bus, devfn);
 }
 
 static void deallocate_next_page_table(struct page_info* pg, int level)
@@ -426,9 +426,9 @@
 }
 
 static int amd_iommu_return_device(
-    struct domain *s, struct domain *t, u8 bus, u8 devfn)
+    struct domain *s, struct domain *t, u16 seg, u8 bus, u8 devfn)
 {
-    return reassign_device(s, t, bus, devfn);
+    return reassign_device(s, t, seg, bus, devfn);
 }
 
 static int amd_iommu_add_device(struct pci_dev *pdev)
@@ -475,7 +475,7 @@
     return 0;
 }
 
-static int amd_iommu_group_id(u8 bus, u8 devfn)
+static int amd_iommu_group_id(u16 seg, u8 bus, u8 devfn)
 {
     int rt;
     int bdf = (bus << 8) | devfn;
diff -r a422e2a4451e -r ec7c81fbe0de xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Sun Sep 18 00:26:52 2011 +0100
+++ b/xen/drivers/passthrough/iommu.c	Thu Sep 22 18:26:54 2011 +0100
@@ -19,6 +19,7 @@
 #include <xen/paging.h>
 #include <xen/guest_access.h>
 #include <xen/softirq.h>
+#include <xsm/xsm.h>
 
 static void parse_iommu_param(char *s);
 static int iommu_populate_page_table(struct domain *d);
@@ -165,7 +166,22 @@
     return hd->platform_ops->remove_device(pdev);
 }
 
-int assign_device(struct domain *d, u8 bus, u8 devfn)
+/*
+ * If the device isn't owned by dom0, it means it already
+ * has been assigned to other domain, or it doesn't exist.
+ */
+static int device_assigned(u16 seg, u8 bus, u8 devfn)
+{
+    struct pci_dev *pdev;
+
+    spin_lock(&pcidevs_lock);
+    pdev = pci_get_pdev_by_domain(dom0, seg, bus, devfn);
+    spin_unlock(&pcidevs_lock);
+
+    return pdev ? 0 : -1;
+}
+
+static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn)
 {
     struct hvm_iommu *hd = domain_hvm_iommu(d);
     int rc = 0;
@@ -174,7 +190,7 @@
         return 0;
 
     spin_lock(&pcidevs_lock);
-    if ( (rc = hd->platform_ops->assign_device(d, bus, devfn)) )
+    if ( (rc = hd->platform_ops->assign_device(d, seg, bus, devfn)) )
         goto done;
 
     if ( has_arch_pdevs(d) && !need_iommu(d) )
@@ -272,7 +288,7 @@
 }
 
 /* caller should hold the pcidevs_lock */
-int deassign_device(struct domain *d, u8 bus, u8 devfn)
+int deassign_device(struct domain *d, u16 seg, u8 bus, u8 devfn)
 {
     struct hvm_iommu *hd = domain_hvm_iommu(d);
     struct pci_dev *pdev = NULL;
@@ -282,7 +298,7 @@
         return -EINVAL;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
-    pdev = pci_get_pdev(0, bus, devfn);
+    pdev = pci_get_pdev(seg, bus, devfn);
     if ( !pdev )
         return -ENODEV;
 
@@ -293,12 +309,12 @@
         return -EINVAL;
     }
 
-    ret = hd->platform_ops->reassign_device(d, dom0, bus, devfn);
+    ret = hd->platform_ops->reassign_device(d, dom0, seg, bus, devfn);
     if ( ret )
     {
         dprintk(XENLOG_ERR VTDPREFIX,
-                "d%d: Deassign device (%x:%x.%x) failed!\n",
-                d->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+                "d%d: Deassign device (%04x:%02x:%02x.%u) failed!\n",
+                d->domain_id, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         return ret;
     }
 
@@ -347,7 +363,8 @@
     return rc;
 }
 
-int iommu_get_device_group(struct domain *d, u8 bus, u8 devfn, 
+static int iommu_get_device_group(
+    struct domain *d, u16 seg, u8 bus, u8 devfn,
     XEN_GUEST_HANDLE_64(uint32) buf, int max_sdevs)
 {
     struct hvm_iommu *hd = domain_hvm_iommu(d);
@@ -360,15 +377,16 @@
     if ( !iommu_enabled || !ops || !ops->get_device_group_id )
         return 0;
 
-    group_id = ops->get_device_group_id(bus, devfn);
+    group_id = ops->get_device_group_id(seg, bus, devfn);
 
     spin_lock(&pcidevs_lock);
     for_each_pdev( d, pdev )
     {
-        if ( (pdev->bus == bus) && (pdev->devfn == devfn) )
+        if ( (pdev->seg != seg) ||
+             ((pdev->bus == bus) && (pdev->devfn == devfn)) )
             continue;
 
-        sdev_id = ops->get_device_group_id(pdev->bus, pdev->devfn);
+        sdev_id = ops->get_device_group_id(seg, pdev->bus, pdev->devfn);
         if ( (sdev_id == group_id) && (i < max_sdevs) )
         {
             bdf = 0;
@@ -443,6 +461,154 @@
     iommu_enabled = 0;
 }
 
+int iommu_do_domctl(
+    struct xen_domctl *domctl,
+    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
+{
+    struct domain *d;
+    u16 seg;
+    u8 bus, devfn;
+    int ret = 0;
+
+    if ( !iommu_enabled )
+        return -ENOSYS;
+
+    switch ( domctl->cmd )
+    {
+    case XEN_DOMCTL_get_device_group:
+    {
+        u32 max_sdevs;
+        XEN_GUEST_HANDLE_64(uint32) sdevs;
+
+        ret = -EINVAL;
+        if ( (d = rcu_lock_domain_by_id(domctl->domain)) == NULL )
+            break;
+
+        seg = domctl->u.get_device_group.machine_sbdf >> 16;
+        bus = (domctl->u.get_device_group.machine_sbdf >> 8) & 0xff;
+        devfn = domctl->u.get_device_group.machine_sbdf & 0xff;
+        max_sdevs = domctl->u.get_device_group.max_sdevs;
+        sdevs = domctl->u.get_device_group.sdev_array;
+
+        ret = iommu_get_device_group(d, seg, bus, devfn, sdevs, max_sdevs);
+        if ( ret < 0 )
+        {
+            dprintk(XENLOG_ERR, "iommu_get_device_group() failed!\n");
+            ret = -EFAULT;
+            domctl->u.get_device_group.num_sdevs = 0;
+        }
+        else
+        {
+            domctl->u.get_device_group.num_sdevs = ret;
+            ret = 0;
+        }
+        if ( copy_to_guest(u_domctl, domctl, 1) )
+            ret = -EFAULT;
+        rcu_unlock_domain(d);
+    }
+    break;
+
+    case XEN_DOMCTL_test_assign_device:
+        ret = xsm_test_assign_device(domctl->u.assign_device.machine_sbdf);
+        if ( ret )
+            break;
+
+        seg = domctl->u.get_device_group.machine_sbdf >> 16;
+        bus = (domctl->u.assign_device.machine_sbdf >> 8) & 0xff;
+        devfn = domctl->u.assign_device.machine_sbdf & 0xff;
+
+        if ( device_assigned(seg, bus, devfn) )
+        {
+            gdprintk(XENLOG_ERR, "XEN_DOMCTL_test_assign_device: "
+                     "%04x:%02x:%02x.%u already assigned, or non-existent\n",
+                     seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            ret = -EINVAL;
+        }
+        break;
+
+    case XEN_DOMCTL_assign_device:
+        if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) )
+        {
+            gdprintk(XENLOG_ERR,
+                "XEN_DOMCTL_assign_device: get_domain_by_id() failed\n");
+            ret = -EINVAL;
+            break;
+        }
+
+        ret = xsm_assign_device(d, domctl->u.assign_device.machine_sbdf);
+        if ( ret )
+            goto assign_device_out;
+
+        seg = domctl->u.get_device_group.machine_sbdf >> 16;
+        bus = (domctl->u.assign_device.machine_sbdf >> 8) & 0xff;
+        devfn = domctl->u.assign_device.machine_sbdf & 0xff;
+
+#ifdef __ia64__ /* XXX Is this really needed? */
+        if ( device_assigned(seg, bus, devfn) )
+        {
+            gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: "
+                     "%x:%x.%x already assigned, or non-existent\n",
+                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            ret = -EINVAL;
+            goto assign_device_out;
+        }
+#endif
+
+        ret = assign_device(d, seg, bus, devfn);
+        if ( ret )
+            gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: "
+                     "assign device (%04x:%02x:%02x.%u) failed\n",
+                     seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+
+    assign_device_out:
+        put_domain(d);
+        break;
+
+    case XEN_DOMCTL_deassign_device:
+        if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) )
+        {
+            gdprintk(XENLOG_ERR,
+                "XEN_DOMCTL_deassign_device: get_domain_by_id() failed\n");
+            ret = -EINVAL;
+            break;
+        }
+
+        ret = xsm_assign_device(d, domctl->u.assign_device.machine_sbdf);
+        if ( ret )
+            goto deassign_device_out;
+
+        seg = domctl->u.get_device_group.machine_sbdf >> 16;
+        bus = (domctl->u.assign_device.machine_sbdf >> 8) & 0xff;
+        devfn = domctl->u.assign_device.machine_sbdf & 0xff;
+
+#ifdef __ia64__ /* XXX Is this really needed? */
+        if ( !device_assigned(seg, bus, devfn) )
+        {
+            ret = -EINVAL;
+            goto deassign_device_out;
+        }
+#endif
+
+        spin_lock(&pcidevs_lock);
+        ret = deassign_device(d, seg, bus, devfn);
+        spin_unlock(&pcidevs_lock);
+        if ( ret )
+            gdprintk(XENLOG_ERR, "XEN_DOMCTL_deassign_device: "
+                     "deassign device (%04x:%02x:%02x.%u) failed\n",
+                     seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+
+    deassign_device_out:
+        put_domain(d);
+        break;
+
+    default:
+        ret = -ENOSYS;
+        break;
+    }
+
+    return ret;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r a422e2a4451e -r ec7c81fbe0de xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Sun Sep 18 00:26:52 2011 +0100
+++ b/xen/drivers/passthrough/pci.c	Thu Sep 22 18:26:54 2011 +0100
@@ -441,11 +441,12 @@
     while ( (pdev = pci_get_pdev_by_domain(d, -1, -1, -1)) )
     {
         pci_cleanup_msi(pdev);
-        bus = pdev->bus; devfn = pdev->devfn;
-        if ( deassign_device(d, bus, devfn) )
-            printk("domain %d: deassign device (%02x:%02x.%x) failed!\n",
-                   d->domain_id, pdev->bus, PCI_SLOT(pdev->devfn),
-                   PCI_FUNC(pdev->devfn));
+        bus = pdev->bus;
+        devfn = pdev->devfn;
+        if ( deassign_device(d, pdev->seg, bus, devfn) )
+            printk("domain %d: deassign device (%04x:%02x:%02x.%u) failed!\n",
+                   d->domain_id, pdev->seg, bus,
+                   PCI_SLOT(devfn), PCI_FUNC(devfn));
     }
     spin_unlock(&pcidevs_lock);
 }
diff -r a422e2a4451e -r ec7c81fbe0de xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Sun Sep 18 00:26:52 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Sep 22 18:26:54 2011 +0100
@@ -1620,13 +1620,13 @@
 static int reassign_device_ownership(
     struct domain *source,
     struct domain *target,
-    u8 bus, u8 devfn)
+    u16 seg, u8 bus, u8 devfn)
 {
     struct pci_dev *pdev;
     int ret;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
-    pdev = pci_get_pdev_by_domain(source, 0, bus, devfn);
+    pdev = pci_get_pdev_by_domain(source, seg, bus, devfn);
 
     if (!pdev)
         return -ENODEV;
@@ -2153,27 +2153,8 @@
     return ret;
 }
 
-/*
- * If the device isn't owned by dom0, it means it already
- * has been assigned to other domain, or it's not exist.
- */
-int device_assigned(u8 bus, u8 devfn)
-{
-    struct pci_dev *pdev;
-
-    spin_lock(&pcidevs_lock);
-    pdev = pci_get_pdev_by_domain(dom0, 0, bus, devfn);
-    if (!pdev)
-    {
-        spin_unlock(&pcidevs_lock);
-        return -1;
-    }
-
-    spin_unlock(&pcidevs_lock);
-    return 0;
-}
-
-static int intel_iommu_assign_device(struct domain *d, u8 bus, u8 devfn)
+static int intel_iommu_assign_device(
+    struct domain *d, u16 seg, u8 bus, u8 devfn)
 {
     struct acpi_rmrr_unit *rmrr;
     int ret = 0, i;
@@ -2184,7 +2165,7 @@
         return -ENODEV;
 
     ASSERT(spin_is_locked(&pcidevs_lock));
-    pdev = pci_get_pdev(0, bus, devfn);
+    pdev = pci_get_pdev(seg, bus, devfn);
     if (!pdev)
         return -ENODEV;
 
@@ -2195,7 +2176,7 @@
        return -EBUSY;
     }
 
-    ret = reassign_device_ownership(dom0, d, bus, devfn);
+    ret = reassign_device_ownership(dom0, d, seg, bus, devfn);
     if ( ret )
         goto done;
 
@@ -2227,7 +2208,7 @@
     return ret;
 }
 
-static int intel_iommu_group_id(u8 bus, u8 devfn)
+static int intel_iommu_group_id(u16 seg, u8 bus, u8 devfn)
 {
     u8 secbus;
     if ( find_upstream_bridge(&bus, &devfn, &secbus) < 0 )
diff -r a422e2a4451e -r ec7c81fbe0de xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Sun Sep 18 00:26:52 2011 +0100
+++ b/xen/include/public/domctl.h	Thu Sep 22 18:26:54 2011 +0100
@@ -455,15 +455,15 @@
 /* XEN_DOMCTL_test_assign_device */
 /* XEN_DOMCTL_deassign_device */
 struct xen_domctl_assign_device {
-    uint32_t  machine_bdf;   /* machine PCI ID of assigned device */
+    uint32_t  machine_sbdf;   /* machine PCI ID of assigned device */
 };
 typedef struct xen_domctl_assign_device xen_domctl_assign_device_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_assign_device_t);
 
-/* Retrieve sibling devices infomation of machine_bdf */
+/* Retrieve sibling devices infomation of machine_sbdf */
 /* XEN_DOMCTL_get_device_group */
 struct xen_domctl_get_device_group {
-    uint32_t  machine_bdf;      /* IN */
+    uint32_t  machine_sbdf;     /* IN */
     uint32_t  max_sdevs;        /* IN */
     uint32_t  num_sdevs;        /* OUT */
     XEN_GUEST_HANDLE_64(uint32)  sdev_array;   /* OUT */
diff -r a422e2a4451e -r ec7c81fbe0de xen/include/xen/iommu.h
--- a/xen/include/xen/iommu.h	Sun Sep 18 00:26:52 2011 +0100
+++ b/xen/include/xen/iommu.h	Thu Sep 22 18:26:54 2011 +0100
@@ -74,11 +74,7 @@
 int iommu_domain_init(struct domain *d);
 void iommu_dom0_init(struct domain *d);
 void iommu_domain_destroy(struct domain *d);
-int device_assigned(u8 bus, u8 devfn);
-int assign_device(struct domain *d, u8 bus, u8 devfn);
-int deassign_device(struct domain *d, u8 bus, u8 devfn);
-int iommu_get_device_group(struct domain *d, u8 bus, u8 devfn,
-    XEN_GUEST_HANDLE_64(uint32) buf, int max_sdevs);
+int deassign_device(struct domain *d, u16 seg, u8 bus, u8 devfn);
 
 /* iommu_map_page() takes flags to direct the mapping operation. */
 #define _IOMMUF_readable 0
@@ -125,14 +121,14 @@
     void (*dom0_init)(struct domain *d);
     int (*add_device)(struct pci_dev *pdev);
     int (*remove_device)(struct pci_dev *pdev);
-    int (*assign_device)(struct domain *d, u8 bus, u8 devfn);
+    int (*assign_device)(struct domain *d, u16 seg, u8 bus, u8 devfn);
     void (*teardown)(struct domain *d);
     int (*map_page)(struct domain *d, unsigned long gfn, unsigned long mfn,
                     unsigned int flags);
     int (*unmap_page)(struct domain *d, unsigned long gfn);
     int (*reassign_device)(struct domain *s, struct domain *t,
-			   u8 bus, u8 devfn);
-    int (*get_device_group_id)(u8 bus, u8 devfn);
+			   u16 seg, u8 bus, u8 devfn);
+    int (*get_device_group_id)(u16 seg, u8 bus, u8 devfn);
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
     void (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg);
     void (*read_msi_from_ire)(struct msi_desc *msi_desc, struct msi_msg *msg);
@@ -155,4 +151,6 @@
 void iommu_set_dom0_mapping(struct domain *d);
 void iommu_share_p2m_table(struct domain *d);
 
+int iommu_do_domctl(struct xen_domctl *, XEN_GUEST_HANDLE(xen_domctl_t));
+
 #endif /* _IOMMU_H_ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:56:40 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:56:40 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jO3-0003Zl-W9; Tue, 27 Sep 2011 18:56:40 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMp-0003AK-0Y
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:23 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1317174920!14074187!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4952 invoked from network); 28 Sep 2011 01:55:20 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:20 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMl-0000Vd-T9
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:19 +0100
Message-Id: <E1R8jMl-0000Vd-T9@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] VT-d: fix off-by-one error in RMRR
	validation
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316712754 -3600
# Node ID 28147fd781af7cf8717d18165fecf1442ea77db3
# Parent  571b6e90dfb463b4a56b2a1c8d7d00f7741ca692
VT-d: fix off-by-one error in RMRR validation

(base_addr,end_addr) is an inclusive range, and hence there shouldn't
be a subtraction of 1 in the second invocation of page_is_ram_type().
For RMRRs covering a single page that actually resulted in the
immediately preceding page to get checked (which could have resulted
in a false warning).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 571b6e90dfb4 -r 28147fd781af xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Thu Sep 22 18:31:44 2011 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Thu Sep 22 18:32:34 2011 +0100
@@ -520,7 +520,7 @@
      * inform the user
      */
     if ( (!page_is_ram_type(paddr_to_pfn(base_addr), RAM_TYPE_RESERVED)) ||
-         (!page_is_ram_type(paddr_to_pfn(end_addr) - 1, RAM_TYPE_RESERVED)) )
+         (!page_is_ram_type(paddr_to_pfn(end_addr), RAM_TYPE_RESERVED)) )
     {
         dprintk(XENLOG_WARNING VTDPREFIX,
                 "  RMRR address range not in reserved memory "

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:56:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:56:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jOA-0003cf-Em; Tue, 27 Sep 2011 18:56:46 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMp-0003Ag-Iv
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1317174885!49778705!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5524 invoked from network); 28 Sep 2011 01:54:45 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:54:45 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMm-0000bt-Dz
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:20 +0100
Message-Id: <E1R8jMm-0000bt-Dz@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:19 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] XZ decompressor: Fix decoding of
	empty LZMA2 streams
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316712828 -3600
# Node ID db1ea4b127cd99bcf6fa731ac3865c1988b56ae7
# Parent  28147fd781af7cf8717d18165fecf1442ea77db3
XZ decompressor: Fix decoding of empty LZMA2 streams

From: Lasse Collin <lasse.collin@tukaani.org>

The old code considered valid empty LZMA2 streams to be corrupt.
Note that a typical empty .xz file has no LZMA2 data at all,
and thus most .xz files having no uncompressed data are handled
correctly even without this fix.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 28147fd781af -r db1ea4b127cd xen/common/xz/dec_lzma2.c
--- a/xen/common/xz/dec_lzma2.c	Thu Sep 22 18:32:34 2011 +0100
+++ b/xen/common/xz/dec_lzma2.c	Thu Sep 22 18:33:48 2011 +0100
@@ -969,6 +969,9 @@
 			 */
 			tmp = b->in[b->in_pos++];
 
+			if (tmp == 0x00)
+				return XZ_STREAM_END;
+
 			if (tmp >= 0xE0 || tmp == 0x01) {
 				s->lzma2.need_props = true;
 				s->lzma2.need_dict_reset = false;
@@ -1001,9 +1004,6 @@
 						lzma_reset(s);
 				}
 			} else {
-				if (tmp == 0x00)
-					return XZ_STREAM_END;
-
 				if (tmp > 0x02)
 					return XZ_DATA_ERROR;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:56:53 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:56:53 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jOG-0003fl-EA; Tue, 27 Sep 2011 18:56:52 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMq-0003Au-IE
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:25 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1317174895!56724509!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5160 invoked from network); 28 Sep 2011 01:54:55 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:54:55 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMn-0000dF-FB
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:21 +0100
Message-Id: <E1R8jMn-0000dF-FB@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:20 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: ucode-amd: Don't warn when no
	ucode is available for a CPU revision
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316712930 -3600
# Node ID 503ee256fecf0921fa04b8a52a96f4c3b93553fd
# Parent  5c97b02f48fc19a3924686e641bc224e303fec34
x86: ucode-amd: Don't warn when no ucode is available for a CPU revision

This patch originally comes from the Linus mainline kernel (2.6.33),
find below the patch details:

From: Andreas Herrmann <herrmann.der.user@googlemail.com>

There is no point in warning when there is no ucode available
for a specific CPU revision. Currently the container-file, which
provides the AMD ucode patches for OS load, contains only a few
ucode patches.

It's already clearly indicated by the printed patch_level
whenever new ucode was available and an update happened. So the
warning message is of no help but rather annoying on systems
with many CPUs.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 5c97b02f48fc -r 503ee256fecf xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c	Thu Sep 22 18:34:27 2011 +0100
+++ b/xen/arch/x86/microcode_amd.c	Thu Sep 22 18:35:30 2011 +0100
@@ -96,11 +96,7 @@
     }
 
     if ( !equiv_cpu_id )
-    {
-        printk(KERN_ERR "microcode: CPU%d cpu_id "
-               "not found in equivalent cpu table\n", cpu);
-        return -EINVAL;
-    }
+	    return 0;
 
     if ( (mc_header->processor_rev_id) != equiv_cpu_id )
     {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:56:59 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:56:59 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jON-0003in-CS; Tue, 27 Sep 2011 18:56:59 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMq-0003Aj-3D
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:25 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-21.messagelabs.com!1317174901!39912453!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27655 invoked from network); 28 Sep 2011 01:55:01 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:01 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMm-0000cY-Ud
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:20 +0100
Message-Id: <E1R8jMm-0000cY-Ud@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:20 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] XZ: Fix incorrect XZ_BUF_ERROR
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1316712867 -3600
# Node ID 5c97b02f48fc19a3924686e641bc224e303fec34
# Parent  db1ea4b127cd99bcf6fa731ac3865c1988b56ae7
XZ: Fix incorrect XZ_BUF_ERROR

From: Lasse Collin <lasse.collin@tukaani.org>

xz_dec_run() could incorrectly return XZ_BUF_ERROR if all of the
following was true:

 - The caller knows how many bytes of output to expect and only
   provides
   that much output space.

 - When the last output bytes are decoded, the caller-provided input
   buffer ends right before the LZMA2 end of payload marker.  So LZMA2
   won't provide more output anymore, but it won't know it yet and
   thus
   won't return XZ_STREAM_END yet.

 - A BCJ filter is in use and it hasn't left any unfiltered bytes in
   the
   temp buffer.  This can happen with any BCJ filter, but in practice
   it's more likely with filters other than the x86 BCJ.

This fixes <https://bugzilla.redhat.com/show_bug.cgi?id=3D735408>
where Squashfs thinks that a valid file system is corrupt.

This also fixes a similar bug in single-call mode where the
uncompressed size of a block using BCJ + LZMA2 was 0 bytes and caller
provided no output space.  Many empty .xz files don't contain any
blocks and thus don't trigger this bug.

This also tweaks a closely related detail: xz_dec_bcj_run() could call
xz_dec_lzma2_run() to decode into temp buffer when it was known to be
useless.  This was harmless although it wasted a minuscule number of
CPU cycles.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r db1ea4b127cd -r 5c97b02f48fc xen/common/xz/dec_bcj.c
--- a/xen/common/xz/dec_bcj.c	Thu Sep 22 18:33:48 2011 +0100
+++ b/xen/common/xz/dec_bcj.c	Thu Sep 22 18:34:27 2011 +0100
@@ -441,8 +441,12 @@
 	 * next filter in the chain. Apply the BCJ filter on the new data
 	 * in the output buffer. If everything cannot be filtered, copy it
 	 * to temp and rewind the output buffer position accordingly.
+	 *
+	 * This needs to be always run when temp.size == 0 to handle a special
+	 * case where the output buffer is full and the next filter has no
+	 * more output coming but hasn't returned XZ_STREAM_END yet.
 	 */
-	if (s->temp.size < b->out_size - b->out_pos) {
+	if (s->temp.size < b->out_size - b->out_pos || s->temp.size == 0) {
 		out_start = b->out_pos;
 		memcpy(b->out + b->out_pos, s->temp.buf, s->temp.size);
 		b->out_pos += s->temp.size;
@@ -465,16 +469,25 @@
 		s->temp.size = b->out_pos - out_start;
 		b->out_pos -= s->temp.size;
 		memcpy(s->temp.buf, b->out + b->out_pos, s->temp.size);
+
+		/*
+		 * If there wasn't enough input to the next filter to fill
+		 * the output buffer with unfiltered data, there's no point
+		 * to try decoding more data to temp.
+		 */
+		if (b->out_pos + s->temp.size < b->out_size)
+			return XZ_OK;
 	}
 
 	/*
-	 * If we have unfiltered data in temp, try to fill by decoding more
-	 * data from the next filter. Apply the BCJ filter on temp. Then we
-	 * hopefully can fill the actual output buffer by copying filtered
-	 * data from temp. A mix of filtered and unfiltered data may be left
-	 * in temp; it will be taken care on the next call to this function.
+	 * We have unfiltered data in temp. If the output buffer isn't full
+	 * yet, try to fill the temp buffer by decoding more data from the
+	 * next filter. Apply the BCJ filter on temp. Then we hopefully can
+	 * fill the actual output buffer by copying filtered data from temp.
+	 * A mix of filtered and unfiltered data may be left in temp; it will
+	 * be taken care on the next call to this function.
 	 */
-	if (s->temp.size > 0) {
+	if (b->out_pos < b->out_size) {
 		/* Make b->out{,_pos,_size} temporarily point to s->temp. */
 		s->out = b->out;
 		s->out_pos = b->out_pos;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:57:07 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:57:07 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jOU-0003n3-Ju; Tue, 27 Sep 2011 18:57:06 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMr-0003BA-4R
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:25 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1317174922!17729457!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31274 invoked from network); 28 Sep 2011 01:55:22 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:22 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMn-0000e0-W7
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:21 +0100
Message-Id: <E1R8jMn-0000e0-W7@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:21 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: fix install of lomount
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1316713026 -3600
# Node ID cc339ab1d91789ed6ff4d3d9abc1bae2e90ac294
# Parent  503ee256fecf0921fa04b8a52a96f4c3b93553fd
tools: fix install of lomount

$(BIN) went away in 23124:e3d4c34b14a3.

Also there are no *.so, *.a or *.rpm built in here

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 503ee256fecf -r cc339ab1d917 tools/misc/lomount/Makefile
--- a/tools/misc/lomount/Makefile	Thu Sep 22 18:35:30 2011 +0100
+++ b/tools/misc/lomount/Makefile	Thu Sep 22 18:37:06 2011 +0100
@@ -11,11 +11,11 @@
 
 .PHONY: install
 install install-recurse: build
-	$(INSTALL_PROG) $(BIN) $(SCRIPTS) $(DESTDIR)$(BINDIR)
+	$(INSTALL_PROG) lomount $(SCRIPTS) $(DESTDIR)$(BINDIR)
 
 .PHONY: clean
 clean:
-	$(RM) *.a *.so *.o *.rpm $(BIN)
+	$(RM) *.o lomount
 
 lomount: lomount.o
 	$(CC) $(CFLAGS) -o $@ $< 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:57:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:57:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jOe-0003rA-5g; Tue, 27 Sep 2011 18:57:16 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMr-0003BF-LU
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1317174922!14074188!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4969 invoked from network); 28 Sep 2011 01:55:22 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:22 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMo-0000el-HM
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:22 +0100
Message-Id: <E1R8jMo-0000el-HM@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:22 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Add save/restore support for
	viridian APIC assist pfn.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Paul Durrant <paul.durrant@citrix.com>
# Date 1317071421 -3600
# Node ID fef59e4eaf8d6e52c21f7ae309fdebbbbb725d1d
# Parent  cc339ab1d91789ed6ff4d3d9abc1bae2e90ac294
Add save/restore support for viridian APIC assist pfn.

c/s 17b754cab7b0 introduced a per-VCPU viridian structure to
store the APIC assist pfn. This patch adds support for save and
restore of that value.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r cc339ab1d917 -r fef59e4eaf8d tools/misc/xen-hvmctx.c
--- a/tools/misc/xen-hvmctx.c	Thu Sep 22 18:37:06 2011 +0100
+++ b/tools/misc/xen-hvmctx.c	Mon Sep 26 22:10:21 2011 +0100
@@ -366,15 +366,23 @@
                (unsigned long long) p.msr_mtrr_fixed[i]);
 }
 
-static void dump_viridian(void)
+static void dump_viridian_domain(void)
 {
-    HVM_SAVE_TYPE(VIRIDIAN) p;
+    HVM_SAVE_TYPE(VIRIDIAN_DOMAIN) p;
     READ(p);
-    printf("    VIRIDIAN: hypercall gpa 0x%llx, guest ID 0x%llx\n",
+    printf("    VIRIDIAN_DOMAIN: hypercall gpa 0x%llx, guest_os_id 0x%llx\n",
            (unsigned long long) p.hypercall_gpa,
            (unsigned long long) p.guest_os_id);           
 }
 
+static void dump_viridian_vcpu(void)
+{
+    HVM_SAVE_TYPE(VIRIDIAN_VCPU) p;
+    READ(p);
+    printf("    VIRIDIAN_VCPU: apic_assist 0x%llx\n",
+           (unsigned long long) p.apic_assist);           
+}
+
 int main(int argc, char **argv)
 {
     int entry, domid;
@@ -439,7 +447,8 @@
         case HVM_SAVE_CODE(HPET): dump_hpet(); break;
         case HVM_SAVE_CODE(PMTIMER): dump_pmtimer(); break;
         case HVM_SAVE_CODE(MTRR): dump_mtrr(); break;
-        case HVM_SAVE_CODE(VIRIDIAN): dump_viridian(); break;
+        case HVM_SAVE_CODE(VIRIDIAN_DOMAIN): dump_viridian_domain(); break;
+        case HVM_SAVE_CODE(VIRIDIAN_VCPU): dump_viridian_vcpu(); break;
         case HVM_SAVE_CODE(END): break;
         default:
             printf(" ** Don't understand type %u: skipping\n",
diff -r cc339ab1d917 -r fef59e4eaf8d xen/arch/x86/hvm/viridian.c
--- a/xen/arch/x86/hvm/viridian.c	Thu Sep 22 18:37:06 2011 +0100
+++ b/xen/arch/x86/hvm/viridian.c	Mon Sep 26 22:10:21 2011 +0100
@@ -172,10 +172,10 @@
     uint8_t *p;
 
     /*
-     * We don't support the APIC assist page, and that fact is reflected in
-     * our CPUID flags. However, Newer versions of Windows have a bug which
-     * means that they don't recognise that, and tries to use the page
-     * anyway. We therefore have to fake up just enough to keep windows happy.
+     * We don't yet make use of the APIC assist page but by setting
+     * the CPUID3A_MSR_APIC_ACCESS bit in CPUID leaf 40000003 we are duty
+     * bound to support the MSR. We therefore do just enough to keep windows
+     * happy.
      *
      * See http://msdn.microsoft.com/en-us/library/ff538657%28VS.85%29.aspx for
      * details of how Windows uses the page.
@@ -387,9 +387,9 @@
     return HVM_HCALL_completed;
 }
 
-static int viridian_save_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
+static int viridian_save_domain_ctxt(struct domain *d, hvm_domain_context_t *h)
 {
-    struct hvm_viridian_context ctxt;
+    struct hvm_viridian_domain_context ctxt;
 
     if ( !is_viridian_domain(d) )
         return 0;
@@ -397,14 +397,14 @@
     ctxt.hypercall_gpa = d->arch.hvm_domain.viridian.hypercall_gpa.raw;
     ctxt.guest_os_id   = d->arch.hvm_domain.viridian.guest_os_id.raw;
 
-    return (hvm_save_entry(VIRIDIAN, 0, h, &ctxt) != 0);
+    return (hvm_save_entry(VIRIDIAN_DOMAIN, 0, h, &ctxt) != 0);
 }
 
-static int viridian_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
+static int viridian_load_domain_ctxt(struct domain *d, hvm_domain_context_t *h)
 {
-    struct hvm_viridian_context ctxt;
+    struct hvm_viridian_domain_context ctxt;
 
-    if ( hvm_load_entry(VIRIDIAN, h, &ctxt) != 0 )
+    if ( hvm_load_entry(VIRIDIAN_DOMAIN, h, &ctxt) != 0 )
         return -EINVAL;
 
     d->arch.hvm_domain.viridian.hypercall_gpa.raw = ctxt.hypercall_gpa;
@@ -413,5 +413,48 @@
     return 0;
 }
 
-HVM_REGISTER_SAVE_RESTORE(VIRIDIAN, viridian_save_cpu_ctxt,
-                          viridian_load_cpu_ctxt, 1, HVMSR_PER_DOM);
+HVM_REGISTER_SAVE_RESTORE(VIRIDIAN_DOMAIN, viridian_save_domain_ctxt,
+                          viridian_load_domain_ctxt, 1, HVMSR_PER_DOM);
+
+static int viridian_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
+{
+    struct vcpu *v;
+
+    if ( !is_viridian_domain(d) )
+        return 0;
+
+    for_each_vcpu( d, v ) {
+        struct hvm_viridian_vcpu_context ctxt;
+
+        ctxt.apic_assist = v->arch.hvm_vcpu.viridian.apic_assist.raw;
+
+        if ( hvm_save_entry(VIRIDIAN_VCPU, v->vcpu_id, h, &ctxt) != 0 )
+            return 1;
+    }
+
+    return 0;
+}
+
+static int viridian_load_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
+{
+    int vcpuid;
+    struct vcpu *v;
+    struct hvm_viridian_vcpu_context ctxt;
+
+    vcpuid = hvm_load_instance(h);
+    if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
+    {
+        gdprintk(XENLOG_ERR, "HVM restore: domain has no vcpu %u\n", vcpuid);
+        return -EINVAL;
+    }
+
+    if ( hvm_load_entry(VIRIDIAN_VCPU, h, &ctxt) != 0 )
+        return -EINVAL;
+
+    v->arch.hvm_vcpu.viridian.apic_assist.raw = ctxt.apic_assist;
+
+    return 0;
+}
+
+HVM_REGISTER_SAVE_RESTORE(VIRIDIAN_VCPU, viridian_save_vcpu_ctxt,
+                          viridian_load_vcpu_ctxt, 1, HVMSR_PER_VCPU);
diff -r cc339ab1d917 -r fef59e4eaf8d xen/include/public/arch-x86/hvm/save.h
--- a/xen/include/public/arch-x86/hvm/save.h	Thu Sep 22 18:37:06 2011 +0100
+++ b/xen/include/public/arch-x86/hvm/save.h	Mon Sep 26 22:10:21 2011 +0100
@@ -547,18 +547,6 @@
 DECLARE_HVM_SAVE_TYPE(MTRR, 14, struct hvm_hw_mtrr);
 
 /*
- * Viridian hypervisor context.
- */
-
-struct hvm_viridian_context {
-    uint64_t hypercall_gpa;
-    uint64_t guest_os_id;
-};
-
-DECLARE_HVM_SAVE_TYPE(VIRIDIAN, 15, struct hvm_viridian_context);
-
-
-/*
  * The save area of XSAVE/XRSTOR.
  */
 
@@ -580,9 +568,26 @@
 
 #define CPU_XSAVE_CODE  16
 
+/*
+ * Viridian hypervisor context.
+ */
+
+struct hvm_viridian_domain_context {
+    uint64_t hypercall_gpa;
+    uint64_t guest_os_id;
+};
+
+DECLARE_HVM_SAVE_TYPE(VIRIDIAN_DOMAIN, 15, struct hvm_viridian_domain_context);
+
+struct hvm_viridian_vcpu_context {
+    uint64_t apic_assist;
+};
+
+DECLARE_HVM_SAVE_TYPE(VIRIDIAN_VCPU, 17, struct hvm_viridian_vcpu_context);
+
 /* 
  * Largest type-code in use
  */
-#define HVM_SAVE_CODE_MAX 16
+#define HVM_SAVE_CODE_MAX 17
 
 #endif /* __XEN_PUBLIC_HVM_SAVE_X86_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:57:26 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:57:26 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jOn-0003v8-Nk; Tue, 27 Sep 2011 18:57:25 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMs-0003BP-6H
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1317174906!48365124!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30492 invoked from network); 28 Sep 2011 01:55:06 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:06 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMp-0000fY-3x
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:23 +0100
Message-Id: <E1R8jMp-0000fY-3x@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:22 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: track number of paged
	pages in struct domain
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olafiaepfle.de>
# Date 1317071982 -3600
# Node ID 651aed73b39c4d1613e7b95c29953309b38f7cc2
# Parent  fef59e4eaf8d6e52c21f7ae309fdebbbbb725d1d
xenpaging: track number of paged pages in struct domain

The toolstack should know how many pages are paged-out at a given point
in time so it could make smarter decisions about how many pages should
be paged or ballooned.

Add a new member to xen_domctl_getdomaininfo and bump interface version.
Use the new member in xc_dominfo_t.
The SONAME of libxc should be changed if this patch gets applied.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r fef59e4eaf8d -r 651aed73b39c tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c	Mon Sep 26 22:10:21 2011 +0100
+++ b/tools/libxc/xc_domain.c	Mon Sep 26 22:19:42 2011 +0100
@@ -235,6 +235,7 @@
         info->ssidref  = domctl.u.getdomaininfo.ssidref;
         info->nr_pages = domctl.u.getdomaininfo.tot_pages;
         info->nr_shared_pages = domctl.u.getdomaininfo.shr_pages;
+        info->nr_paged_pages = domctl.u.getdomaininfo.paged_pages;
         info->max_memkb = domctl.u.getdomaininfo.max_pages << (PAGE_SHIFT-10);
         info->shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
         info->cpu_time = domctl.u.getdomaininfo.cpu_time;
diff -r fef59e4eaf8d -r 651aed73b39c tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Mon Sep 26 22:10:21 2011 +0100
+++ b/tools/libxc/xenctrl.h	Mon Sep 26 22:19:42 2011 +0100
@@ -351,6 +351,7 @@
     unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
     unsigned long nr_pages; /* current number, not maximum */
     unsigned long nr_shared_pages;
+    unsigned long nr_paged_pages;
     unsigned long shared_info_frame;
     uint64_t      cpu_time;
     unsigned long max_memkb;
diff -r fef59e4eaf8d -r 651aed73b39c xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Mon Sep 26 22:10:21 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Mon Sep 26 22:19:42 2011 +0100
@@ -746,6 +746,9 @@
     /* Put the page back so it gets freed */
     put_page(page);
 
+    /* Track number of paged gfns */
+    atomic_inc(&d->paged_pages);
+
     return 0;
 }
 
@@ -831,6 +834,8 @@
     audit_p2m(p2m, 1);
     p2m_unlock(p2m);
 
+    atomic_dec(&d->paged_pages);
+
     return 0;
 }
 
diff -r fef59e4eaf8d -r 651aed73b39c xen/common/domctl.c
--- a/xen/common/domctl.c	Mon Sep 26 22:10:21 2011 +0100
+++ b/xen/common/domctl.c	Mon Sep 26 22:19:42 2011 +0100
@@ -137,6 +137,7 @@
     info->tot_pages         = d->tot_pages;
     info->max_pages         = d->max_pages;
     info->shr_pages         = atomic_read(&d->shr_pages);
+    info->paged_pages       = atomic_read(&d->paged_pages);
     info->shared_info_frame = mfn_to_gmfn(d, __pa(d->shared_info)>>PAGE_SHIFT);
     BUG_ON(SHARED_M2P(info->shared_info_frame));
 
diff -r fef59e4eaf8d -r 651aed73b39c xen/include/public/domctl.h
--- a/xen/include/public/domctl.h	Mon Sep 26 22:10:21 2011 +0100
+++ b/xen/include/public/domctl.h	Mon Sep 26 22:19:42 2011 +0100
@@ -35,7 +35,7 @@
 #include "xen.h"
 #include "grant_table.h"
 
-#define XEN_DOMCTL_INTERFACE_VERSION 0x00000007
+#define XEN_DOMCTL_INTERFACE_VERSION 0x00000008
 
 /*
  * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
@@ -95,6 +95,7 @@
     uint64_aligned_t tot_pages;
     uint64_aligned_t max_pages;
     uint64_aligned_t shr_pages;
+    uint64_aligned_t paged_pages;
     uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
     uint64_aligned_t cpu_time;
     uint32_t nr_online_vcpus;    /* Number of VCPUs currently online. */
diff -r fef59e4eaf8d -r 651aed73b39c xen/include/xen/sched.h
--- a/xen/include/xen/sched.h	Mon Sep 26 22:10:21 2011 +0100
+++ b/xen/include/xen/sched.h	Mon Sep 26 22:19:42 2011 +0100
@@ -208,6 +208,7 @@
     unsigned int     tot_pages;       /* number of pages currently possesed */
     unsigned int     max_pages;       /* maximum value for tot_pages        */
     atomic_t         shr_pages;       /* number of shared pages             */
+    atomic_t         paged_pages;     /* number of paged-out pages          */
     unsigned int     xenheap_pages;   /* # pages allocated from Xen heap    */
 
     unsigned int     max_vcpus;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:57:40 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:57:40 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jP2-0003y5-5Y; Tue, 27 Sep 2011 18:57:40 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMs-0003Bb-Q1
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:27 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-21.messagelabs.com!1317174907!51592579!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21012 invoked from network); 28 Sep 2011 01:55:08 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:08 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMp-0000gK-L5
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:23 +0100
Message-Id: <E1R8jMp-0000gK-L5@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:23 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] AMD-IOMMU: fix initialization order
	(after 23863:9e0259239822)
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1317136509 -3600
# Node ID ade44be5b9364b66d76ad9448d158c26444c4d61
# Parent  651aed73b39c4d1613e7b95c29953309b38f7cc2
AMD-IOMMU: fix initialization order (after 23863:9e0259239822)

That original patch caused alloc_ivrs_mappings() to be called too
early, so things get moved back to where they were, just converting
the single call there to a loop over all IOMMUs.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 651aed73b39c -r ade44be5b936 xen/drivers/passthrough/amd/iommu_detect.c
--- a/xen/drivers/passthrough/amd/iommu_detect.c	Mon Sep 26 22:19:42 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_detect.c	Tue Sep 27 16:15:09 2011 +0100
@@ -122,10 +122,6 @@
     spin_lock_init(&iommu->lock);
 
     iommu->seg = ivhd_block->pci_segment;
-    if (alloc_ivrs_mappings(ivhd_block->pci_segment)) {
-        xfree(iommu);
-        return -ENOMEM;
-    }
     iommu->bdf = ivhd_block->header.dev_id;
     iommu->cap_offset = ivhd_block->cap_offset;
     iommu->mmio_base_phys = ivhd_block->mmio_base;
diff -r 651aed73b39c -r ade44be5b936 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Mon Sep 26 22:19:42 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Tue Sep 27 16:15:09 2011 +0100
@@ -769,7 +769,7 @@
     return rc;
 }
 
-int __init alloc_ivrs_mappings(u16 seg)
+static int __init alloc_ivrs_mappings(u16 seg)
 {
     struct ivrs_mappings *ivrs_mappings;
     int bdf;
@@ -882,8 +882,9 @@
         goto error_out;
 
     radix_tree_init(&ivrs_maps);
-    if ( alloc_ivrs_mappings(0) != 0 )
-        goto error_out;
+    for_each_amd_iommu ( iommu )
+        if ( alloc_ivrs_mappings(iommu->seg) != 0 )
+            goto error_out;
 
     if ( amd_iommu_update_ivrs_mapping_acpi() != 0 )
         goto error_out;
diff -r 651aed73b39c -r ade44be5b936 xen/include/asm-x86/amd-iommu.h
--- a/xen/include/asm-x86/amd-iommu.h	Mon Sep 26 22:19:42 2011 +0100
+++ b/xen/include/asm-x86/amd-iommu.h	Tue Sep 27 16:15:09 2011 +0100
@@ -103,7 +103,6 @@
 
 extern unsigned short ivrs_bdf_entries;
 
-int alloc_ivrs_mappings(u16 seg);
 struct ivrs_mappings *get_ivrs_mappings(u16 seg);
 int iterate_ivrs_mappings(int (*)(u16 seg, struct ivrs_mappings *));
 int iterate_ivrs_entries(int (*)(u16 seg, struct ivrs_mappings *));

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:58:00 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:58:00 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jPL-00041x-Qh; Tue, 27 Sep 2011 18:57:59 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMt-0003Bl-Ng
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1317174924!19295114!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27302 invoked from network); 28 Sep 2011 01:55:24 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:24 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMq-0000h3-6S
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:24 +0100
Message-Id: <E1R8jMq-0000h3-6S@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:23 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: fixup "xl save" command line
	handling.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1317141136 -3600
# Node ID b113d626cfaf7c8faa7be9d528816ed944e59ba8
# Parent  ade44be5b9364b66d76ad9448d158c26444c4d61
xl: fixup "xl save" command line handling.

The save file paramter is required so ensure we have enough arguments.

The config filename is optional so do not use argv[optind+3], which
may well happen to be NULL when the paramter is not present but
relying on that is pretty gross.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r ade44be5b936 -r b113d626cfaf tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Sep 27 16:15:09 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Sep 27 17:32:16 2011 +0100
@@ -2856,8 +2856,8 @@
 
 int main_save(int argc, char **argv)
 {
-    const char *filename = NULL, *p = NULL;
-    const char *config_filename;
+    const char *filename, *p;
+    const char *config_filename = NULL;
     int checkpoint = 0;
     int opt;
 
@@ -2871,14 +2871,16 @@
         }
     }
 
-    if (argc-optind > 3) {
+    if (argc-optind < 2 || argc-optind > 3) {
         help("save");
         return 2;
     }
 
     p = argv[optind];
     filename = argv[optind + 1];
-    config_filename = argv[optind + 2];
+    if ( argc - optind >= 3 )
+        config_filename = argv[optind + 2];
+
     save_domain(p, filename, checkpoint, config_filename);
     return 0;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Tue Sep 27 18:58:14 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 27 Sep 2011 18:58:14 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R8jPY-00045i-Gu; Tue, 27 Sep 2011 18:58:13 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R8jMt-0003Bm-RH
	for xen-changelog@lists.xensource.com; Tue, 27 Sep 2011 18:55:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1317174924!19824247!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24505 invoked from network); 28 Sep 2011 01:55:24 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Sep 2011 01:55:24 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R8jMq-0000hq-OK
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 02:55:24 +0100
Message-Id: <E1R8jMq-0000hq-OK@xenbits.xen.org>
Date: Wed, 28 Sep 2011 02:55:24 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: make
	libxl__wait_for_device_model use libxl__spawn_starrting directly
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1317142991 -3600
# Node ID bfa65eb40b2a78c78491617af3897f0d86007046
# Parent  b113d626cfaf7c8faa7be9d528816ed944e59ba8
libxl: make libxl__wait_for_device_model use libxl__spawn_starrting directly

Instead of indirecting via libxl_device_model_starting. This fixes a
segmentation fault using stubdomains where starting->for_spawn is
(validly) NULL because starting a stubdom doesn't need to spawn a
process.

Most callers of libxl__wait_for_device_model already pass NULL for
this variable (because they are not on the starting path) so on
libxl__confirm_device_model_startup needs to change.

Reported-by: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r b113d626cfaf -r bfa65eb40b2a tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Sep 27 17:32:16 2011 +0100
+++ b/tools/libxl/libxl_device.c	Tue Sep 27 18:03:11 2011 +0100
@@ -522,7 +522,7 @@
 
 int libxl__wait_for_device_model(libxl__gc *gc,
                                  uint32_t domid, char *state,
-                                 libxl__device_model_starting *starting,
+                                 libxl__spawn_starting *spawning,
                                  int (*check_callback)(libxl__gc *gc,
                                                        uint32_t domid,
                                                        const char *state,
@@ -552,12 +552,12 @@
     tv.tv_sec = LIBXL_DEVICE_MODEL_START_TIMEOUT;
     tv.tv_usec = 0;
     nfds = xs_fileno(xsh) + 1;
-    if (starting && starting->for_spawn->fd > xs_fileno(xsh))
-        nfds = starting->for_spawn->fd + 1;
+    if (spawning && spawning->fd > xs_fileno(xsh))
+        nfds = spawning->fd + 1;
 
     while (rc > 0 || (!rc && tv.tv_sec > 0)) {
-        if ( starting ) {
-            rc = libxl__spawn_check(gc, starting->for_spawn);
+        if ( spawning ) {
+            rc = libxl__spawn_check(gc, spawning);
             if ( rc ) {
                 LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
                            "Device Model died during startup");
@@ -586,8 +586,8 @@
         free(p);
         FD_ZERO(&rfds);
         FD_SET(xs_fileno(xsh), &rfds);
-        if (starting)
-            FD_SET(starting->for_spawn->fd, &rfds);
+        if (spawning)
+            FD_SET(spawning->fd, &rfds);
         rc = select(nfds, &rfds, NULL, NULL, &tv);
         if (rc > 0) {
             if (FD_ISSET(xs_fileno(xsh), &rfds)) {
@@ -597,9 +597,9 @@
                 else
                     goto again;
             }
-            if (starting && FD_ISSET(starting->for_spawn->fd, &rfds)) {
+            if (spawning && FD_ISSET(spawning->fd, &rfds)) {
                 unsigned char dummy;
-                if (read(starting->for_spawn->fd, &dummy, sizeof(dummy)) != 1)
+                if (read(spawning->fd, &dummy, sizeof(dummy)) != 1)
                     LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_DEBUG,
                                      "failed to read spawn status pipe");
             }
diff -r b113d626cfaf -r bfa65eb40b2a tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Sep 27 17:32:16 2011 +0100
+++ b/tools/libxl/libxl_dm.c	Tue Sep 27 18:03:11 2011 +0100
@@ -920,7 +920,7 @@
 {
     int detach;
     int problem = libxl__wait_for_device_model(gc, starting->domid, "running",
-                                               starting, NULL, NULL);
+                                               starting->for_spawn, NULL, NULL);
     detach = detach_device_model(gc, starting);
     return problem ? problem : detach;
 }
diff -r b113d626cfaf -r bfa65eb40b2a tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Sep 27 17:32:16 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Tue Sep 27 18:03:11 2011 +0100
@@ -283,7 +283,7 @@
 _hidden int libxl__detach_device_model(libxl__gc *gc, libxl__device_model_starting *starting);
 _hidden int libxl__wait_for_device_model(libxl__gc *gc,
                                 uint32_t domid, char *state,
-                                libxl__device_model_starting *starting,
+                                libxl__spawn_starting *spawning,
                                 int (*check_callback)(libxl__gc *gc,
                                                       uint32_t domid,
                                                       const char *state,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 28 18:01:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 28 Sep 2011 18:01:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R94zz-0007F9-0d; Wed, 28 Sep 2011 18:01:15 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R94zA-0007DB-Ax
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 18:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-216.messagelabs.com!1317258021!19483290!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24026 invoked from network); 29 Sep 2011 01:00:21 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	29 Sep 2011 01:00:21 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R94z5-0002lM-VP
	for xen-changelog@lists.xensource.com; Thu, 29 Sep 2011 02:00:20 +0100
Message-Id: <E1R94z5-0002lM-VP@xenbits.xen.org>
Date: Thu, 29 Sep 2011 02:00:19 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: correct allocation size in
	libxl_list_nics
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1317224144 -3600
# Node ID 72e3391299e42e35400f21bf5d9d54137275b8a6
# Parent  8877da7ba3a43dc39870bd6defa8d195b87fbaa8
libxl: correct allocation size in libxl_list_nics

The function returns a list of libxl_nicinfo not libxl_device_nic.

Causes memory corruption on free.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8877da7ba3a4 -r 72e3391299e4 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Sep 28 16:34:00 2011 +0100
+++ b/tools/libxl/libxl.c	Wed Sep 28 16:35:44 2011 +0100
@@ -1296,7 +1296,7 @@
                            libxl__sprintf(&gc, "%s/device/vif", dompath), &nb_nics);
     if (!l)
         goto err;
-    nics = res = calloc(nb_nics, sizeof (libxl_device_nic));
+    nics = res = calloc(nb_nics, sizeof (libxl_nicinfo));
     if (!res)
         goto err;
     for (*nb = nb_nics; nb_nics > 0; --nb_nics, ++l, ++nics) {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 28 18:01:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 28 Sep 2011 18:01:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R950S-0007IL-GA; Wed, 28 Sep 2011 18:01:45 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R94z7-0007D5-5S
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 18:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1317258018!15165323!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13913 invoked from network); 29 Sep 2011 01:00:18 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	29 Sep 2011 01:00:18 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R94z3-0002jl-3I
	for xen-changelog@lists.xensource.com; Thu, 29 Sep 2011 02:00:17 +0100
Message-Id: <E1R94z3-0002jl-3I@xenbits.xen.org>
Date: Thu, 29 Sep 2011 02:00:16 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: correctly propagate errors
	from libxl_domain_destroy
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1317223951 -3600
# Node ID ba1afb9bc1597bec2c2c54113ce1e39241dcf86e
# Parent  8863be49d31905a81dcbe82071a29fece38c9dc9
libxl: correctly propagate errors from libxl_domain_destroy

currently it return success e.g. even if xc_domain_destroy fails.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 8863be49d319 -r ba1afb9bc159 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Sep 28 16:31:11 2011 +0100
+++ b/tools/libxl/libxl.c	Wed Sep 28 16:32:31 2011 +0100
@@ -785,7 +785,7 @@
     rc = 0;
 out:
     libxl__free_all(&gc);
-    return 0;
+    return rc;
 }
 
 int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_type type)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 28 18:02:23 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 28 Sep 2011 18:02:23 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9513-0007M4-El; Wed, 28 Sep 2011 18:02:22 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R94z5-0007D3-Mv
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 18:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1317258016!17823334!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6797 invoked from network); 29 Sep 2011 01:00:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	29 Sep 2011 01:00:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R94z0-0002hz-Ah
	for xen-changelog@lists.xensource.com; Thu, 29 Sep 2011 02:00:15 +0100
Message-Id: <E1R94z0-0002hz-Ah@xenbits.xen.org>
Date: Thu, 29 Sep 2011 02:00:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fail to parse disk vpath if a
	disk+part number needed but unavailable
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1317223871 -3600
# Node ID 8863be49d31905a81dcbe82071a29fece38c9dc9
# Parent  59c7213b5949e9a2401c60aa5c88726db66112fc
libxl: fail to parse disk vpath if a disk+part number needed but unavailable

libxl__device_disk_dev_number() can parse a virtpath which is an encoded
unsigned long but does not set *pdisk or *ppartition in that case.

Ideally we would parse the number but for now simply fail to prevent cascading
failures.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 59c7213b5949 -r 8863be49d319 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Sep 27 18:39:15 2011 +0100
+++ b/tools/libxl/libxl_device.c	Wed Sep 28 16:31:11 2011 +0100
@@ -341,8 +341,12 @@
 
     errno = 0;
     ul = strtoul(virtpath, &ep, 0);
-    if (!errno && !*ep && ul <= INT_MAX)
+    if (!errno && !*ep && ul <= INT_MAX) {
+        /* FIXME: should parse ul to determine these. */
+        if (pdisk || ppartition)
+            return -1;
         return ul;
+    }
 
     if (device_virtdisk_matches(virtpath, "hd",
                                 &disk, 3,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 28 18:02:42 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 28 Sep 2011 18:02:42 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R951O-0007PA-Ed; Wed, 28 Sep 2011 18:02:42 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R94zC-0007DG-BT
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 18:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-21.messagelabs.com!1317258021!35890814!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8119 invoked from network); 29 Sep 2011 01:00:21 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	29 Sep 2011 01:00:21 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R94z7-0002mL-S7
	for xen-changelog@lists.xensource.com; Thu, 29 Sep 2011 02:00:22 +0100
Message-Id: <E1R94z7-0002mL-S7@xenbits.xen.org>
Date: Thu, 29 Sep 2011 02:00:21 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: attempt to cleanup tapdisk
	processes on disk backend destroy.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1317224531 -3600
# Node ID 7998217630e236639825d4db174c852cfa18e709
# Parent  72e3391299e42e35400f21bf5d9d54137275b8a6
libxl: attempt to cleanup tapdisk processes on disk backend destroy.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 72e3391299e4 -r 7998217630e2 tools/blktap2/control/tap-ctl-list.c
--- a/tools/blktap2/control/tap-ctl-list.c	Wed Sep 28 16:35:44 2011 +0100
+++ b/tools/blktap2/control/tap-ctl-list.c	Wed Sep 28 16:42:11 2011 +0100
@@ -506,17 +506,15 @@
 }
 
 int
-tap_ctl_find_minor(const char *type, const char *path)
+tap_ctl_find(const char *type, const char *path, tap_list_t *tap)
 {
 	tap_list_t **list, **_entry;
-	int minor, err;
+	int ret = -ENOENT, err;
 
 	err = tap_ctl_list(&list);
 	if (err)
 		return err;
 
-	minor = -1;
-
 	for (_entry = list; *_entry != NULL; ++_entry) {
 		tap_list_t *entry  = *_entry;
 
@@ -526,11 +524,13 @@
 		if (path && (!entry->path || strcmp(entry->path, path)))
 			continue;
 
-		minor = entry->minor;
+		*tap = *entry;
+		tap->type = tap->path = NULL;
+		ret = 0;
 		break;
 	}
 
 	tap_ctl_free_list(list);
 
-	return minor >= 0 ? minor : -ENOENT;
+	return ret;
 }
diff -r 72e3391299e4 -r 7998217630e2 tools/blktap2/control/tap-ctl.h
--- a/tools/blktap2/control/tap-ctl.h	Wed Sep 28 16:35:44 2011 +0100
+++ b/tools/blktap2/control/tap-ctl.h	Wed Sep 28 16:42:11 2011 +0100
@@ -76,7 +76,7 @@
 
 int tap_ctl_list(tap_list_t ***list);
 void tap_ctl_free_list(tap_list_t **list);
-int tap_ctl_find_minor(const char *type, const char *path);
+int tap_ctl_find(const char *type, const char *path, tap_list_t *tap);
 
 int tap_ctl_allocate(int *minor, char **devname);
 int tap_ctl_free(const int minor);
diff -r 72e3391299e4 -r 7998217630e2 tools/libxl/libxl_blktap2.c
--- a/tools/libxl/libxl_blktap2.c	Wed Sep 28 16:35:44 2011 +0100
+++ b/tools/libxl/libxl_blktap2.c	Wed Sep 28 16:42:11 2011 +0100
@@ -18,6 +18,8 @@
 
 #include "tap-ctl.h"
 
+#include <string.h>
+
 int libxl__blktap_enabled(libxl__gc *gc)
 {
     const char *msg;
@@ -30,12 +32,13 @@
 {
     const char *type;
     char *params, *devname = NULL;
-    int minor, err;
+    tap_list_t tap;
+    int err;
 
     type = libxl__device_disk_string_of_format(format);
-    minor = tap_ctl_find_minor(type, disk);
-    if (minor >= 0) {
-        devname = libxl__sprintf(gc, "/dev/xen/blktap-2/tapdev%d", minor);
+    err = tap_ctl_find(type, disk, &tap);
+    if (err == 0) {
+        devname = libxl__sprintf(gc, "/dev/xen/blktap-2/tapdev%d", tap.minor);
         if (devname)
             return devname;
     }
@@ -49,3 +52,28 @@
 
     return NULL;
 }
+
+
+void libxl__device_destroy_tapdisk(libxl__gc *gc, char *be_path)
+{
+    char *path, *params, *type, *disk;
+    int err;
+    tap_list_t tap;
+
+    path = libxl__sprintf(gc, "%s/tapdisk-params", be_path);
+    if (!path) return;
+
+    params = libxl__xs_read(gc, XBT_NULL, path);
+    if (!params) return;
+
+    type = params;
+    disk = strchr(params, ':');
+    if (!disk) return;
+
+    *disk++ = '\0';
+
+    err = tap_ctl_find(type, disk, &tap);
+    if (err < 0) return;
+
+    tap_ctl_destroy(tap.id, tap.minor);
+}
diff -r 72e3391299e4 -r 7998217630e2 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Wed Sep 28 16:35:44 2011 +0100
+++ b/tools/libxl/libxl_device.c	Wed Sep 28 16:42:11 2011 +0100
@@ -376,6 +376,7 @@
     if (!state)
         goto out;
     if (atoi(state) != 4) {
+        libxl__device_destroy_tapdisk(gc, be_path);
         xs_rm(ctx->xsh, XBT_NULL, be_path);
         goto out;
     }
@@ -398,6 +399,7 @@
     } else {
         xs_rm(ctx->xsh, XBT_NULL, be_path);
     }
+    libxl__device_destroy_tapdisk(gc, be_path);
 out:
     return rc;
 }
diff -r 72e3391299e4 -r 7998217630e2 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Sep 28 16:35:44 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Sep 28 16:42:11 2011 +0100
@@ -363,6 +363,12 @@
                                     const char *disk,
                                     libxl_disk_format format);
 
+/* libxl__device_destroy_tapdisk:
+ *   Destroys any tapdisk process associated with the backend represented
+ *   by be_path.
+ */
+_hidden void libxl__device_destroy_tapdisk(libxl__gc *gc, char *be_path);
+
 _hidden char *libxl__uuid2string(libxl__gc *gc, const libxl_uuid uuid);
 
 struct libxl__xen_console_reader {
diff -r 72e3391299e4 -r 7998217630e2 tools/libxl/libxl_noblktap2.c
--- a/tools/libxl/libxl_noblktap2.c	Wed Sep 28 16:35:44 2011 +0100
+++ b/tools/libxl/libxl_noblktap2.c	Wed Sep 28 16:42:11 2011 +0100
@@ -27,3 +27,7 @@
 {
     return NULL;
 }
+
+void libxl__device_destroy_tapdisk(libxl__gc *gc, char *be_path)
+{
+}

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 28 18:03:05 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 28 Sep 2011 18:03:05 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R951k-0007SS-7n; Wed, 28 Sep 2011 18:03:04 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R94z5-0007D2-Mt
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 18:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1317257977!62009508!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14367 invoked from network); 29 Sep 2011 00:59:38 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	29 Sep 2011 00:59:38 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R94yz-0002hE-NA
	for xen-changelog@lists.xensource.com; Thu, 29 Sep 2011 02:00:13 +0100
Message-Id: <E1R94yz-0002hE-NA@xenbits.xen.org>
Date: Thu, 29 Sep 2011 02:00:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: do not try to redo incoming
	migration on reboot of migrated domain
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1317145155 -3600
# Node ID 59c7213b5949e9a2401c60aa5c88726db66112fc
# Parent  bfa65eb40b2a78c78491617af3897f0d86007046
libxl: do not try to redo incoming migration on reboot of migrated domain

After a migration, reboot was trying to receive another incoming
migration, instead of restarting the domain it already has.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: Andreas Olsowski <andreas.olsowski@leuphana.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r bfa65eb40b2a -r 59c7213b5949 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Sep 27 18:03:11 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Sep 27 18:39:15 2011 +0100
@@ -1516,6 +1516,11 @@
         ret = libxl_domain_create_restore(ctx, &d_config,
                                             cb, &child_console_pid,
                                             &domid, restore_fd);
+        /*
+         * On subsequent reboot etc we should create the domain, not
+         * restore/migrate-receive it again.
+         */
+        restore_file = NULL;
     }else{
         ret = libxl_domain_create_new(ctx, &d_config,
                                         cb, &child_console_pid, &domid);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Wed Sep 28 18:05:25 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 28 Sep 2011 18:05:25 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9540-0007tj-Ll; Wed, 28 Sep 2011 18:05:25 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R94z8-0007D6-Oa
	for xen-changelog@lists.xensource.com; Wed, 28 Sep 2011 18:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1317258019!33142572!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12271 invoked from network); 29 Sep 2011 01:00:19 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	29 Sep 2011 01:00:19 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R94z4-0002kh-Qw
	for xen-changelog@lists.xensource.com; Thu, 29 Sep 2011 02:00:19 +0100
Message-Id: <E1R94z4-0002kh-Qw@xenbits.xen.org>
Date: Thu, 29 Sep 2011 02:00:18 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: correct allocation size in
	libxl_list_vm
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1317224040 -3600
# Node ID 8877da7ba3a43dc39870bd6defa8d195b87fbaa8
# Parent  ba1afb9bc1597bec2c2c54113ce1e39241dcf86e
libxl: correct allocation size in libxl_list_vm

*ptr has type libxl_vminfo not libxl_domid, so correct calloc call.

This the second instance of this bug I've noticed recently, I did a
quick audit of other similar uses of sizeof(...) and all I spotted
were a couple of harmlessly reversed calloc arguments. It's a pretty
strong argument for "foo = ..alloc(sizeof(*foo))" rather than
"alloc(sizeof(foos_type))" though...

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r ba1afb9bc159 -r 8877da7ba3a4 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Sep 28 16:32:31 2011 +0100
+++ b/tools/libxl/libxl.c	Wed Sep 28 16:34:00 2011 +0100
@@ -449,7 +449,7 @@
     xc_domaininfo_t info[1024];
     int size = 1024;
 
-    ptr = calloc(size, sizeof(libxl_dominfo));
+    ptr = calloc(size, sizeof(libxl_vminfo));
     if (!ptr)
         return NULL;
 
diff -r ba1afb9bc159 -r 8877da7ba3a4 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Wed Sep 28 16:32:31 2011 +0100
+++ b/tools/libxl/libxl_dm.c	Wed Sep 28 16:34:00 2011 +0100
@@ -774,7 +774,7 @@
     libxl_domain_unpause(ctx, domid);
 
     if (starting_r) {
-        *starting_r = calloc(sizeof(libxl__device_model_starting), 1);
+        *starting_r = calloc(1, sizeof(libxl__device_model_starting));
         (*starting_r)->domid = info->domid;
         (*starting_r)->dom_path = libxl__xs_get_dompath(gc, info->domid);
         (*starting_r)->for_spawn = NULL;
@@ -851,11 +851,11 @@
 
     if (starting_r) {
         rc = ERROR_NOMEM;
-        *starting_r = calloc(sizeof(libxl__device_model_starting), 1);
+        *starting_r = calloc(1, sizeof(libxl__device_model_starting));
         if (!*starting_r)
             goto out_close;
         p = *starting_r;
-        p->for_spawn = calloc(sizeof(libxl__spawn_starting), 1);
+        p->for_spawn = calloc(1, sizeof(libxl__spawn_starting));
     } else {
         p = &buf_starting;
         p->for_spawn = NULL;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 15:44:22 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 15:44:22 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9loc-00060U-LR; Fri, 30 Sep 2011 15:44:22 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9loV-0005zQ-T8
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 15:44:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1317422625!57190721!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14407 invoked from network); 30 Sep 2011 22:43:46 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	30 Sep 2011 22:43:46 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9loS-0004Tp-EE
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 23:44:12 +0100
Message-Id: <E1R9loS-0004Tp-EE@xenbits.xen.org>
Date: Fri, 30 Sep 2011 23:44:11 +0100
From: Xen patchbot-3.4-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-3.4-testing] x86/HPET: bug fix
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keith Coleman <keith.coleman@n2servers.com>
# Date 1317422233 14400
# Node ID 6d780b6d41319890cbd4390d7427c9cb909a0ee1
# Parent  90a184da7b92039b6ee4642351fa898c64e92aa4
x86/HPET: bug fix

This patch fixes a bug where an unitialized lock lookedlock looked like
a locked lock. Now we always call spin_lock_init on the legacy variable.

Thanks for Andrew Coopers suggestion.

Xen-unstable changeset 23031:5263151fba9b contains the fix along with
many other cleanups.

Signed-off-by: Keith Coleman <keith.coleman@n2servers.com>
Signed-off-by: Jeff Bester <jeff.bester@n2servers.com>
Committed-by: Keith Coleman <keith.coleman@n2servers.com>
---


diff -r 90a184da7b92 -r 6d780b6d4131 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Tue Aug 30 03:05:09 2011 -0400
+++ b/xen/arch/x86/hpet.c	Fri Sep 30 18:37:13 2011 -0400
@@ -531,6 +531,8 @@
     u32 hpet_id, cfg;
     int i;
 
+    spin_lock_init(&legacy_hpet_event.lock);
+
     hpet_rate = hpet_setup();
     if ( hpet_rate == 0 )
         return;
@@ -596,7 +598,6 @@
     legacy_hpet_event.event_handler = handle_hpet_broadcast;
     legacy_hpet_event.idx = 0;
     legacy_hpet_event.flags = 0;
-    spin_lock_init(&legacy_hpet_event.lock);
 
     for_each_cpu(i)
         per_cpu(cpu_bc_channel, i) = &legacy_hpet_event;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 15:44:32 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 15:44:32 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9lol-00063W-V9; Fri, 30 Sep 2011 15:44:31 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9loW-0005zT-J6
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 15:44:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1317422653!12625058!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29094 invoked from network); 30 Sep 2011 22:44:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	30 Sep 2011 22:44:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9loT-0004UJ-BZ
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 23:44:13 +0100
Message-Id: <E1R9loT-0004UJ-BZ@xenbits.xen.org>
Date: Fri, 30 Sep 2011 23:44:12 +0100
From: Xen patchbot-3.4-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-3.4-testing] Update Xen version to 3.4.4-rc1
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keith Coleman <keith.coleman@n2servers.com>
# Date 1317422292 14400
# Node ID 79eaab9de39124d2f17cd4f5e8542a895281ea4f
# Parent  901a0c68af916b7c88264c17843ce0e9b23caca5
Update Xen version to 3.4.4-rc1
---


diff -r 901a0c68af91 -r 79eaab9de391 xen/Makefile
--- a/xen/Makefile	Fri Sep 30 18:37:42 2011 -0400
+++ b/xen/Makefile	Fri Sep 30 18:38:12 2011 -0400
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 3
 export XEN_SUBVERSION    = 4
-export XEN_EXTRAVERSION ?= .4-rc1-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-rc1$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 15:44:57 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 15:44:57 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9lpB-00066o-6z; Fri, 30 Sep 2011 15:44:57 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9loX-0005zW-UL
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 15:44:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1317422654!19232400!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24219 invoked from network); 30 Sep 2011 22:44:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	30 Sep 2011 22:44:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9loU-0004V2-JW
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 23:44:14 +0100
Message-Id: <E1R9loU-0004V2-JW@xenbits.xen.org>
Date: Fri, 30 Sep 2011 23:44:14 +0100
From: Xen patchbot-3.4-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-3.4-testing] Update Xen version to
	3.4.4-rc2-pre
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keith Coleman <keith.coleman@n2servers.com>
# Date 1317422550 14400
# Node ID 0e3b875fd5fb2842317e3c1ee7c3515943bccae3
# Parent  3af33208b73f61d6f5842f7c379ab95347f4e43e
Update Xen version to 3.4.4-rc2-pre
---


diff -r 3af33208b73f -r 0e3b875fd5fb xen/Makefile
--- a/xen/Makefile	Fri Sep 30 18:41:19 2011 -0400
+++ b/xen/Makefile	Fri Sep 30 18:42:30 2011 -0400
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 3
 export XEN_SUBVERSION    = 4
-export XEN_EXTRAVERSION ?= .4-rc1$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-rc2-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 15:45:05 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 15:45:05 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9lpJ-0006AI-Bd; Fri, 30 Sep 2011 15:45:05 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9loW-0005zU-RF
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 15:44:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1317422628!39903188!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25119 invoked from network); 30 Sep 2011 22:43:48 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	30 Sep 2011 22:43:48 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9loT-0004UY-Oy
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 23:44:13 +0100
Message-Id: <E1R9loT-0004UY-Oy@xenbits.xen.org>
Date: Fri, 30 Sep 2011 23:44:13 +0100
From: Xen patchbot-3.4-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-3.4-testing] Added tag 3.4.4-rc1 for changeset
	79eaab9de391
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keith Coleman <keith.coleman@n2servers.com>
# Date 1317422381 14400
# Node ID 37744217e9864d84b6ed39dff38df3a857da5347
# Parent  79eaab9de39124d2f17cd4f5e8542a895281ea4f
Added tag 3.4.4-rc1 for changeset 79eaab9de391
---


diff -r 79eaab9de391 -r 37744217e986 .hgtags
--- a/.hgtags	Fri Sep 30 18:38:12 2011 -0400
+++ b/.hgtags	Fri Sep 30 18:39:41 2011 -0400
@@ -61,3 +61,4 @@
 4c263bf4ca196e03d2798593d932f079f461f3ba 3.4.3-rc6
 e6b740903b001c0c38892cfa5fc40139881095e0 3.4.3-rc7
 635c48b8e646319c6c01767df5ac75e907285ac6 RELEASE-3.4.3
+79eaab9de39124d2f17cd4f5e8542a895281ea4f 3.4.4-rc1

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 15:45:15 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 15:45:15 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9lpT-0006E4-93; Fri, 30 Sep 2011 15:45:15 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9loX-0005zV-A4
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 15:44:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1317422654!18930252!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27163 invoked from network); 30 Sep 2011 22:44:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	30 Sep 2011 22:44:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9loU-0004Un-62
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 23:44:14 +0100
Message-Id: <E1R9loU-0004Un-62@xenbits.xen.org>
Date: Fri, 30 Sep 2011 23:44:13 +0100
From: Xen patchbot-3.4-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-3.4-testing] Added signature for changeset
	79eaab9de391
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keith Coleman <keith.coleman@n2servers.com>
# Date 1317422479 14400
# Node ID 3af33208b73f61d6f5842f7c379ab95347f4e43e
# Parent  37744217e9864d84b6ed39dff38df3a857da5347
Added signature for changeset 79eaab9de391
---


diff -r 37744217e986 -r 3af33208b73f .hgsigs
--- a/.hgsigs	Fri Sep 30 18:39:41 2011 -0400
+++ b/.hgsigs	Fri Sep 30 18:41:19 2011 -0400
@@ -3,3 +3,4 @@
 4c263bf4ca196e03d2798593d932f079f461f3ba 0 iQEcBAABAgAGBQJL4AuhAAoJEIP+FMlX6CvZf8sIAIv627lxYL7J03sZGOo+NnjS+Y723McYndSqBtSo3NYrYSpXJoduewNvpd+depgSnrrms9g0VkhOmlO4zremLyyy/AKaMxiBXvDn22sI07rSUZ5+JQTe0YfPxt4Su6T9KEuXthtEeHFghElGifryhj2PsY6mIluftiwJhneYh2vxtqEuH5e4fBaFjfGa/pksDUBYcQpSz8pZ2Ub1JML82EYxR6+Key+eki1pQMAqcx8PeNiNP+j6Yade6pb3V/p76ex7tqj/AtnTOjOiHi9hBSShf5HFzofua/Lh3Mom723y6+f1Eowxb7dRw1e8OQvQhYuN1bLNw1lahygmBEa/t5s=
 e6b740903b001c0c38892cfa5fc40139881095e0 0 iQEcBAABAgAGBQJL93c3AAoJEIP+FMlX6CvZ2XAH/RKXDXigSKnh14Ocne+JUkPiQBLgH2S32fn+4zWym4e0ir8Ld+o3YV6Y+20yr2S+ugUw0LX0Id3lLQd6mbcwplnttSolRzdsJwv7ZWlppaLj+oerV6oAIHvIMW+x4VM++nDo3AvEHoA76gGk51IZYxoXo6rlSPG9g939aecC+jILQ+O0h78jUFOxfJ9IOSw5ynod/5V+qsRodjIkjUdbAdtZaVpro7iv9p2/PKH0ASolwkj1JWbPehIbGHfaWYKTg2VxR+Dt27qQPhq77KtJAgTnW3KAZnFLBicOBGz2tsXH9KAJ0g2CU3aC0bws3Jb+SegLsOUhc71t+OlweMKC4/c=
 635c48b8e646319c6c01767df5ac75e907285ac6 0 iQEcBAABAgAGBQJL/2snAAoJEIP+FMlX6CvZoqAH/3HL5W+Iq/UrabhbDMAy6+XzuHVIZaJ+CxHFNuli4REV8xcRLg6kLkRrcHdsFWkcUheFuyh+8wRzCkAiCui1BtdWy/Aad7oDK3R0ox5IcAM4oscZqewfHnJcpn7CFBEmp9/eOerZkqu7oCGspvw4Nj/26Tp3yE5S6zYcNtactFhSWplypjybAwF0Xos9pMik/KNYmSqU0b/0AlHTmiY7R0clnPrb8G9/PgttcU17kTR30+1RpyNOTRtx0IGDYLXDl8HZavbV5JbvYppk4E+93YfUjmlB+1D6er45GKLN3oOkaivEyxVYIY1nlCK6kI69od1ZkzdrvTzFM6RQDxzq3do=
+79eaab9de39124d2f17cd4f5e8542a895281ea4f 0 iQIcBAABAgAGBQJOhkWFAAoJEHs3akJKJvCcMsYP/RrHcgTqPQ2KcToamxKFy0iuiFDhUZ/4Hdyw8eEcUMsls8iHLoCR0W8q3NfxN5AffZ5iWbw4oZUXlt5KxLe3u2WvvvjOWlk4YS3H4eY0nD3IDixrT44YE+/Ga5L4a1K95cpuGCTCIHwfHhJ1Et4xMJx3DsBLIytQyrHLq7DA8IulY5wjwKMLwrJoH9QTKIHZ6zz92fHjHzlb10mXzg3Bb9wPSslGuaAPDPGdBrFJHcIe/ItAug/h+Sl8x9ig8mm4ji/jPo2FRnnwzIUt/u46XFEUS4UkEMivqzlYsB/zf3IkOD6Ldg+QuT+WdEin49KCsa7h8NbHmLSiyNPkHc+9CpgV92M81+XiYSat32b72kJMrU35JzAEV+iJyvtz8oWOW1iapbDXRyjMh0hoMUPESwm8SDvk8EFBI72dOhkVchkDkiKCCU3mpSWVBEr6YQ4bxNGxdiJnBucbxMTGR4njE/A2jneAbfWzlJftoY1Byn5ql+rITAKIHjGB7bnf5KCIiYqNkrwO3cNAGZa+t+SZV6qdkyVzSwsHurYt5J+wbiDML6fjnDsvPJa9pbmZKyLppFImxtsTyZsm/ftZ+fQLK0IqsS9f5TW3YnP4SnGp573hFVe1FG3P/AAqY0lpbuR0WaKs7374sS7wNg42uYa8sE6JWquFMvNg4zQSNyQwdL4h

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 15:45:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 15:45:24 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9lpb-0006He-Nt; Fri, 30 Sep 2011 15:45:23 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9loW-0005zS-GK
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 15:44:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1317422653!27378075!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6335 invoked from network); 30 Sep 2011 22:44:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	30 Sep 2011 22:44:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9loS-0004U4-UQ
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 23:44:12 +0100
Message-Id: <E1R9loS-0004U4-UQ@xenbits.xen.org>
Date: Fri, 30 Sep 2011 23:44:12 +0100
From: Xen patchbot-3.4-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-3.4-testing] Passthrough: disable
	bus-mastering on any card that causes an IOMMU
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keith Coleman <keith.coleman@n2servers.com>
# Date 1317422262 14400
# Node ID 901a0c68af916b7c88264c17843ce0e9b23caca5
# Parent  6d780b6d41319890cbd4390d7427c9cb909a0ee1
Passthrough: disable bus-mastering on any card that causes an IOMMU
fault.

This stops the card from raising back-to-back faults and live-locking
the CPU that handles them.

Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Wei Wang2 <wei.wang2@amd.com>
Acked-by: Allen M Kay <allen.m.kay@intel.com>
xen-unstable changeset: 23762:537ed3b74b3f
xen-unstable date: Fri Aug 12 11:29:24 2011 +0100
Committed-by: Keith Coleman <keith.coleman@n2servers.com>
---


diff -r 6d780b6d4131 -r 901a0c68af91 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Fri Sep 30 18:37:13 2011 -0400
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Fri Sep 30 18:37:42 2011 -0400
@@ -453,7 +453,7 @@
 
 static void parse_event_log_entry(u32 entry[])
 {
-    u16 domain_id, device_id;
+    u16 domain_id, device_id, bdf, cword;
     u32 code;
     u64 *addr;
     char * event_str[] = {"ILLEGAL_DEV_TABLE_ENTRY",
@@ -487,6 +487,20 @@
         printk(XENLOG_ERR "AMD-Vi: "
             "%s: domain:%d, device id:0x%04x, fault address:0x%016"PRIx64"\n",
             event_str[code-1], domain_id, device_id, *addr);
+
+        /* Tell the device to stop DMAing; we can't rely on the guest to
+         * control it for us. */
+        for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
+        {
+            if ( get_dma_requestor_id(bdf) == device_id ) 
+            {
+                cword = pci_conf_read16(PCI_BUS(bdf), PCI_SLOT(bdf), 
+                                PCI_FUNC(bdf), PCI_COMMAND);
+                pci_conf_write16(PCI_BUS(bdf), PCI_SLOT(bdf), 
+                                 PCI_FUNC(bdf), PCI_COMMAND, 
+                                 cword & ~PCI_COMMAND_MASTER);
+            }
+        }
     }
 }
 
diff -r 6d780b6d4131 -r 901a0c68af91 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Fri Sep 30 18:37:13 2011 -0400
+++ b/xen/drivers/passthrough/vtd/iommu.c	Fri Sep 30 18:37:42 2011 -0400
@@ -737,7 +737,7 @@
     while (1)
     {
         u8 fault_reason;
-        u16 source_id;
+        u16 source_id, cword;
         u32 data;
         u64 guest_addr;
         int type;
@@ -770,6 +770,14 @@
         iommu_page_fault_do_one(iommu, type, fault_reason,
                                 source_id, guest_addr);
 
+        /* Tell the device to stop DMAing; we can't rely on the guest to
+         * control it for us. */
+        cword = pci_conf_read16(PCI_BUS(source_id), PCI_SLOT(source_id), 
+                                PCI_FUNC(source_id), PCI_COMMAND);
+        pci_conf_write16(PCI_BUS(source_id), PCI_SLOT(source_id), 
+                         PCI_FUNC(source_id), PCI_COMMAND, 
+                         cword & ~PCI_COMMAND_MASTER);
+
         fault_index++;
         if ( fault_index > cap_num_fault_regs(iommu->cap) )
             fault_index = 0;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:33:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:33:21 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pOD-0005Mc-Mb; Fri, 30 Sep 2011 19:33:21 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pO6-0005Kz-5u
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1317436374!44669818!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27824 invoked from network); 1 Oct 2011 02:32:54 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:32:54 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO2-0001Aw-TG
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:10 +0100
Message-Id: <E1R9pO2-0001Aw-TG@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Expose number of shared pages
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Adin Scannell <adin@gridcentric.com>
# Date 1317306364 -3600
# Node ID 145e146876b33d783e18a8ac5ebb8180f40d1720
# Parent  7998217630e236639825d4db174c852cfa18e709
libxl: Expose number of shared pages

Signed-off-by: Adin Scannell <adin@scannell.ca>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 7998217630e2 -r 145e146876b3 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Wed Sep 28 16:42:11 2011 +0100
+++ b/tools/libxl/libxl.c	Thu Sep 29 15:26:04 2011 +0100
@@ -355,6 +355,7 @@
         xlinfo->shutdown_reason  = ~0;
 
     xlinfo->current_memkb = PAGE_TO_MEMKB(xcinfo->tot_pages);
+    xlinfo->shared_memkb = PAGE_TO_MEMKB(xcinfo->shr_pages);
     xlinfo->max_memkb = PAGE_TO_MEMKB(xcinfo->max_pages);
     xlinfo->cpu_time = xcinfo->cpu_time;
     xlinfo->vcpu_max_id = xcinfo->max_vcpu_id;
diff -r 7998217630e2 -r 145e146876b3 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl	Wed Sep 28 16:42:11 2011 +0100
+++ b/tools/libxl/libxl.idl	Thu Sep 29 15:26:04 2011 +0100
@@ -102,6 +102,7 @@
 Otherwise set to a value guaranteed not to clash with any valid
 SHUTDOWN_* constant."""),
     ("current_memkb",   uint64),
+    ("shared_memkb", uint64),
     ("max_memkb",   uint64),
     ("cpu_time",    uint64),
     ("vcpu_max_id", uint32),

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:33:30 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:33:30 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pOM-0005Q5-81; Fri, 30 Sep 2011 19:33:30 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pO6-0005L3-MD
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1317436356!50219920!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5817 invoked from network); 1 Oct 2011 02:32:36 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:32:36 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO3-0001Bx-He
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:11 +0100
Message-Id: <E1R9pO3-0001Bx-He@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: fixup command line handling for
	several commands.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1317307234 -3600
# Node ID cd60c87d34963bcbd7e5ea6450a8afae3ffbc757
# Parent  145e146876b33d783e18a8ac5ebb8180f40d1720
xl: fixup command line handling for several commands.

def_getopt already checks for a minimum number of arguments for us.

"xl save" simply need to use the correct argument for that value,
contrary to the change I made in 23876:b113d626cfaf

"xl block-list" does not need to check for at least 2 arguments, since
it's already been done by def_getopt.

"xl network-list" would previous accept zero arguments and just print
the table header. Insist on a domain argument.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 145e146876b3 -r cd60c87d3496 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Sep 29 15:26:04 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Thu Sep 29 15:40:34 2011 +0100
@@ -2866,7 +2866,7 @@
     int checkpoint = 0;
     int opt;
 
-    while ((opt = def_getopt(argc, argv, "c", "save", 1)) != -1) {
+    while ((opt = def_getopt(argc, argv, "c", "save", 2)) != -1) {
         switch (opt) {
         case 0: case 2:
             return opt;
@@ -2876,7 +2876,7 @@
         }
     }
 
-    if (argc-optind < 2 || argc-optind > 3) {
+    if (argc-optind > 3) {
         help("save");
         return 2;
     }
@@ -4025,7 +4025,7 @@
     libxl_nicinfo *nics;
     unsigned int nb, i;
 
-    if ((opt = def_getopt(argc, argv, "", "network-list", 0)) != -1)
+    if ((opt = def_getopt(argc, argv, "", "network-list", 1)) != -1)
         return opt;
 
     /*      Idx  BE   MAC   Hdl  Sta  evch txr/rxr  BE-path */
@@ -4096,10 +4096,6 @@
 
     if ((opt = def_getopt(argc, argv, "", "block-attach", 2)) != -1)
         return opt;
-    if ((argc-optind < 2)) {
-        help("block-attach");
-        return 2;
-    }
 
     if (domain_qualifier_to_domid(argv[optind], &fe_domid, 0) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:33:39 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:33:39 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pOU-0005T3-Rv; Fri, 30 Sep 2011 19:33:39 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pO7-0005L4-3R
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1317436392!10440224!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24280 invoked from network); 1 Oct 2011 02:33:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:33:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO4-0001Cd-2a
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:12 +0100
Message-Id: <E1R9pO4-0001Cd-2a@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Introduce
	libxl__fd_set_cloexec
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1317308762 -3600
# Node ID cf2ba5720151ac950ed9312bebef2741e9429e86
# Parent  cd60c87d34963bcbd7e5ea6450a8afae3ffbc757
libxl: Introduce libxl__fd_set_cloexec

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r cd60c87d3496 -r cf2ba5720151 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Thu Sep 29 15:40:34 2011 +0100
+++ b/tools/libxl/libxl_internal.c	Thu Sep 29 16:06:02 2011 +0100
@@ -242,3 +242,16 @@
 
 	return ERROR_FAIL;
 }
+
+int libxl__fd_set_cloexec(int fd)
+{
+    int flags = 0;
+
+    if ((flags = fcntl(fd, F_GETFD)) == -1) {
+        flags = 0;
+    }
+    if ((flags & FD_CLOEXEC)) {
+        return 0;
+    }
+    return fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
+}
diff -r cd60c87d3496 -r cf2ba5720151 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Sep 29 15:40:34 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Thu Sep 29 16:06:02 2011 +0100
@@ -384,6 +384,7 @@
 
 _hidden int libxl__file_reference_map(libxl_file_reference *f);
 _hidden int libxl__file_reference_unmap(libxl_file_reference *f);
+_hidden int libxl__fd_set_cloexec(int fd);
 
 _hidden int libxl__e820_alloc(libxl_ctx *ctx, uint32_t domid, libxl_domain_config *d_config);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:33:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:33:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pOc-0005W4-31; Fri, 30 Sep 2011 19:33:46 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pO8-0005LG-Fn
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1317436393!31299102!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26596 invoked from network); 1 Oct 2011 02:33:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:33:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO5-0001Dy-7b
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:13 +0100
Message-Id: <E1R9pO5-0001Dy-7b@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Add get/set_default_namespace
	in libxltypes.py.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1317310101 -3600
# Node ID f5ee5ad45425ec82b97cac7ff7fd4a34f424aa9d
# Parent  a543e10211f72d568e4bfac23eeee45b595b7753
libxl: Add get/set_default_namespace in libxltypes.py.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r a543e10211f7 -r f5ee5ad45425 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Thu Sep 29 16:28:20 2011 +0100
+++ b/tools/libxl/libxl_types.idl	Thu Sep 29 16:28:21 2011 +0100
@@ -3,6 +3,8 @@
 # Builtin libxl types
 #
 
+namespace("libxl_")
+
 libxl_domid = Builtin("domid")
 libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
 libxl_mac = Builtin("mac", passby=PASS_BY_REFERENCE)
diff -r a543e10211f7 -r f5ee5ad45425 tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py	Thu Sep 29 16:28:20 2011 +0100
+++ b/tools/libxl/libxltypes.py	Thu Sep 29 16:28:21 2011 +0100
@@ -8,10 +8,23 @@
 DIR_OUT  = 2
 DIR_BOTH = 3
 
+_default_namespace = ""
+def namespace(s):
+    if type(s) != str:
+        raise TypeError, "Require a string for the default namespace."
+    global _default_namespace
+    _default_namespace = s
+
+def _get_default_namespace():
+    global _default_namespace
+    return _default_namespace
+
+
 class Type(object):
     def __init__(self, typename, **kwargs):
         self.comment = kwargs.setdefault('comment', None)
-        self.namespace = kwargs.setdefault('namespace', "libxl_")
+        self.namespace = kwargs.setdefault('namespace',
+                _get_default_namespace())
         self.dir = kwargs.setdefault('dir', DIR_BOTH)
         if self.dir not in [DIR_NONE, DIR_IN, DIR_OUT, DIR_BOTH]:
             raise ValueError
@@ -256,7 +269,8 @@
         elif isinstance(t,type(object)) and issubclass(t, Type):
             globs[n] = t
         elif n in ['PASS_BY_REFERENCE', 'PASS_BY_VALUE',
-                   'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH']:
+                   'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH',
+                   'namespace']:
             globs[n] = t
 
     try:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:33:57 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:33:57 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pOm-0005Zo-W2; Fri, 30 Sep 2011 19:33:57 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pO8-0005LH-OX
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1317436282!38349269!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25742 invoked from network); 1 Oct 2011 02:31:22 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:31:22 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO5-0001Ed-On
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:13 +0100
Message-Id: <E1R9pO5-0001Ed-On@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Introduce
	libxl_internal_types.idl.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1317310102 -3600
# Node ID f51dcd8acb7b950c870d23d250f56ad542997ae9
# Parent  f5ee5ad45425ec82b97cac7ff7fd4a34f424aa9d
libxl: Introduce libxl_internal_types.idl.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r f5ee5ad45425 -r f51dcd8acb7b tools/libxl/Makefile
--- a/tools/libxl/Makefile	Thu Sep 29 16:28:21 2011 +0100
+++ b/tools/libxl/Makefile	Thu Sep 29 16:28:22 2011 +0100
@@ -35,7 +35,7 @@
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
 			libxl_internal.o libxl_utils.o libxl_uuid.o $(LIBXL_OBJS-y)
-LIBXL_OBJS += _libxl_types.o libxl_flask.o
+LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
 
@@ -81,8 +81,10 @@
 libxl_paths.c: _libxl_paths.h
 
 libxl.h: _libxl_types.h
+libxl_internal.h: _libxl_types_internal.h
 
 $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
+$(LIBXL_OBJS): libxl_internal.h
 
 _libxl_type%.h _libxl_type%.c: libxl_type%.idl gentypes.py libxltypes.py
 	$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*.c
diff -r f5ee5ad45425 -r f51dcd8acb7b tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py	Thu Sep 29 16:28:21 2011 +0100
+++ b/tools/libxl/gentypes.py	Thu Sep 29 16:28:22 2011 +0100
@@ -150,8 +150,9 @@
 
     f = open(header, "w")
 
-    f.write("""#ifndef __LIBXL_TYPES_H
-#define __LIBXL_TYPES_H
+    header_define = header.upper().replace('.','_')
+    f.write("""#ifndef %s
+#define %s
 
 /*
  * DO NOT EDIT.
@@ -160,7 +161,7 @@
  * "%s"
  */
 
-""" % " ".join(sys.argv))
+""" % (header_define, header_define, " ".join(sys.argv)))
 
     for ty in types:
         f.write(libxl_C_type_define(ty) + ";\n")
@@ -172,7 +173,7 @@
             f.write("extern libxl_enum_string_table %s_string_table[];\n" % (ty.typename))
         f.write("\n")
 
-    f.write("""#endif /* __LIBXL_TYPES_H */\n""")
+    f.write("""#endif /* %s */\n""" % (header_define))
     f.close()
 
     print "outputting libxl type implementations to %s" % impl
diff -r f5ee5ad45425 -r f51dcd8acb7b tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Sep 29 16:28:21 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Thu Sep 29 16:28:22 2011 +0100
@@ -35,6 +35,7 @@
 
 #include "flexarray.h"
 #include "libxl_utils.h"
+#include "_libxl_types_internal.h"
 
 #define LIBXL_DESTROY_TIMEOUT 10
 #define LIBXL_DEVICE_MODEL_START_TIMEOUT 10
diff -r f5ee5ad45425 -r f51dcd8acb7b tools/libxl/libxl_types_internal.idl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_types_internal.idl	Thu Sep 29 16:28:22 2011 +0100
@@ -0,0 +1,9 @@
+namespace("libxl__")
+
+libxl__qmp_message_type  = Enumeration("qmp_message_type", [
+    (1, "QMP"),
+    (2, "return"),
+    (3, "error"),
+    (4, "event"),
+    (5, "invalid"),
+    ])

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:34:05 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:34:05 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pOu-0005dH-B8; Fri, 30 Sep 2011 19:34:05 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pO8-0005LE-4b
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1317436392!27407439!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32338 invoked from network); 1 Oct 2011 02:33:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:33:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO4-0001DJ-Lp
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:12 +0100
Message-Id: <E1R9pO4-0001DJ-Lp@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Rename libxl.idl to
	libxl_types.idl.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1317310100 -3600
# Node ID a543e10211f72d568e4bfac23eeee45b595b7753
# Parent  cf2ba5720151ac950ed9312bebef2741e9429e86
libxl: Rename libxl.idl to libxl_types.idl.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r cf2ba5720151 -r a543e10211f7 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Thu Sep 29 16:06:02 2011 +0100
+++ b/tools/libxl/Makefile	Thu Sep 29 16:28:20 2011 +0100
@@ -52,8 +52,8 @@
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 
 testidl.o: CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenlight)
-testidl.c: libxl.idl gentest.py libxl.h
-	$(PYTHON) gentest.py libxl.idl testidl.c.new
+testidl.c: libxl_types.idl gentest.py libxl.h
+	$(PYTHON) gentest.py libxl_types.idl testidl.c.new
 	mv testidl.c.new testidl.c
 
 .PHONY: all
@@ -84,10 +84,10 @@
 
 $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
 
-_libxl_%.h _libxl_%.c: libxl.idl gen%.py libxl%.py
-	$(PYTHON) gen$*.py libxl.idl __libxl_$*.h __libxl_$*.c
-	$(call move-if-changed,__libxl_$*.h,_libxl_$*.h)
-	$(call move-if-changed,__libxl_$*.c,_libxl_$*.c)
+_libxl_type%.h _libxl_type%.c: libxl_type%.idl gentypes.py libxltypes.py
+	$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*.c
+	$(call move-if-changed,__libxl_type$*.h,_libxl_type$*.h)
+	$(call move-if-changed,__libxl_type$*.c,_libxl_type$*.c)
 
 libxenlight.so: libxenlight.so.$(MAJOR)
 	ln -sf $< $@
diff -r cf2ba5720151 -r a543e10211f7 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl	Thu Sep 29 16:06:02 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,374 +0,0 @@
-# -*- python -*-
-#
-# Builtin libxl types
-#
-
-libxl_domid = Builtin("domid")
-libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
-libxl_mac = Builtin("mac", passby=PASS_BY_REFERENCE)
-libxl_cpumap = Builtin("cpumap", destructor_fn="libxl_cpumap_destroy", passby=PASS_BY_REFERENCE)
-libxl_cpuarray = Builtin("cpuarray", destructor_fn="libxl_cpuarray_destroy", passby=PASS_BY_REFERENCE)
-libxl_cpuid_policy_list = Builtin("cpuid_policy_list", destructor_fn="libxl_cpuid_destroy", passby=PASS_BY_REFERENCE)
-
-libxl_string_list = Builtin("string_list", destructor_fn="libxl_string_list_destroy", passby=PASS_BY_REFERENCE)
-libxl_key_value_list = Builtin("key_value_list", destructor_fn="libxl_key_value_list_destroy", passby=PASS_BY_REFERENCE)
-libxl_file_reference = Builtin("file_reference", destructor_fn="libxl_file_reference_destroy", passby=PASS_BY_REFERENCE)
-
-libxl_hwcap = Builtin("hwcap")
-
-#
-# Constants / Enumerations
-#
-
-libxl_domain_type = Enumeration("domain_type", [
-    (1, "HVM"),
-    (2, "PV"),
-    ])
-
-libxl_device_model_version = Enumeration("device_model_version", [
-    (1, "QEMU_XEN_TRADITIONAL", "Historical qemu-xen device model (qemu-dm)"),
-    (2, "QEMU_XEN", "Upstream based qemu-xen device model"),
-    ])
-
-libxl_console_type = Enumeration("console_type", [
-    (1, "SERIAL"),
-    (2, "PV"),
-    ])
-
-libxl_console_backend = Enumeration("console_backend", [
-    (1, "XENCONSOLED"),
-    (2, "IOEMU"),
-    ])
-
-libxl_disk_format = Enumeration("disk_format", [
-    (0, "UNKNOWN"),
-    (1, "QCOW"),
-    (2, "QCOW2"),
-    (3, "VHD"),
-    (4, "RAW"),
-    (5, "EMPTY"),
-    ])
-
-libxl_disk_backend = Enumeration("disk_backend", [
-    (0, "UNKNOWN"),
-    (1, "PHY"),
-    (2, "TAP"),
-    (3, "QDISK"),
-    ])
-
-libxl_nic_type = Enumeration("nic_type", [
-    (1, "IOEMU"),
-    (2, "VIF"),
-    ])
-
-libxl_action_on_shutdown = Enumeration("action_on_shutdown", [
-    (1, "DESTROY"),
-
-    (2, "RESTART"),
-    (3, "RESTART_RENAME"),
-
-    (4, "PRESERVE"),
-
-    (5, "COREDUMP_DESTROY"),
-    (6, "COREDUMP_RESTART"),
-    ])
-
-libxl_event_type = Enumeration("event_type", [
-    (1, "DOMAIN_DEATH"),
-    (2, "DISK_EJECT"),
-    ])
-
-libxl_button = Enumeration("button", [
-    (1, "POWER"),
-    (2, "SLEEP"),
-    ])
-
-#
-# Complex libxl types
-#
-libxl_dominfo = Struct("dominfo",[
-    ("uuid",        libxl_uuid),
-    ("domid",       libxl_domid),
-    ("ssidref",      uint32),
-    ("running",     bool),
-    ("blocked",     bool),
-    ("paused",      bool),
-    ("shutdown",    bool),
-    ("dying",       bool),
-
-    ("shutdown_reason", uint8, False,
-"""Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
-
-Otherwise set to a value guaranteed not to clash with any valid
-SHUTDOWN_* constant."""),
-    ("current_memkb",   uint64),
-    ("shared_memkb", uint64),
-    ("max_memkb",   uint64),
-    ("cpu_time",    uint64),
-    ("vcpu_max_id", uint32),
-    ("vcpu_online", uint32),
-    ], destructor_fn=None)
-
-libxl_cpupoolinfo = Struct("cpupoolinfo", [
-    ("poolid",      uint32),
-    ("sched_id",    uint32),
-    ("n_dom",       uint32),
-    ("cpumap",      libxl_cpumap)
-    ])
-
-libxl_vminfo = Struct("vminfo", [
-    ("uuid", libxl_uuid),
-    ("domid", libxl_domid),
-    ], destructor_fn=None)
-
-libxl_version_info = Struct("version_info", [
-    ("xen_version_major", integer),
-    ("xen_version_minor", integer),
-    ("xen_version_extra", string),
-    ("compiler",          string),
-    ("compile_by",        string),
-    ("compile_domain",    string),
-    ("compile_date",      string),
-    ("capabilities",      string),
-    ("changeset",         string),
-    ("virt_start",        uint64),
-    ("pagesize",          integer),
-    ("commandline",       string),
-    ])
-
-libxl_domain_create_info = Struct("domain_create_info",[
-    ("type",         libxl_domain_type),
-    ("hap",          bool),
-    ("oos",          bool),
-    ("ssidref",      uint32),
-    ("name",         string),
-    ("uuid",         libxl_uuid),
-    ("xsdata",       libxl_key_value_list),
-    ("platformdata", libxl_key_value_list),
-    ("poolid",       uint32),
-    ("poolname",     string),
-    ])
-
-libxl_domain_build_info = Struct("domain_build_info",[
-    ("max_vcpus",       integer),
-    ("cur_vcpus",       integer),
-    ("tsc_mode",        integer),
-    ("max_memkb",       uint32),
-    ("target_memkb",    uint32),
-    ("video_memkb",     uint32),
-    ("shadow_memkb",    uint32),
-    ("disable_migrate", bool),
-    ("cpuid",           libxl_cpuid_policy_list),
-    ("type",            libxl_domain_type),
-    ("u", KeyedUnion(None, libxl_domain_type, "type",
-                [("hvm", Struct(None, [("firmware", string),
-                                       ("pae", bool),
-                                       ("apic", bool),
-                                       ("acpi", bool),
-                                       ("nx", bool),
-                                       ("viridian", bool),
-                                       ("timeoffset", string),
-                                       ("hpet", bool),
-                                       ("vpt_align", bool),
-                                       ("timer_mode", integer),
-                                       ("nested_hvm", bool),
-                                       ])),
-                 ("pv", Struct(None, [("kernel", libxl_file_reference),
-                                      ("slack_memkb", uint32),
-                                      ("bootloader", string),
-                                      ("bootloader_args", string),
-                                      ("cmdline", string),
-                                      ("ramdisk", libxl_file_reference),
-                                      ("features", string, True),
-                                      ("e820_host", bool, False, "Use host's E820 for PCI passthrough."),
-                                      ])),
-                 ])),
-    ],
-    comment =
-"""Instances of libxl_file_reference contained in this struct which
-have been mapped (with libxl_file_reference_map) will be unmapped
-by libxl_domain_build/restore. If either of these are never called
-then the user is responsible for calling
-libxl_file_reference_unmap.""")
-
-libxl_device_model_info = Struct("device_model_info",[
-    ("domid",            libxl_domid),
-    ("uuid",             libxl_uuid,  False, "this is use only with stubdom, and must be different from the domain uuid"),
-    ("dom_name",         string),
-    ("device_model_version", libxl_device_model_version),
-    ("device_model_stubdomain", bool),
-    ("device_model",     string, False, "if you set this you must set device_model_version too"),
-    ("saved_state",      string),
-    ("type",             libxl_domain_type),
-    ("target_ram",       uint32),
-    ("videoram",         integer,           False, "size of the videoram in MB"),
-    ("stdvga",           bool,              False, "stdvga enabled or disabled"),
-    ("vnc",              bool,              False, "vnc enabled or disabled"),
-    ("vnclisten",        string,            False, "address:port that should be listened on for the VNC server if vnc is set"),
-    ("vncpasswd",        string,            False, "the VNC password"),
-    ("vncdisplay",       integer,           False, "set VNC display number"),
-    ("vncunused",        bool,              False, "try to find an unused port for the VNC server"),
-    ("keymap",           string,            False, "set keyboard layout, default is en-us keyboard"),
-    ("sdl",              bool,              False, "sdl enabled or disabled"),
-    ("opengl",           bool,              False, "opengl enabled or disabled (if enabled requires sdl enabled)"),
-    ("spice",            bool,              False,
-    "spice enabled or disabled"),
-    ("spiceport",        integer,           False,
-    "the port that should be listened on for the spice server"),
-    ("spicetls_port",    integer,           False, """the tls port
-that should be listened on for the spice server,
-at least one of the port or tls port must be given"""),
-    ("spicehost",        string,            False, """the interface
-that should be listened on if given otherwise any interface"""),
-    ("spicedisable_ticketing", bool,        False,
-    "enable client connection with no password"),
-    ("spicepasswd",      string,            False, """set ticket password
-witch must be used by a client for connection.
-The password never expires"""),
-    ("spiceagent_mouse", bool,              False,
-    "Whether spice agent is used for client mouse mode(default is on)"),
-    ("nographic",        bool,              False, "no graphics, use serial port"),
-    ("gfx_passthru",     bool,              False, "graphics passthrough enabled or disabled"),
-    ("serial",           string,            False, "serial port re-direct to pty deivce"),
-    ("boot",             string,            False, "boot order, for example dca"),
-    ("usb",              bool,              False, "usb support enabled or disabled"),
-    ("usbdevice",        string,            False, "enable usb mouse: tablet for absolute mouse, mouse for PS/2 protocol relative mouse"),
-    ("soundhw",          string,            False, "enable sound hardware"),
-    ("acpi",             bool,              False, "acpi enabled or disabled"),
-    ("vcpus",            integer,           False, "max number of vcpus"),
-    ("vcpu_avail",       integer,           False, "vcpus actually available"),
-    ("xen_platform_pci", bool,              False, "enable/disable the xen platform pci device"),
-    ("extra",            libxl_string_list, False, "extra parameters pass directly to qemu, NULL terminated"),
-    ("extra_pv",         libxl_string_list, False, "extra parameters pass directly to qemu for PV guest, NULL terminated"),
-    ("extra_hvm",        libxl_string_list, False, "extra parameters pass directly to qemu for HVM guest, NULL terminated"),
-    ],
-    comment=
-"""Device Model information.
-
-Network is missing""")
-
-libxl_device_vfb = Struct("device_vfb", [
-    ("backend_domid", libxl_domid),
-    ("devid",         integer),
-    ("vnc",           bool,     False, "vnc enabled or disabled"),
-    ("vnclisten",     string,   False, "address:port that should be listened on for the VNC server if vnc is set"),
-    ("vncpasswd",     string,   False, "the VNC password"),
-    ("vncdisplay",    integer,  False, "set VNC display number"),
-    ("vncunused",     bool,     False, "try to find an unused port for the VNC server"),
-    ("keymap",        string,   False, "set keyboard layout, default is en-us keyboard"),
-    ("sdl",           bool,     False, "sdl enabled or disabled"),
-    ("opengl",        bool,     False, "opengl enabled or disabled (if enabled requires sdl enabled)"),
-    ("display",       string),
-    ("xauthority",    string),
-    ])
-
-libxl_device_vkb = Struct("device_vkb", [
-    ("backend_domid", libxl_domid),
-    ("devid", integer),
-    ])
-
-libxl_device_console = Struct("device_console", [
-    ("backend_domid", libxl_domid),
-    ("devid", integer),
-    ("consback", libxl_console_backend),
-    ("output", string),
-    ])
-
-libxl_device_disk = Struct("device_disk", [
-    ("backend_domid", libxl_domid),
-    ("pdev_path", string),
-    ("vdev", string),
-    ("backend", libxl_disk_backend),
-    ("format", libxl_disk_format),
-    ("script", string),
-    ("removable", integer),
-    ("readwrite", integer),
-    ("is_cdrom", integer),
-    ])
-
-libxl_device_nic = Struct("device_nic", [
-    ("backend_domid", libxl_domid),
-    ("devid", integer),
-    ("mtu", integer),
-    ("model", string),
-    ("mac", libxl_mac),
-    ("ip", string),
-    ("bridge", string),
-    ("ifname", string),
-    ("script", string),
-    ("nictype", libxl_nic_type),
-    ])
-
-libxl_device_pci = Struct("device_pci", [
-    ("func",      uint8),
-    ("dev",       uint8),
-    ("bus",       uint8),
-    ("domain",    integer),
-    ("vdevfn",    uint32),
-    ("vfunc_mask", uint32),
-    ("msitranslate", bool),
-    ("power_mgmt", bool),
-    ])
-
-libxl_diskinfo = Struct("diskinfo", [
-    ("backend", string),
-    ("backend_id", uint32),
-    ("frontend", string),
-    ("frontend_id", uint32),
-    ("devid", integer),
-    ("state", integer),
-    ("evtch", integer),
-    ("rref", integer),
-    ])
-
-libxl_nicinfo = Struct("nicinfo", [
-    ("backend", string),
-    ("backend_id", uint32),
-    ("frontend", string),
-    ("frontend_id", uint32),
-    ("devid", integer),
-    ("state", integer),
-    ("script", string),
-    ("mac", libxl_mac),
-    ("evtch", integer),
-    ("rref_tx", integer),
-    ("rref_rx", integer),
-    ])
-
-libxl_vcpuinfo = Struct("vcpuinfo", [
-    ("vcpuid", uint32,              False, "vcpu's id"),
-    ("cpu", uint32,                 False, "current mapping"),
-    ("online", bool,                False, "currently online (not hotplugged)?"),
-    ("blocked", bool,               False, "blocked waiting for an event?"),
-    ("running", bool,               False, "currently scheduled on its CPU?"),
-    ("vcpu_time", uint64,           False, "total vcpu time ran (ns)"),
-    ("cpumap", libxl_cpumap,        False, "current cpu's affinities"),
-    ])
-
-libxl_physinfo = Struct("physinfo", [
-    ("threads_per_core", uint32),
-    ("cores_per_socket", uint32),
-
-    ("max_cpu_id", uint32),
-    ("nr_cpus", uint32),
-    ("cpu_khz", uint32),
-
-    ("total_pages", uint64),
-    ("free_pages", uint64),
-    ("scrub_pages", uint64),
-
-    ("nr_nodes", uint32),
-    ("hw_cap", libxl_hwcap),
-    ("phys_cap", uint32),
-    ], destructor_fn=None, dir=DIR_OUT)
-
-libxl_topologyinfo = Struct("topologyinfo", [
-    ("coremap", libxl_cpuarray,   False, "cpu to core map"),
-    ("socketmap", libxl_cpuarray, False, "cpu to socket map"),
-    ("nodemap", libxl_cpuarray,   False, "cpu to node map"),
-    ])
-
-libxl_sched_credit = Struct("sched_credit", [
-    ("weight", integer),
-    ("cap", integer),
-    ], destructor_fn=None)
diff -r cf2ba5720151 -r a543e10211f7 tools/libxl/libxl_types.idl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_types.idl	Thu Sep 29 16:28:20 2011 +0100
@@ -0,0 +1,374 @@
+# -*- python -*-
+#
+# Builtin libxl types
+#
+
+libxl_domid = Builtin("domid")
+libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
+libxl_mac = Builtin("mac", passby=PASS_BY_REFERENCE)
+libxl_cpumap = Builtin("cpumap", destructor_fn="libxl_cpumap_destroy", passby=PASS_BY_REFERENCE)
+libxl_cpuarray = Builtin("cpuarray", destructor_fn="libxl_cpuarray_destroy", passby=PASS_BY_REFERENCE)
+libxl_cpuid_policy_list = Builtin("cpuid_policy_list", destructor_fn="libxl_cpuid_destroy", passby=PASS_BY_REFERENCE)
+
+libxl_string_list = Builtin("string_list", destructor_fn="libxl_string_list_destroy", passby=PASS_BY_REFERENCE)
+libxl_key_value_list = Builtin("key_value_list", destructor_fn="libxl_key_value_list_destroy", passby=PASS_BY_REFERENCE)
+libxl_file_reference = Builtin("file_reference", destructor_fn="libxl_file_reference_destroy", passby=PASS_BY_REFERENCE)
+
+libxl_hwcap = Builtin("hwcap")
+
+#
+# Constants / Enumerations
+#
+
+libxl_domain_type = Enumeration("domain_type", [
+    (1, "HVM"),
+    (2, "PV"),
+    ])
+
+libxl_device_model_version = Enumeration("device_model_version", [
+    (1, "QEMU_XEN_TRADITIONAL", "Historical qemu-xen device model (qemu-dm)"),
+    (2, "QEMU_XEN", "Upstream based qemu-xen device model"),
+    ])
+
+libxl_console_type = Enumeration("console_type", [
+    (1, "SERIAL"),
+    (2, "PV"),
+    ])
+
+libxl_console_backend = Enumeration("console_backend", [
+    (1, "XENCONSOLED"),
+    (2, "IOEMU"),
+    ])
+
+libxl_disk_format = Enumeration("disk_format", [
+    (0, "UNKNOWN"),
+    (1, "QCOW"),
+    (2, "QCOW2"),
+    (3, "VHD"),
+    (4, "RAW"),
+    (5, "EMPTY"),
+    ])
+
+libxl_disk_backend = Enumeration("disk_backend", [
+    (0, "UNKNOWN"),
+    (1, "PHY"),
+    (2, "TAP"),
+    (3, "QDISK"),
+    ])
+
+libxl_nic_type = Enumeration("nic_type", [
+    (1, "IOEMU"),
+    (2, "VIF"),
+    ])
+
+libxl_action_on_shutdown = Enumeration("action_on_shutdown", [
+    (1, "DESTROY"),
+
+    (2, "RESTART"),
+    (3, "RESTART_RENAME"),
+
+    (4, "PRESERVE"),
+
+    (5, "COREDUMP_DESTROY"),
+    (6, "COREDUMP_RESTART"),
+    ])
+
+libxl_event_type = Enumeration("event_type", [
+    (1, "DOMAIN_DEATH"),
+    (2, "DISK_EJECT"),
+    ])
+
+libxl_button = Enumeration("button", [
+    (1, "POWER"),
+    (2, "SLEEP"),
+    ])
+
+#
+# Complex libxl types
+#
+libxl_dominfo = Struct("dominfo",[
+    ("uuid",        libxl_uuid),
+    ("domid",       libxl_domid),
+    ("ssidref",      uint32),
+    ("running",     bool),
+    ("blocked",     bool),
+    ("paused",      bool),
+    ("shutdown",    bool),
+    ("dying",       bool),
+
+    ("shutdown_reason", uint8, False,
+"""Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
+
+Otherwise set to a value guaranteed not to clash with any valid
+SHUTDOWN_* constant."""),
+    ("current_memkb",   uint64),
+    ("shared_memkb", uint64),
+    ("max_memkb",   uint64),
+    ("cpu_time",    uint64),
+    ("vcpu_max_id", uint32),
+    ("vcpu_online", uint32),
+    ], destructor_fn=None)
+
+libxl_cpupoolinfo = Struct("cpupoolinfo", [
+    ("poolid",      uint32),
+    ("sched_id",    uint32),
+    ("n_dom",       uint32),
+    ("cpumap",      libxl_cpumap)
+    ])
+
+libxl_vminfo = Struct("vminfo", [
+    ("uuid", libxl_uuid),
+    ("domid", libxl_domid),
+    ], destructor_fn=None)
+
+libxl_version_info = Struct("version_info", [
+    ("xen_version_major", integer),
+    ("xen_version_minor", integer),
+    ("xen_version_extra", string),
+    ("compiler",          string),
+    ("compile_by",        string),
+    ("compile_domain",    string),
+    ("compile_date",      string),
+    ("capabilities",      string),
+    ("changeset",         string),
+    ("virt_start",        uint64),
+    ("pagesize",          integer),
+    ("commandline",       string),
+    ])
+
+libxl_domain_create_info = Struct("domain_create_info",[
+    ("type",         libxl_domain_type),
+    ("hap",          bool),
+    ("oos",          bool),
+    ("ssidref",      uint32),
+    ("name",         string),
+    ("uuid",         libxl_uuid),
+    ("xsdata",       libxl_key_value_list),
+    ("platformdata", libxl_key_value_list),
+    ("poolid",       uint32),
+    ("poolname",     string),
+    ])
+
+libxl_domain_build_info = Struct("domain_build_info",[
+    ("max_vcpus",       integer),
+    ("cur_vcpus",       integer),
+    ("tsc_mode",        integer),
+    ("max_memkb",       uint32),
+    ("target_memkb",    uint32),
+    ("video_memkb",     uint32),
+    ("shadow_memkb",    uint32),
+    ("disable_migrate", bool),
+    ("cpuid",           libxl_cpuid_policy_list),
+    ("type",            libxl_domain_type),
+    ("u", KeyedUnion(None, libxl_domain_type, "type",
+                [("hvm", Struct(None, [("firmware", string),
+                                       ("pae", bool),
+                                       ("apic", bool),
+                                       ("acpi", bool),
+                                       ("nx", bool),
+                                       ("viridian", bool),
+                                       ("timeoffset", string),
+                                       ("hpet", bool),
+                                       ("vpt_align", bool),
+                                       ("timer_mode", integer),
+                                       ("nested_hvm", bool),
+                                       ])),
+                 ("pv", Struct(None, [("kernel", libxl_file_reference),
+                                      ("slack_memkb", uint32),
+                                      ("bootloader", string),
+                                      ("bootloader_args", string),
+                                      ("cmdline", string),
+                                      ("ramdisk", libxl_file_reference),
+                                      ("features", string, True),
+                                      ("e820_host", bool, False, "Use host's E820 for PCI passthrough."),
+                                      ])),
+                 ])),
+    ],
+    comment =
+"""Instances of libxl_file_reference contained in this struct which
+have been mapped (with libxl_file_reference_map) will be unmapped
+by libxl_domain_build/restore. If either of these are never called
+then the user is responsible for calling
+libxl_file_reference_unmap.""")
+
+libxl_device_model_info = Struct("device_model_info",[
+    ("domid",            libxl_domid),
+    ("uuid",             libxl_uuid,  False, "this is use only with stubdom, and must be different from the domain uuid"),
+    ("dom_name",         string),
+    ("device_model_version", libxl_device_model_version),
+    ("device_model_stubdomain", bool),
+    ("device_model",     string, False, "if you set this you must set device_model_version too"),
+    ("saved_state",      string),
+    ("type",             libxl_domain_type),
+    ("target_ram",       uint32),
+    ("videoram",         integer,           False, "size of the videoram in MB"),
+    ("stdvga",           bool,              False, "stdvga enabled or disabled"),
+    ("vnc",              bool,              False, "vnc enabled or disabled"),
+    ("vnclisten",        string,            False, "address:port that should be listened on for the VNC server if vnc is set"),
+    ("vncpasswd",        string,            False, "the VNC password"),
+    ("vncdisplay",       integer,           False, "set VNC display number"),
+    ("vncunused",        bool,              False, "try to find an unused port for the VNC server"),
+    ("keymap",           string,            False, "set keyboard layout, default is en-us keyboard"),
+    ("sdl",              bool,              False, "sdl enabled or disabled"),
+    ("opengl",           bool,              False, "opengl enabled or disabled (if enabled requires sdl enabled)"),
+    ("spice",            bool,              False,
+    "spice enabled or disabled"),
+    ("spiceport",        integer,           False,
+    "the port that should be listened on for the spice server"),
+    ("spicetls_port",    integer,           False, """the tls port
+that should be listened on for the spice server,
+at least one of the port or tls port must be given"""),
+    ("spicehost",        string,            False, """the interface
+that should be listened on if given otherwise any interface"""),
+    ("spicedisable_ticketing", bool,        False,
+    "enable client connection with no password"),
+    ("spicepasswd",      string,            False, """set ticket password
+witch must be used by a client for connection.
+The password never expires"""),
+    ("spiceagent_mouse", bool,              False,
+    "Whether spice agent is used for client mouse mode(default is on)"),
+    ("nographic",        bool,              False, "no graphics, use serial port"),
+    ("gfx_passthru",     bool,              False, "graphics passthrough enabled or disabled"),
+    ("serial",           string,            False, "serial port re-direct to pty deivce"),
+    ("boot",             string,            False, "boot order, for example dca"),
+    ("usb",              bool,              False, "usb support enabled or disabled"),
+    ("usbdevice",        string,            False, "enable usb mouse: tablet for absolute mouse, mouse for PS/2 protocol relative mouse"),
+    ("soundhw",          string,            False, "enable sound hardware"),
+    ("acpi",             bool,              False, "acpi enabled or disabled"),
+    ("vcpus",            integer,           False, "max number of vcpus"),
+    ("vcpu_avail",       integer,           False, "vcpus actually available"),
+    ("xen_platform_pci", bool,              False, "enable/disable the xen platform pci device"),
+    ("extra",            libxl_string_list, False, "extra parameters pass directly to qemu, NULL terminated"),
+    ("extra_pv",         libxl_string_list, False, "extra parameters pass directly to qemu for PV guest, NULL terminated"),
+    ("extra_hvm",        libxl_string_list, False, "extra parameters pass directly to qemu for HVM guest, NULL terminated"),
+    ],
+    comment=
+"""Device Model information.
+
+Network is missing""")
+
+libxl_device_vfb = Struct("device_vfb", [
+    ("backend_domid", libxl_domid),
+    ("devid",         integer),
+    ("vnc",           bool,     False, "vnc enabled or disabled"),
+    ("vnclisten",     string,   False, "address:port that should be listened on for the VNC server if vnc is set"),
+    ("vncpasswd",     string,   False, "the VNC password"),
+    ("vncdisplay",    integer,  False, "set VNC display number"),
+    ("vncunused",     bool,     False, "try to find an unused port for the VNC server"),
+    ("keymap",        string,   False, "set keyboard layout, default is en-us keyboard"),
+    ("sdl",           bool,     False, "sdl enabled or disabled"),
+    ("opengl",        bool,     False, "opengl enabled or disabled (if enabled requires sdl enabled)"),
+    ("display",       string),
+    ("xauthority",    string),
+    ])
+
+libxl_device_vkb = Struct("device_vkb", [
+    ("backend_domid", libxl_domid),
+    ("devid", integer),
+    ])
+
+libxl_device_console = Struct("device_console", [
+    ("backend_domid", libxl_domid),
+    ("devid", integer),
+    ("consback", libxl_console_backend),
+    ("output", string),
+    ])
+
+libxl_device_disk = Struct("device_disk", [
+    ("backend_domid", libxl_domid),
+    ("pdev_path", string),
+    ("vdev", string),
+    ("backend", libxl_disk_backend),
+    ("format", libxl_disk_format),
+    ("script", string),
+    ("removable", integer),
+    ("readwrite", integer),
+    ("is_cdrom", integer),
+    ])
+
+libxl_device_nic = Struct("device_nic", [
+    ("backend_domid", libxl_domid),
+    ("devid", integer),
+    ("mtu", integer),
+    ("model", string),
+    ("mac", libxl_mac),
+    ("ip", string),
+    ("bridge", string),
+    ("ifname", string),
+    ("script", string),
+    ("nictype", libxl_nic_type),
+    ])
+
+libxl_device_pci = Struct("device_pci", [
+    ("func",      uint8),
+    ("dev",       uint8),
+    ("bus",       uint8),
+    ("domain",    integer),
+    ("vdevfn",    uint32),
+    ("vfunc_mask", uint32),
+    ("msitranslate", bool),
+    ("power_mgmt", bool),
+    ])
+
+libxl_diskinfo = Struct("diskinfo", [
+    ("backend", string),
+    ("backend_id", uint32),
+    ("frontend", string),
+    ("frontend_id", uint32),
+    ("devid", integer),
+    ("state", integer),
+    ("evtch", integer),
+    ("rref", integer),
+    ])
+
+libxl_nicinfo = Struct("nicinfo", [
+    ("backend", string),
+    ("backend_id", uint32),
+    ("frontend", string),
+    ("frontend_id", uint32),
+    ("devid", integer),
+    ("state", integer),
+    ("script", string),
+    ("mac", libxl_mac),
+    ("evtch", integer),
+    ("rref_tx", integer),
+    ("rref_rx", integer),
+    ])
+
+libxl_vcpuinfo = Struct("vcpuinfo", [
+    ("vcpuid", uint32,              False, "vcpu's id"),
+    ("cpu", uint32,                 False, "current mapping"),
+    ("online", bool,                False, "currently online (not hotplugged)?"),
+    ("blocked", bool,               False, "blocked waiting for an event?"),
+    ("running", bool,               False, "currently scheduled on its CPU?"),
+    ("vcpu_time", uint64,           False, "total vcpu time ran (ns)"),
+    ("cpumap", libxl_cpumap,        False, "current cpu's affinities"),
+    ])
+
+libxl_physinfo = Struct("physinfo", [
+    ("threads_per_core", uint32),
+    ("cores_per_socket", uint32),
+
+    ("max_cpu_id", uint32),
+    ("nr_cpus", uint32),
+    ("cpu_khz", uint32),
+
+    ("total_pages", uint64),
+    ("free_pages", uint64),
+    ("scrub_pages", uint64),
+
+    ("nr_nodes", uint32),
+    ("hw_cap", libxl_hwcap),
+    ("phys_cap", uint32),
+    ], destructor_fn=None, dir=DIR_OUT)
+
+libxl_topologyinfo = Struct("topologyinfo", [
+    ("coremap", libxl_cpuarray,   False, "cpu to core map"),
+    ("socketmap", libxl_cpuarray, False, "cpu to socket map"),
+    ("nodemap", libxl_cpuarray,   False, "cpu to node map"),
+    ])
+
+libxl_sched_credit = Struct("sched_credit", [
+    ("weight", integer),
+    ("cap", integer),
+    ], destructor_fn=None)
diff -r cf2ba5720151 -r a543e10211f7 tools/ocaml/libs/xl/Makefile
--- a/tools/ocaml/libs/xl/Makefile	Thu Sep 29 16:06:02 2011 +0100
+++ b/tools/ocaml/libs/xl/Makefile	Thu Sep 29 16:28:20 2011 +0100
@@ -45,10 +45,10 @@
 	  < xl.mli.in > xl.mli.tmp
 	$(Q)mv xl.mli.tmp xl.mli
 
-_libxl_types.ml.in _libxl_types.mli.in _libxl_types.inc: genwrap.py $(XEN_ROOT)/tools/libxl/libxl.idl \
+_libxl_types.ml.in _libxl_types.mli.in _libxl_types.inc: genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
                 $(XEN_ROOT)/tools/libxl/libxltypes.py
 	PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
-		$(XEN_ROOT)/tools/libxl/libxl.idl \
+		$(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		_libxl_types.mli.in _libxl_types.ml.in _libxl_types.inc
 
 libs: $(LIBS)
diff -r cf2ba5720151 -r a543e10211f7 tools/python/Makefile
--- a/tools/python/Makefile	Thu Sep 29 16:06:02 2011 +0100
+++ b/tools/python/Makefile	Thu Sep 29 16:28:20 2011 +0100
@@ -10,10 +10,10 @@
 $(eval $(genpath-target))
 
 .PHONY: build
-build: genpath genwrap.py $(XEN_ROOT)/tools/libxl/libxl.idl \
+build: genpath genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		$(XEN_ROOT)/tools/libxl/libxltypes.py
 	PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
-		$(XEN_ROOT)/tools/libxl/libxl.idl \
+		$(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		xen/lowlevel/xl/_pyxl_types.h \
 		xen/lowlevel/xl/_pyxl_types.c
 	CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:34:10 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:34:10 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pP0-0005gB-HD; Fri, 30 Sep 2011 19:34:10 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pO9-0005LQ-JS
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1317436394!27097735!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26493 invoked from network); 1 Oct 2011 02:33:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:33:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO6-0001FJ-9J
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:14 +0100
Message-Id: <E1R9pO6-0001FJ-9J@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Introduce libxl__realloc.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1317310102 -3600
# Node ID 952e0118a7c47c467c34f24f9c271902eed3bc99
# Parent  f51dcd8acb7b950c870d23d250f56ad542997ae9
libxl: Introduce libxl__realloc.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r f51dcd8acb7b -r 952e0118a7c4 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Thu Sep 29 16:28:22 2011 +0100
+++ b/tools/libxl/libxl_internal.c	Thu Sep 29 16:28:22 2011 +0100
@@ -102,6 +102,30 @@
     return ptr;
 }
 
+void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size)
+{
+    void *new_ptr = realloc(ptr, new_size);
+    int i = 0;
+
+    if (new_ptr == NULL && new_size != 0) {
+        return NULL;
+    }
+
+    if (ptr == NULL) {
+        libxl__ptr_add(gc, new_ptr);
+    } else if (new_ptr != ptr) {
+        for (i = 0; i < gc->alloc_maxsize; i++) {
+            if (gc->alloc_ptrs[i] == ptr) {
+                gc->alloc_ptrs[i] = new_ptr;
+                break;
+            }
+        }
+    }
+
+
+    return new_ptr;
+}
+
 char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...)
 {
     char *s;
diff -r f51dcd8acb7b -r 952e0118a7c4 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Sep 29 16:28:22 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Thu Sep 29 16:28:22 2011 +0100
@@ -145,6 +145,7 @@
 _hidden void libxl__free_all(libxl__gc *gc);
 _hidden void *libxl__zalloc(libxl__gc *gc, int bytes);
 _hidden void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size);
+_hidden void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size);
 _hidden char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
 _hidden char *libxl__strdup(libxl__gc *gc, const char *c);
 _hidden char *libxl__dirname(libxl__gc *gc, const char *s);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:34:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:34:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pP9-0005k3-EN; Fri, 30 Sep 2011 19:34:19 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pOA-0005LV-2h
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1317436394!18632534!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5647 invoked from network); 1 Oct 2011 02:33:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:33:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO6-0001G1-Ra
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:14 +0100
Message-Id: <E1R9pO6-0001G1-Ra@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Intruduce libxl__strndup.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1317310103 -3600
# Node ID 066dc3758fa46525c5db9f314bc617542f1ea671
# Parent  952e0118a7c47c467c34f24f9c271902eed3bc99
libxl: Intruduce libxl__strndup.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 952e0118a7c4 -r 066dc3758fa4 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Thu Sep 29 16:28:22 2011 +0100
+++ b/tools/libxl/libxl_internal.c	Thu Sep 29 16:28:23 2011 +0100
@@ -159,6 +159,16 @@
     return s;
 }
 
+char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
+{
+    char *s = strndup(c, n);
+
+    if (s)
+        libxl__ptr_add(gc, s);
+
+    return s;
+}
+
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
     char *c;
diff -r 952e0118a7c4 -r 066dc3758fa4 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Sep 29 16:28:22 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Thu Sep 29 16:28:23 2011 +0100
@@ -148,6 +148,7 @@
 _hidden void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size);
 _hidden char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
 _hidden char *libxl__strdup(libxl__gc *gc, const char *c);
+_hidden char *libxl__strndup(libxl__gc *gc, const char *c, size_t n);
 _hidden char *libxl__dirname(libxl__gc *gc, const char *s);
 
 _hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int length);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:34:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:34:28 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pPI-0005n8-9A; Fri, 30 Sep 2011 19:34:28 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pOA-0005Lb-Hy
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1317436395!20434179!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23173 invoked from network); 1 Oct 2011 02:33:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:33:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO7-0001Gl-CR
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:15 +0100
Message-Id: <E1R9pO7-0001Gl-CR@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Introduce JSON parser
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1317310104 -3600
# Node ID 5f397994e6d605c4a4d17b7ba86b5ac51c65df8d
# Parent  066dc3758fa46525c5db9f314bc617542f1ea671
libxl: Introduce JSON parser

We use the yajl parser, but we need to make a tree from the parse result
to use it outside the parser.

So this patch include json_object struct that is used to hold the JSON
data.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 066dc3758fa4 -r 5f397994e6d6 README
--- a/README	Thu Sep 29 16:28:23 2011 +0100
+++ b/README	Thu Sep 29 16:28:24 2011 +0100
@@ -47,6 +47,7 @@
     * Development install of openssl (e.g., openssl-dev)
     * Development install of x11 (e.g. xorg-x11-dev)
     * Development install of uuid (e.g. uuid-dev)
+    * Development install of yajl (e.g. libyajl-dev)
     * bridge-utils package (/sbin/brctl)
     * iproute package (/sbin/ip)
     * hotplug or udev
diff -r 066dc3758fa4 -r 5f397994e6d6 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Thu Sep 29 16:28:23 2011 +0100
+++ b/tools/libxl/Makefile	Thu Sep 29 16:28:24 2011 +0100
@@ -32,9 +32,12 @@
 LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o
 LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o
 
+LIBXL_LIBS += -lyajl
+
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
-			libxl_internal.o libxl_utils.o libxl_uuid.o $(LIBXL_OBJS-y)
+			libxl_internal.o libxl_utils.o libxl_uuid.o libxl_json.o \
+			$(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
diff -r 066dc3758fa4 -r 5f397994e6d6 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Sep 29 16:28:23 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Thu Sep 29 16:28:24 2011 +0100
@@ -394,4 +394,104 @@
 #define STRINGIFY(x) #x
 #define TOSTRING(x) STRINGIFY(x)
 
+/* from libxl_json */
+#include <yajl/yajl_gen.h>
+
+_hidden yajl_gen_status libxl__yajl_gen_asciiz(yajl_gen hand, const char *str);
+
+typedef enum {
+    JSON_ERROR,
+    JSON_NULL,
+    JSON_TRUE,
+    JSON_FALSE,
+    JSON_INTEGER,
+    JSON_DOUBLE,
+    JSON_STRING,
+    JSON_MAP,
+    JSON_ARRAY,
+    JSON_ANY
+} libxl__json_node_type;
+
+typedef struct libxl__json_object {
+    libxl__json_node_type type;
+    union {
+        long i;
+        double d;
+        char *string;
+        /* List of libxl__json_object */
+        flexarray_t *array;
+        /* List of libxl__json_map_node */
+        flexarray_t *map;
+    } u;
+    struct libxl__json_object *parent;
+} libxl__json_object;
+
+typedef struct {
+    char *map_key;
+    libxl__json_object *obj;
+} libxl__json_map_node;
+
+typedef struct libxl__yajl_ctx libxl__yajl_ctx;
+
+static inline bool libxl__json_object_is_string(const libxl__json_object *o)
+{
+    return o != NULL && o->type == JSON_STRING;
+}
+static inline bool libxl__json_object_is_integer(const libxl__json_object *o)
+{
+    return o != NULL && o->type == JSON_INTEGER;
+}
+static inline bool libxl__json_object_is_map(const libxl__json_object *o)
+{
+    return o != NULL && o->type == JSON_MAP;
+}
+static inline bool libxl__json_object_is_array(const libxl__json_object *o)
+{
+    return o != NULL && o->type == JSON_ARRAY;
+}
+
+static inline
+const char *libxl__json_object_get_string(const libxl__json_object *o)
+{
+    if (libxl__json_object_is_string(o))
+        return o->u.string;
+    else
+        return NULL;
+}
+static inline
+flexarray_t *libxl__json_object_get_map(const libxl__json_object *o)
+{
+    if (libxl__json_object_is_map(o))
+        return o->u.map;
+    else
+        return NULL;
+}
+static inline
+flexarray_t *libxl__json_object_get_array(const libxl__json_object *o)
+{
+    if (libxl__json_object_is_array(o))
+        return o->u.array;
+    else
+        return NULL;
+}
+static inline long libxl__json_object_get_integer(const libxl__json_object *o)
+{
+    if (libxl__json_object_is_integer(o))
+        return o->u.i;
+    else
+        return -1;
+}
+
+_hidden libxl__json_object *libxl__json_array_get(const libxl__json_object *o,
+                                                  int i);
+_hidden
+libxl__json_map_node *libxl__json_map_node_get(const libxl__json_object *o,
+                                               int i);
+_hidden const libxl__json_object *libxl__json_map_get(const char *key,
+                                          const libxl__json_object *o,
+                                          libxl__json_node_type expected_type);
+_hidden void libxl__json_object_free(libxl__gc *gc, libxl__json_object *obj);
+
+_hidden libxl__json_object *libxl__json_parse(libxl__gc *gc, const char *s);
+
 #endif
diff -r 066dc3758fa4 -r 5f397994e6d6 tools/libxl/libxl_json.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_json.c	Thu Sep 29 16:28:24 2011 +0100
@@ -0,0 +1,560 @@
+/*
+ * Copyright (C) 2011      Citrix Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include <assert.h>
+#include <string.h>
+
+#include <yajl/yajl_parse.h>
+#include <yajl/yajl_gen.h>
+
+#include "libxl_internal.h"
+
+/* #define DEBUG_ANSWER */
+
+struct libxl__yajl_ctx {
+    libxl__gc *gc;
+    yajl_handle hand;
+    libxl__json_object *head;
+    libxl__json_object *current;
+#ifdef DEBUG_ANSWER
+    yajl_gen g;
+#endif
+};
+
+#ifdef DEBUG_ANSWER
+#  define DEBUG_GEN_ALLOC(ctx) \
+    if ((ctx)->g == NULL) { \
+        yajl_gen_config conf = { 1, "  " }; \
+        (ctx)->g = yajl_gen_alloc(&conf, NULL); \
+    }
+#  define DEBUG_GEN_FREE(ctx) \
+    if ((ctx)->g) yajl_gen_free((ctx)->g)
+#  define DEBUG_GEN(ctx, type)              yajl_gen_##type(ctx->g)
+#  define DEBUG_GEN_VALUE(ctx, type, value) yajl_gen_##type(ctx->g, value)
+#  define DEBUG_GEN_STRING(ctx, str, n)     yajl_gen_string(ctx->g, str, n)
+#  define DEBUG_GEN_REPORT(yajl_ctx) \
+    do { \
+        const unsigned char *buf = NULL; \
+        unsigned int len = 0; \
+        yajl_gen_get_buf((yajl_ctx)->g, &buf, &len); \
+        LIBXL__LOG(libxl__gc_owner((yajl_ctx)->gc), \
+                   LIBXL__LOG_DEBUG, "response:\n%s", buf); \
+        yajl_gen_free((yajl_ctx)->g); \
+        (yajl_ctx)->g = NULL; \
+    } while (0)
+#else
+#  define DEBUG_GEN_ALLOC(ctx)                  ((void)0)
+#  define DEBUG_GEN_FREE(ctx)                   ((void)0)
+#  define DEBUG_GEN(ctx, type)                  ((void)0)
+#  define DEBUG_GEN_VALUE(ctx, type, value)     ((void)0)
+#  define DEBUG_GEN_STRING(ctx, value, lenght)  ((void)0)
+#  define DEBUG_GEN_REPORT(ctx)                 ((void)0)
+#endif
+
+/*
+ * YAJL Helper
+ */
+
+yajl_gen_status libxl__yajl_gen_asciiz(yajl_gen hand, const char *str)
+{
+    return yajl_gen_string(hand, (const unsigned char *)str, strlen(str));
+}
+
+
+/*
+ * libxl__json_object helper functions
+ */
+
+static libxl__json_object *json_object_alloc(libxl__gc *gc,
+                                             libxl__json_node_type type)
+{
+    libxl__json_object *obj;
+
+    obj = calloc(1, sizeof (libxl__json_object));
+    if (obj == NULL) {
+        LIBXL__LOG_ERRNO(libxl__gc_owner(gc), LIBXL__LOG_ERROR,
+                         "Failed to allocate a libxl__json_object");
+        return NULL;
+    }
+
+    obj->type = type;
+
+    if (type == JSON_MAP || type == JSON_ARRAY) {
+        flexarray_t *array = flexarray_make(1, 1);
+        if (array == NULL) {
+            LIBXL__LOG_ERRNO(libxl__gc_owner(gc), LIBXL__LOG_ERROR,
+                             "Failed to allocate a flexarray");
+            free(obj);
+            return NULL;
+        }
+        if (type == JSON_MAP)
+            obj->u.map = array;
+        else
+            obj->u.array = array;
+    }
+
+    return obj;
+}
+
+static int json_object_append_to(libxl__gc *gc,
+                                 libxl__json_object *obj,
+                                 libxl__json_object *dst)
+{
+    assert(dst != NULL);
+
+    switch (dst->type) {
+    case JSON_MAP: {
+        libxl__json_map_node *last;
+
+        if (dst->u.map->count == 0) {
+            LIBXL__LOG(libxl__gc_owner(gc), LIBXL__LOG_ERROR,
+                       "Try to add a value to an empty map (with no key)");
+            return -1;
+        }
+        flexarray_get(dst->u.map, dst->u.map->count - 1, (void**)&last);
+        last->obj = obj;
+        break;
+    }
+    case JSON_ARRAY:
+        if (flexarray_append(dst->u.array, obj) == 2) {
+            LIBXL__LOG_ERRNO(libxl__gc_owner(gc), LIBXL__LOG_ERROR,
+                             "Failed to grow a flexarray");
+            return -1;
+        }
+        break;
+    default:
+        LIBXL__LOG(libxl__gc_owner(gc), LIBXL__LOG_ERROR,
+                   "Try append an object is not a map/array (%i)\n",
+                   dst->type);
+        return -1;
+    }
+
+    obj->parent = dst;
+    return 0;
+}
+
+void libxl__json_object_free(libxl__gc *gc, libxl__json_object *obj)
+{
+    int index = 0;
+
+    if (obj == NULL)
+        return;
+    switch (obj->type) {
+    case JSON_STRING:
+        free(obj->u.string);
+        break;
+    case JSON_MAP: {
+        libxl__json_map_node *node = NULL;
+
+        for (index = 0; index < obj->u.map->count; index++) {
+            if (flexarray_get(obj->u.map, index, (void**)&node) != 0)
+                break;
+            libxl__json_object_free(gc, node->obj);
+            free(node->map_key);
+            free(node);
+            node = NULL;
+        }
+        flexarray_free(obj->u.map);
+        break;
+    }
+    case JSON_ARRAY: {
+        libxl__json_object *node = NULL;
+        break;
+
+        for (index = 0; index < obj->u.array->count; index++) {
+            if (flexarray_get(obj->u.array, index, (void**)&node) != 0)
+                break;
+            libxl__json_object_free(gc, node);
+            node = NULL;
+        }
+        flexarray_free(obj->u.array);
+        break;
+    }
+    default:
+        break;
+    }
+    free(obj);
+}
+
+libxl__json_object *libxl__json_array_get(const libxl__json_object *o, int i)
+{
+    flexarray_t *array = NULL;
+    libxl__json_object *obj = NULL;
+
+    if ((array = libxl__json_object_get_array(o)) == NULL) {
+        return NULL;
+    }
+
+    if (i >= array->count)
+        return NULL;
+
+    if (flexarray_get(array, i, (void**)&obj) != 0)
+        return NULL;
+
+    return obj;
+}
+
+libxl__json_map_node *libxl__json_map_node_get(const libxl__json_object *o,
+                                               int i)
+{
+    flexarray_t *array = NULL;
+    libxl__json_map_node *obj = NULL;
+
+    if ((array = libxl__json_object_get_map(o)) == NULL) {
+        return NULL;
+    }
+
+    if (i >= array->count)
+        return NULL;
+
+    if (flexarray_get(array, i, (void**)&obj) != 0)
+        return NULL;
+
+    return obj;
+}
+
+const libxl__json_object *libxl__json_map_get(const char *key,
+                                          const libxl__json_object *o,
+                                          libxl__json_node_type expected_type)
+{
+    flexarray_t *maps = NULL;
+    int index = 0;
+
+    if (libxl__json_object_is_map(o)) {
+        libxl__json_map_node *node = NULL;
+
+        maps = o->u.map;
+        for (index = 0; index < maps->count; index++) {
+            if (flexarray_get(maps, index, (void**)&node) != 0)
+                return NULL;
+            if (strcmp(key, node->map_key) == 0) {
+                if (expected_type == JSON_ANY
+                    || (node->obj && node->obj->type == expected_type)) {
+                    return node->obj;
+                } else {
+                    return NULL;
+                }
+            }
+        }
+    }
+    return NULL;
+}
+
+
+/*
+ * JSON callbacks
+ */
+
+static int json_callback_null(void *opaque)
+{
+    libxl__yajl_ctx *ctx = opaque;
+    libxl__json_object *obj;
+
+    DEBUG_GEN(ctx, null);
+
+    if ((obj = json_object_alloc(ctx->gc, JSON_NULL)) == NULL)
+        return 0;
+
+    if (json_object_append_to(ctx->gc, obj, ctx->current) == -1) {
+        libxl__json_object_free(ctx->gc, obj);
+        return 0;
+    }
+
+    return 1;
+}
+
+static int json_callback_boolean(void *opaque, int boolean)
+{
+    libxl__yajl_ctx *ctx = opaque;
+    libxl__json_object *obj;
+
+    DEBUG_GEN_VALUE(ctx, bool, boolean);
+
+    if ((obj = json_object_alloc(ctx->gc,
+                                 boolean ? JSON_TRUE : JSON_FALSE)) == NULL)
+        return 0;
+
+    if (json_object_append_to(ctx->gc, obj, ctx->current) == -1) {
+        libxl__json_object_free(ctx->gc, obj);
+        return 0;
+    }
+
+    return 1;
+}
+
+static int json_callback_integer(void *opaque, long value)
+{
+    libxl__yajl_ctx *ctx = opaque;
+    libxl__json_object *obj;
+
+    DEBUG_GEN_VALUE(ctx, integer, value);
+
+    if ((obj = json_object_alloc(ctx->gc, JSON_INTEGER)) == NULL)
+        return 0;
+    obj->u.i = value;
+
+    if (json_object_append_to(ctx->gc, obj, ctx->current) == -1) {
+        libxl__json_object_free(ctx->gc, obj);
+        return 0;
+    }
+
+    return 1;
+}
+
+static int json_callback_double(void *opaque, double value)
+{
+    libxl__yajl_ctx *ctx = opaque;
+    libxl__json_object *obj;
+
+    DEBUG_GEN_VALUE(ctx, double, value);
+
+    if ((obj = json_object_alloc(ctx->gc, JSON_DOUBLE)) == NULL)
+        return 0;
+    obj->u.d = value;
+
+    if (json_object_append_to(ctx->gc, obj, ctx->current) == -1) {
+        libxl__json_object_free(ctx->gc, obj);
+        return 0;
+    }
+
+    return 1;
+}
+
+static int json_callback_string(void *opaque, const unsigned char *str,
+                                unsigned int len)
+{
+    libxl__yajl_ctx *ctx = opaque;
+    char *t = NULL;
+    libxl__json_object *obj = NULL;
+
+    t = malloc(len + 1);
+    if (t == NULL) {
+        LIBXL__LOG_ERRNO(libxl__gc_owner(ctx->gc), LIBXL__LOG_ERROR,
+                         "Failed to allocate");
+        return 0;
+    }
+
+    DEBUG_GEN_STRING(ctx, str, len);
+
+    strncpy(t, (const char *) str, len);
+    t[len] = 0;
+
+    if ((obj = json_object_alloc(ctx->gc, JSON_STRING)) == NULL) {
+        free(t);
+        return 0;
+    }
+    obj->u.string = t;
+
+    if (json_object_append_to(ctx->gc, obj, ctx->current) == -1) {
+        libxl__json_object_free(ctx->gc, obj);
+        return 0;
+    }
+
+    return 1;
+}
+
+static int json_callback_map_key(void *opaque, const unsigned char *str,
+                                 unsigned int len)
+{
+    libxl__yajl_ctx *ctx = opaque;
+    char *t = NULL;
+    libxl__json_object *obj = ctx->current;
+
+    t = malloc(len + 1);
+    if (t == NULL) {
+        LIBXL__LOG_ERRNO(libxl__gc_owner(ctx->gc), LIBXL__LOG_ERROR,
+                         "Failed to allocate");
+        return 0;
+    }
+
+    DEBUG_GEN_STRING(ctx, str, len);
+
+    strncpy(t, (const char *) str, len);
+    t[len] = 0;
+
+    if (libxl__json_object_is_map(obj)) {
+        libxl__json_map_node *node = malloc(sizeof (libxl__json_map_node));
+        if (node == NULL) {
+            LIBXL__LOG_ERRNO(libxl__gc_owner(ctx->gc), LIBXL__LOG_ERROR,
+                             "Failed to allocate");
+            return 0;
+        }
+
+        node->map_key = t;
+        node->obj = NULL;
+
+        if (flexarray_append(obj->u.map, node) == 2) {
+            LIBXL__LOG_ERRNO(libxl__gc_owner(ctx->gc), LIBXL__LOG_ERROR,
+                             "Failed to grow a flexarray");
+            return 0;
+        }
+    } else {
+        LIBXL__LOG(libxl__gc_owner(ctx->gc), LIBXL__LOG_ERROR,
+                   "Current json object is not a map");
+        return 0;
+    }
+
+    return 1;
+}
+
+static int json_callback_start_map(void *opaque)
+{
+    libxl__yajl_ctx *ctx = opaque;
+    libxl__json_object *obj = NULL;
+
+    DEBUG_GEN(ctx, map_open);
+
+    if ((obj = json_object_alloc(ctx->gc, JSON_MAP)) == NULL)
+        return 0;
+
+    if (ctx->current) {
+        if (json_object_append_to(ctx->gc, obj, ctx->current) == -1) {
+            libxl__json_object_free(ctx->gc, obj);
+            return 0;
+        }
+    }
+
+    ctx->current = obj;
+    if (ctx->head == NULL) {
+        ctx->head = obj;
+    }
+
+    return 1;
+}
+
+static int json_callback_end_map(void *opaque)
+{
+    libxl__yajl_ctx *ctx = opaque;
+
+    DEBUG_GEN(ctx, map_close);
+
+    if (ctx->current) {
+        ctx->current = ctx->current->parent;
+    } else {
+        LIBXL__LOG(libxl__gc_owner(ctx->gc), LIBXL__LOG_ERROR,
+                   "No current libxl__json_object, cannot use his parent.");
+        return 0;
+    }
+
+    return 1;
+}
+
+static int json_callback_start_array(void *opaque)
+{
+    libxl__yajl_ctx *ctx = opaque;
+    libxl__json_object *obj = NULL;
+
+    DEBUG_GEN(ctx, array_open);
+
+    if ((obj = json_object_alloc(ctx->gc, JSON_ARRAY)) == NULL)
+        return 0;
+
+    if (ctx->current) {
+        if (json_object_append_to(ctx->gc, obj, ctx->current) == -1) {
+            libxl__json_object_free(ctx->gc, obj);
+            return 0;
+        }
+    }
+
+    ctx->current = obj;
+    if (ctx->head == NULL) {
+        ctx->head = obj;
+    }
+
+    return 1;
+}
+
+static int json_callback_end_array(void *opaque)
+{
+    libxl__yajl_ctx *ctx = opaque;
+
+    DEBUG_GEN(ctx, array_close);
+
+    if (ctx->current) {
+        ctx->current = ctx->current->parent;
+    } else {
+        LIBXL__LOG(libxl__gc_owner(ctx->gc), LIBXL__LOG_ERROR,
+                   "No current libxl__json_object, cannot use his parent.");
+        return 0;
+    }
+
+    return 1;
+}
+
+static yajl_callbacks callbacks = {
+    json_callback_null,
+    json_callback_boolean,
+    json_callback_integer,
+    json_callback_double,
+    NULL,
+    json_callback_string,
+    json_callback_start_map,
+    json_callback_map_key,
+    json_callback_end_map,
+    json_callback_start_array,
+    json_callback_end_array
+};
+
+static void yajl_ctx_free(libxl__yajl_ctx *yajl_ctx)
+{
+    if (yajl_ctx->hand) {
+        yajl_free(yajl_ctx->hand);
+        yajl_ctx->hand = NULL;
+    }
+    DEBUG_GEN_FREE(yajl_ctx);
+}
+
+libxl__json_object *libxl__json_parse(libxl__gc *gc, const char *s)
+{
+    yajl_status status;
+    libxl__yajl_ctx yajl_ctx;
+
+    memset(&yajl_ctx, 0, sizeof (yajl_ctx));
+    yajl_ctx.gc = gc;
+
+    DEBUG_GEN_ALLOC(&yajl_ctx);
+
+    if (yajl_ctx.hand == NULL) {
+        yajl_parser_config cfg = {
+            .allowComments = 1,
+            .checkUTF8 = 1,
+        };
+        yajl_ctx.hand = yajl_alloc(&callbacks, &cfg, NULL, &yajl_ctx);
+    }
+    status = yajl_parse(yajl_ctx.hand, (const unsigned char *)s, strlen(s));
+    status = yajl_parse_complete(yajl_ctx.hand);
+
+    if (status == yajl_status_ok) {
+        libxl__json_object *o = yajl_ctx.head;
+
+        DEBUG_GEN_REPORT(&yajl_ctx);
+
+        yajl_ctx.head = NULL;
+
+        yajl_ctx_free(&yajl_ctx);
+        return o;
+    } else {
+        unsigned char *str = yajl_get_error(yajl_ctx.hand, 1,
+                                            (const unsigned char *)s,
+                                            strlen(s));
+
+        LIBXL__LOG(libxl__gc_owner(gc), LIBXL__LOG_ERROR,
+                   "yajl error: %s", str);
+        yajl_free_error(yajl_ctx.hand, str);
+
+        libxl__json_object_free(gc, yajl_ctx.head);
+        yajl_ctx_free(&yajl_ctx);
+        return NULL;
+    }
+}

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:34:36 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:34:36 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pPP-0005q1-PN; Fri, 30 Sep 2011 19:34:35 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pOB-0005Lp-RX
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1317436396!33433630!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14531 invoked from network); 1 Oct 2011 02:33:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:33:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO8-0001IJ-H0
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:16 +0100
Message-Id: <E1R9pO8-0001IJ-H0@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_qmp: use of
	libxl__fd_set_cloexec.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1317310284 -3600
# Node ID e78cd03b0308c3ba5737ba9821bf7272f45549ca
# Parent  95a40ee93806f3c79ff05b18777bb20b2cea4c6f
libxl: libxl_qmp: use of libxl__fd_set_cloexec.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 95a40ee93806 -r e78cd03b0308 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Thu Sep 29 16:30:54 2011 +0100
+++ b/tools/libxl/libxl_qmp.c	Thu Sep 29 16:31:24 2011 +0100
@@ -302,6 +302,7 @@
     if (fcntl(qmp->qmp_fd, F_SETFL, flags | O_NONBLOCK) == -1) {
         return -1;
     }
+    libxl__fd_set_cloexec(qmp->qmp_fd);
 
     memset(&qmp->addr, 0, sizeof (&qmp->addr));
     qmp->addr.sun_family = AF_UNIX;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:34:43 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:34:43 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pPW-0005t8-Oy; Fri, 30 Sep 2011 19:34:43 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pOA-0005Lc-VS
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1317436379!44669821!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27860 invoked from network); 1 Oct 2011 02:32:59 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:32:59 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO7-0001HZ-Uy
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:15 +0100
Message-Id: <E1R9pO7-0001HZ-Uy@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Introduce a QMP client
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1317310254 -3600
# Node ID 95a40ee93806f3c79ff05b18777bb20b2cea4c6f
# Parent  5f397994e6d605c4a4d17b7ba86b5ac51c65df8d
libxl: Introduce a QMP client

QMP stands for QEMU Monitor Protocol and it is used to query information
from QEMU or to control QEMU.

This implementation will ask QEMU the list of chardevice and store the
path to serial ports in xenstored. So we will be able to use xl console
with QEMU upstream.

In order to connect to the QMP server, a socket file is created in
/var/run/xen/qmp-libxl-$(domid).

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 5f397994e6d6 -r 95a40ee93806 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Thu Sep 29 16:28:24 2011 +0100
+++ b/tools/libxl/Makefile	Thu Sep 29 16:30:54 2011 +0100
@@ -37,7 +37,7 @@
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
 			libxl_internal.o libxl_utils.o libxl_uuid.o libxl_json.o \
-			$(LIBXL_OBJS-y)
+			libxl_qmp.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
diff -r 5f397994e6d6 -r 95a40ee93806 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu Sep 29 16:28:24 2011 +0100
+++ b/tools/libxl/libxl.c	Thu Sep 29 16:30:54 2011 +0100
@@ -763,6 +763,8 @@
     if (dm_present) {
         if (libxl__destroy_device_model(&gc, domid) < 0)
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl__destroy_device_model failed for %d", domid);
+
+        libxl__qmp_cleanup(&gc, domid);
     }
     if (libxl__devices_destroy(&gc, domid, force) < 0)
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_destroy_devices failed for %d", domid);
diff -r 5f397994e6d6 -r 95a40ee93806 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Thu Sep 29 16:28:24 2011 +0100
+++ b/tools/libxl/libxl_create.c	Thu Sep 29 16:30:54 2011 +0100
@@ -573,6 +573,10 @@
     }
 
     if (dm_starting) {
+        if (dm_info->device_model_version
+            == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+            libxl__qmp_initializations(ctx, domid);
+        }
         ret = libxl__confirm_device_model_startup(gc, dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
diff -r 5f397994e6d6 -r 95a40ee93806 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Thu Sep 29 16:28:24 2011 +0100
+++ b/tools/libxl/libxl_dm.c	Thu Sep 29 16:30:54 2011 +0100
@@ -248,6 +248,16 @@
     flexarray_vappend(dm_args, dm,
                       "-xen-domid", libxl__sprintf(gc, "%d", info->domid), NULL);
 
+    flexarray_append(dm_args, "-chardev");
+    flexarray_append(dm_args,
+                     libxl__sprintf(gc, "socket,id=libxl-cmd,"
+                                    "path=%s/qmp-libxl-%d,server,nowait",
+                                    libxl_run_dir_path(),
+                                    info->domid));
+
+    flexarray_append(dm_args, "-mon");
+    flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
+
     if (info->type == LIBXL_DOMAIN_TYPE_PV) {
         flexarray_append(dm_args, "-xen-attach");
     }
diff -r 5f397994e6d6 -r 95a40ee93806 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Sep 29 16:28:24 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Thu Sep 29 16:30:54 2011 +0100
@@ -394,6 +394,25 @@
 #define STRINGIFY(x) #x
 #define TOSTRING(x) STRINGIFY(x)
 
+/* from libxl_qmp */
+typedef struct libxl__qmp_handler libxl__qmp_handler;
+
+/* Initialise and connect to the QMP socket.
+ *   Return an handler or NULL if there is an error
+ */
+_hidden libxl__qmp_handler *libxl__qmp_initialize(libxl_ctx *ctx,
+                                                  uint32_t domid);
+/* ask to QEMU the serial port information and store it in xenstore. */
+_hidden int libxl__qmp_query_serial(libxl__qmp_handler *qmp);
+/* close and free the QMP handler */
+_hidden void libxl__qmp_close(libxl__qmp_handler *qmp);
+/* remove the socket file, if the file has already been removed,
+ * nothing happen */
+_hidden void libxl__qmp_cleanup(libxl__gc *gc, uint32_t domid);
+
+/* this helper calls qmp_initialize, query_serial and qmp_close */
+_hidden int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid);
+
 /* from libxl_json */
 #include <yajl/yajl_gen.h>
 
diff -r 5f397994e6d6 -r 95a40ee93806 tools/libxl/libxl_qmp.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_qmp.c	Thu Sep 29 16:30:54 2011 +0100
@@ -0,0 +1,595 @@
+/*
+ * Copyright (C) 2011      Citrix Ltd.
+ * Author Anthony PERARD <anthony.perard@citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+/*
+ * This file implement a client for QMP (QEMU Monitor Protocol). For the
+ * Specification, see in the QEMU repository.
+ */
+
+#include <unistd.h>
+#include <sys/un.h>
+#include <sys/queue.h>
+#include <fcntl.h>
+
+#include <yajl/yajl_gen.h>
+
+#include "libxl_internal.h"
+
+/* #define DEBUG_RECEIVED */
+
+#ifdef DEBUG_RECEIVED
+#  define DEBUG_REPORT_RECEIVED(buf, len) \
+    LIBXL__LOG(qmp->ctx, LIBXL__LOG_DEBUG, "received: '%.*s'", len, buf)
+#else
+#  define DEBUG_REPORT_RECEIVED(buf, len) ((void)0)
+#endif
+
+/*
+ * QMP types & constant
+ */
+
+#define QMP_RECEIVE_BUFFER_SIZE 4096
+
+typedef int (*qmp_callback_t)(libxl__qmp_handler *qmp,
+                              const libxl__json_object *tree);
+
+typedef struct callback_id_pair {
+    int id;
+    qmp_callback_t callback;
+    SIMPLEQ_ENTRY(callback_id_pair) next;
+} callback_id_pair;
+
+struct libxl__qmp_handler {
+    struct sockaddr_un addr;
+    int qmp_fd;
+    bool connected;
+    time_t timeout;
+    /* wait_for_id will be used by the synchronous send function */
+    int wait_for_id;
+
+    char buffer[QMP_RECEIVE_BUFFER_SIZE];
+    libxl__yajl_ctx *yajl_ctx;
+
+    libxl_ctx *ctx;
+    uint32_t domid;
+
+    int last_id_used;
+    SIMPLEQ_HEAD(callback_list, callback_id_pair) callback_list;
+};
+
+static int qmp_send(libxl__qmp_handler *qmp,
+                    const char *cmd, qmp_callback_t callback);
+
+static const int QMP_SOCKET_CONNECT_TIMEOUT = 5;
+
+/*
+ * QMP callbacks functions
+ */
+
+static int store_serial_port_info(libxl__qmp_handler *qmp,
+                                  const char *chardev,
+                                  int port)
+{
+    libxl__gc gc = LIBXL_INIT_GC(qmp->ctx);
+    char *path = NULL;
+    int ret = 0;
+
+    if (!(chardev && strncmp("pty:", chardev, 4) == 0)) {
+        return -1;
+    }
+
+    path = libxl__xs_get_dompath(&gc, qmp->domid);
+    path = libxl__sprintf(&gc, "%s/serial/%d/tty", path, port);
+
+    ret = libxl__xs_write(&gc, XBT_NULL, path, "%s", chardev + 4);
+
+    libxl__free_all(&gc);
+    return ret;
+}
+
+static int register_serials_chardev_callback(libxl__qmp_handler *qmp,
+                                             const libxl__json_object *o)
+{
+    const libxl__json_object *obj = NULL;
+    const libxl__json_object *label = NULL;
+    const char *s = NULL;
+    int i = 0;
+    const char *chardev = NULL;
+    int ret = 0;
+
+    for (i = 0; (obj = libxl__json_array_get(o, i)); i++) {
+        if (!libxl__json_object_is_map(obj))
+            continue;
+        label = libxl__json_map_get("label", obj, JSON_STRING);
+        s = libxl__json_object_get_string(label);
+
+        if (s && strncmp("serial", s, strlen("serial")) == 0) {
+            const libxl__json_object *filename = NULL;
+            char *endptr = NULL;
+            int port_number;
+
+            filename = libxl__json_map_get("filename", obj, JSON_STRING);
+            chardev = libxl__json_object_get_string(filename);
+
+            s += strlen("serial");
+            port_number = strtol(s, &endptr, 10);
+            if (*s == 0 || *endptr != 0) {
+                LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
+                           "Invalid serial port number: %s", s);
+                return -1;
+            }
+            ret = store_serial_port_info(qmp, chardev, port_number);
+            if (ret) {
+                LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR,
+                                 "Failed to store serial port information"
+                                 " in xenstore");
+                return ret;
+            }
+        }
+    };
+
+    return ret;
+}
+
+static int qmp_capabilities_callback(libxl__qmp_handler *qmp,
+                                     const libxl__json_object *o)
+{
+    qmp->connected = true;
+
+    return 0;
+}
+
+/*
+ * QMP commands
+ */
+
+static int enable_qmp_capabilities(libxl__qmp_handler *qmp)
+{
+    return qmp_send(qmp, "qmp_capabilities", qmp_capabilities_callback);
+}
+
+/*
+ * Helpers
+ */
+
+static libxl__qmp_message_type qmp_response_type(libxl__qmp_handler *qmp,
+                                                 const libxl__json_object *o)
+{
+    libxl__qmp_message_type type;
+    libxl__json_map_node *node = NULL;
+    int i = 0;
+
+    for (i = 0; (node = libxl__json_map_node_get(o, i)); i++) {
+        if (libxl__qmp_message_type_from_string(node->map_key, &type) == 0)
+            return type;
+    }
+
+    return LIBXL__QMP_MESSAGE_TYPE_INVALID;
+}
+
+static callback_id_pair *qmp_get_callback_from_id(libxl__qmp_handler *qmp,
+                                                  const libxl__json_object *o)
+{
+    const libxl__json_object *id_object = libxl__json_map_get("id", o,
+                                                              JSON_INTEGER);
+    int id = -1;
+    callback_id_pair *pp = NULL;
+
+    if (id_object) {
+        id = libxl__json_object_get_integer(id_object);
+
+        SIMPLEQ_FOREACH(pp, &qmp->callback_list, next) {
+            if (pp->id == id) {
+                return pp;
+            }
+        }
+    }
+    return NULL;
+}
+
+static void qmp_handle_error_response(libxl__qmp_handler *qmp,
+                                      const libxl__json_object *resp)
+{
+    callback_id_pair *pp = qmp_get_callback_from_id(qmp, resp);
+
+    resp = libxl__json_map_get("error", resp, JSON_MAP);
+    resp = libxl__json_map_get("desc", resp, JSON_STRING);
+
+    if (pp) {
+        pp->callback(qmp, NULL);
+        if (pp->id == qmp->wait_for_id) {
+            /* tell that the id have been processed */
+            qmp->wait_for_id = 0;
+        }
+        SIMPLEQ_REMOVE(&qmp->callback_list, pp, callback_id_pair, next);
+        free(pp);
+    }
+
+    LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
+               "received an error message from QMP server: %s",
+               libxl__json_object_get_string(resp));
+}
+
+static int qmp_handle_response(libxl__qmp_handler *qmp,
+                               const libxl__json_object *resp)
+{
+    libxl__qmp_message_type type = LIBXL__QMP_MESSAGE_TYPE_INVALID;
+
+    type = qmp_response_type(qmp, resp);
+    LIBXL__LOG(qmp->ctx, LIBXL__LOG_DEBUG,
+               "message type: %s", libxl__qmp_message_type_to_string(type));
+
+    switch (type) {
+    case LIBXL__QMP_MESSAGE_TYPE_QMP:
+        /* On the greeting message from the server, enable QMP capabilities */
+        enable_qmp_capabilities(qmp);
+        break;
+    case LIBXL__QMP_MESSAGE_TYPE_RETURN: {
+        callback_id_pair *pp = qmp_get_callback_from_id(qmp, resp);
+
+        if (pp) {
+            pp->callback(qmp,
+                         libxl__json_map_get("return", resp, JSON_ANY));
+            if (pp->id == qmp->wait_for_id) {
+                /* tell that the id have been processed */
+                qmp->wait_for_id = 0;
+            }
+            SIMPLEQ_REMOVE(&qmp->callback_list, pp, callback_id_pair, next);
+            free(pp);
+        }
+        break;
+    }
+    case LIBXL__QMP_MESSAGE_TYPE_ERROR:
+        qmp_handle_error_response(qmp, resp);
+        break;
+    case LIBXL__QMP_MESSAGE_TYPE_EVENT:
+        break;
+    case LIBXL__QMP_MESSAGE_TYPE_INVALID:
+        return -1;
+    }
+    return 0;
+}
+
+/*
+ * Handler functions
+ */
+
+static libxl__qmp_handler *qmp_init_handler(libxl_ctx *ctx, uint32_t domid)
+{
+    libxl__qmp_handler *qmp = NULL;
+
+    qmp = calloc(1, sizeof (libxl__qmp_handler));
+    if (qmp == NULL) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                         "Failed to allocate qmp_handler");
+        return NULL;
+    }
+    qmp->ctx = ctx;
+    qmp->domid = domid;
+    qmp->timeout = 5;
+
+    SIMPLEQ_INIT(&qmp->callback_list);
+
+    return qmp;
+}
+
+static int qmp_open(libxl__qmp_handler *qmp, const char *qmp_socket_path,
+                    int timeout)
+{
+    int ret;
+    int flags = 0;
+    int i = 0;
+
+    qmp->qmp_fd = socket(AF_UNIX, SOCK_STREAM, 0);
+    if (qmp->qmp_fd < 0) {
+        return -1;
+    }
+    if ((flags = fcntl(qmp->qmp_fd, F_GETFL)) == 1) {
+        flags = 0;
+    }
+    if (fcntl(qmp->qmp_fd, F_SETFL, flags | O_NONBLOCK) == -1) {
+        return -1;
+    }
+
+    memset(&qmp->addr, 0, sizeof (&qmp->addr));
+    qmp->addr.sun_family = AF_UNIX;
+    strncpy(qmp->addr.sun_path, qmp_socket_path,
+            sizeof (qmp->addr.sun_path));
+
+    do {
+        ret = connect(qmp->qmp_fd, (struct sockaddr *) &qmp->addr,
+                      sizeof (qmp->addr));
+        if (ret == 0)
+            break;
+        if (errno == ENOENT || errno == ECONNREFUSED) {
+            /* ENOENT       : Socket may not have shown up yet
+             * ECONNREFUSED : Leftover socket hasn't been removed yet */
+            continue;
+        }
+        return -1;
+    } while ((++i / 5 <= timeout) && (usleep(200 * 1000) <= 0));
+
+    return ret;
+}
+
+static void qmp_close(libxl__qmp_handler *qmp)
+{
+    callback_id_pair *pp = NULL;
+    callback_id_pair *tmp = NULL;
+
+    close(qmp->qmp_fd);
+    SIMPLEQ_FOREACH(pp, &qmp->callback_list, next) {
+        if (tmp)
+            free(tmp);
+        tmp = pp;
+    }
+    if (tmp)
+        free(tmp);
+}
+
+static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp)
+{
+    ssize_t rd;
+    char *s = NULL;
+    char *s_end = NULL;
+
+    char *incomplete = NULL;
+    size_t incomplete_size = 0;
+
+    do {
+        fd_set rfds;
+        int ret = 0;
+        struct timeval timeout = {
+            .tv_sec = qmp->timeout,
+            .tv_usec = 0,
+        };
+
+        FD_ZERO(&rfds);
+        FD_SET(qmp->qmp_fd, &rfds);
+
+        ret = select(qmp->qmp_fd + 1, &rfds, NULL, NULL, &timeout);
+        if (ret == 0) {
+            LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, "timeout");
+            return -1;
+        } else if (ret < 0) {
+            LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, "Select error");
+            return -1;
+        }
+
+        rd = read(qmp->qmp_fd, qmp->buffer, QMP_RECEIVE_BUFFER_SIZE);
+        if (rd == 0) {
+            continue;
+        } else if (rd < 0) {
+            LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, "Socket read error");
+            return rd;
+        }
+
+        DEBUG_REPORT_RECEIVED(qmp->buffer, rd);
+
+        do {
+            char *end = NULL;
+            if (incomplete) {
+                size_t current_pos = s - incomplete;
+                incomplete_size += rd;
+                incomplete = libxl__realloc(gc, incomplete,
+                                            incomplete_size + 1);
+                incomplete = strncat(incomplete, qmp->buffer, rd);
+                s = incomplete + current_pos;
+                s_end = incomplete + incomplete_size;
+            } else {
+                incomplete = libxl__strndup(gc, qmp->buffer, rd);
+                incomplete_size = rd;
+                s = incomplete;
+                s_end = s + rd;
+            }
+
+            end = strstr(s, "\r\n");
+            if (end) {
+                libxl__json_object *o = NULL;
+
+                *end = '\0';
+
+                o = libxl__json_parse(gc, s);
+                s = end + 2;
+
+                if (o) {
+                    qmp_handle_response(qmp, o);
+                    libxl__json_object_free(gc, o);
+                } else {
+                    LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
+                               "Parse error of : %s\n", s);
+                    return -1;
+                }
+            } else {
+                break;
+            }
+        } while (s < s_end);
+   } while (s < s_end);
+
+    return 1;
+}
+
+static int qmp_send(libxl__qmp_handler *qmp,
+                    const char *cmd, qmp_callback_t callback)
+{
+    yajl_gen_config conf = { 0, NULL };
+    const unsigned char *buf;
+    unsigned int len = 0;
+    yajl_gen_status s;
+    yajl_gen hand;
+
+    hand = yajl_gen_alloc(&conf, NULL);
+    if (!hand) {
+        return -1;
+    }
+
+    yajl_gen_map_open(hand);
+    libxl__yajl_gen_asciiz(hand, "execute");
+    libxl__yajl_gen_asciiz(hand, cmd);
+    libxl__yajl_gen_asciiz(hand, "id");
+    yajl_gen_integer(hand, ++qmp->last_id_used);
+    yajl_gen_map_close(hand);
+
+    s = yajl_gen_get_buf(hand, &buf, &len);
+
+    if (s) {
+        LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
+                   "Failed to generate a qmp command");
+        return -1;
+    }
+
+    if (callback) {
+        callback_id_pair *elm = malloc(sizeof (callback_id_pair));
+        if (elm == NULL) {
+            LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR,
+                             "Failed to allocate a QMP callback");
+            yajl_gen_free(hand);
+            return -1;
+        }
+        elm->id = qmp->last_id_used;
+        elm->callback = callback;
+        SIMPLEQ_INSERT_TAIL(&qmp->callback_list, elm, next);
+    }
+
+    LIBXL__LOG(qmp->ctx, LIBXL__LOG_DEBUG, "next qmp command: '%s'", buf);
+
+    if (libxl_write_exactly(qmp->ctx, qmp->qmp_fd, buf, len,
+                            "QMP command", "QMP socket"))
+        goto error;
+    if (libxl_write_exactly(qmp->ctx, qmp->qmp_fd, "\r\n", 2,
+                            "CRLF", "QMP socket"))
+        goto error;
+
+    yajl_gen_free(hand);
+
+    return qmp->last_id_used;
+
+error:
+    yajl_gen_free(hand);
+    return -1;
+}
+
+static int qmp_synchronous_send(libxl__qmp_handler *qmp, const char *cmd,
+                                qmp_callback_t callback, int ask_timeout)
+{
+    int id = 0;
+    int ret = 0;
+    libxl__gc gc = LIBXL_INIT_GC(qmp->ctx);
+
+    id = qmp_send(qmp, cmd, callback);
+    if (id <= 0) {
+        return -1;
+    }
+    qmp->wait_for_id = id;
+
+    while (qmp->wait_for_id == id) {
+        if ((ret = qmp_next(&gc, qmp)) < 0) {
+            return ret;
+        }
+    }
+
+    libxl__free_all(&gc);
+
+    return 0;
+}
+
+static void qmp_free_handler(libxl__qmp_handler *qmp)
+{
+    free(qmp);
+}
+
+/*
+ * API
+ */
+
+libxl__qmp_handler *libxl__qmp_initialize(libxl_ctx *ctx, uint32_t domid)
+{
+    int ret = 0;
+    libxl__qmp_handler *qmp = NULL;
+    char *qmp_socket;
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+
+    qmp = qmp_init_handler(ctx, domid);
+
+    qmp_socket = libxl__sprintf(&gc, "%s/qmp-libxl-%d",
+                                libxl_run_dir_path(), domid);
+    if ((ret = qmp_open(qmp, qmp_socket, QMP_SOCKET_CONNECT_TIMEOUT)) < 0) {
+        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Connection error");
+        libxl__free_all(&gc);
+        qmp_free_handler(qmp);
+        return NULL;
+    }
+
+    LIBXL__LOG(qmp->ctx, LIBXL__LOG_DEBUG, "connected to %s", qmp_socket);
+
+    /* Wait for the response to qmp_capabilities */
+    while (!qmp->connected) {
+        if ((ret = qmp_next(&gc, qmp)) < 0) {
+            break;
+        }
+    }
+
+    libxl__free_all(&gc);
+    if (!qmp->connected) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to connect to QMP");
+        libxl__qmp_close(qmp);
+        return NULL;
+    }
+    return qmp;
+}
+
+void libxl__qmp_close(libxl__qmp_handler *qmp)
+{
+    if (!qmp)
+        return;
+    qmp_close(qmp);
+    qmp_free_handler(qmp);
+}
+
+void libxl__qmp_cleanup(libxl__gc *gc, uint32_t domid)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    char *qmp_socket;
+
+    qmp_socket = libxl__sprintf(gc, "%s/qmp-libxl-%d",
+                                libxl_run_dir_path(), domid);
+    if (unlink(qmp_socket) == -1) {
+        if (errno != ENOENT) {
+            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+                             "Failed to remove QMP socket file %s",
+                             qmp_socket);
+        }
+    }
+}
+
+int libxl__qmp_query_serial(libxl__qmp_handler *qmp)
+{
+    return qmp_synchronous_send(qmp, "query-chardev",
+                                register_serials_chardev_callback,
+                                qmp->timeout);
+}
+
+int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid)
+{
+    libxl__qmp_handler *qmp = NULL;
+    int ret = 0;
+
+    qmp = libxl__qmp_initialize(ctx, domid);
+    if (!qmp)
+        return -1;
+    ret = libxl__qmp_query_serial(qmp);
+    libxl__qmp_close(qmp);
+    return ret;
+}

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:34:50 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:34:50 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pPe-0005w4-HA; Fri, 30 Sep 2011 19:34:50 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pOC-0005MA-En
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1317436397!29743191!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1566 invoked from network); 1 Oct 2011 02:33:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:33:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO9-0001JB-4y
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:17 +0100
Message-Id: <E1R9pO9-0001JB-4y@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:16 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IRQ Cleanup: rename
	nr_ioapic_registers to nr_ioapic_entries
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1317413674 -3600
# Node ID a50da1a6423fc4cbbefe9ff391b5aab668170044
# Parent  e78cd03b0308c3ba5737ba9821bf7272f45549ca
IRQ Cleanup: rename nr_ioapic_registers to nr_ioapic_entries

The name "nr_ioapic_registers" is wrong and actively misleading.  The
variable holds the number of redirection entries for each apic, which
is two registers fewer than the total number of registers.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r e78cd03b0308 -r a50da1a6423f xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Thu Sep 29 16:31:24 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Fri Sep 30 21:14:34 2011 +0100
@@ -56,7 +56,7 @@
 /*
  * # of IRQ routing registers
  */
-int __read_mostly nr_ioapic_registers[MAX_IO_APICS];
+int __read_mostly nr_ioapic_entries[MAX_IO_APICS];
 int __read_mostly nr_ioapics;
 
 /*
@@ -147,7 +147,7 @@
     for (apic = 0; apic < nr_ioapics; apic++) {
         ioapic_entries[apic] =
             xmalloc_array(struct IO_APIC_route_entry,
-                          nr_ioapic_registers[apic]);
+                          nr_ioapic_entries[apic]);
         if (!ioapic_entries[apic])
             goto nomem;
     }
@@ -243,7 +243,7 @@
         if ( pin == -1 )
         {
             unsigned int p;
-            for ( p = 0; p < nr_ioapic_registers[apic]; ++p )
+            for ( p = 0; p < nr_ioapic_entries[apic]; ++p )
             {
                 entry = __ioapic_read_entry(apic, p, TRUE);
                 if ( entry.vector == vector )
@@ -326,7 +326,7 @@
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
-        for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
+        for (pin = 0; pin < nr_ioapic_entries[apic]; pin++)
 	    ioapic_entries[apic][pin] = __ioapic_read_entry(apic, pin, 1);
     }
 
@@ -347,7 +347,7 @@
         if (!ioapic_entries[apic])
             break;
 
-        for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
+        for (pin = 0; pin < nr_ioapic_entries[apic]; pin++) {
             struct IO_APIC_route_entry entry;
 
             entry = ioapic_entries[apic][pin];
@@ -374,7 +374,7 @@
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
-        for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
+        for (pin = 0; pin < nr_ioapic_entries[apic]; pin++)
 	    ioapic_write_entry(apic, pin, 1, ioapic_entries[apic][pin]);
     }
 
@@ -522,7 +522,7 @@
     int apic, pin;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
-        for (pin = 0; pin < nr_ioapic_registers[apic]; pin++)
+        for (pin = 0; pin < nr_ioapic_entries[apic]; pin++)
             clear_IO_APIC_pin(apic, pin);
     }
 }
@@ -783,7 +783,7 @@
         return;
 
     for (ioapic = 0; ioapic < nr_ioapics; ioapic++) {
-        for (pin = 0; pin < nr_ioapic_registers[ioapic]; pin++) {
+        for (pin = 0; pin < nr_ioapic_entries[ioapic]; pin++) {
             irq_entry = find_irq_entry(ioapic, pin, mp_INT);
             if (irq_entry == -1)
                 continue;
@@ -1029,7 +1029,7 @@
          */
         i = irq = 0;
         while (i < apic)
-            irq += nr_ioapic_registers[i++];
+            irq += nr_ioapic_entries[i++];
         irq += pin;
         break;
     }
@@ -1049,7 +1049,7 @@
     int apic, idx, pin;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
-        for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
+        for (pin = 0; pin < nr_ioapic_entries[apic]; pin++) {
             idx = find_irq_entry(apic,pin,mp_INT);
             if ((idx != -1) && (irq == pin_2_irq(idx,apic,pin)))
                 return irq_trigger(idx);
@@ -1090,7 +1090,7 @@
     apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n");
 
     for (apic = 0; apic < nr_ioapics; apic++) {
-        for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
+        for (pin = 0; pin < nr_ioapic_entries[apic]; pin++) {
 
             /*
              * add it to the IO-APIC irq-routing table:
@@ -1216,7 +1216,7 @@
     printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
     for (i = 0; i < nr_ioapics; i++)
         printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n",
-               mp_ioapics[i].mpc_apicid, nr_ioapic_registers[i]);
+               mp_ioapics[i].mpc_apicid, nr_ioapic_entries[i]);
 
     /*
      * We are a bit conservative about what we expect.  We have to
@@ -1376,7 +1376,7 @@
     for(apic = 0; apic < nr_ioapics; apic++) {
         int pin;
         /* See if any of the pins is in ExtINT mode */
-        for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
+        for (pin = 0; pin < nr_ioapic_entries[apic]; pin++) {
             struct IO_APIC_route_entry entry = ioapic_read_entry(apic, pin, 0);
 
             /* If the interrupt line is enabled and in ExtInt mode
@@ -2114,7 +2114,7 @@
     int i, nr_entry = 0;
 
     for (i = 0; i < nr_ioapics; i++)
-        nr_entry += nr_ioapic_registers[i];
+        nr_entry += nr_ioapic_entries[i];
 
     ioapic_pm_state = _xmalloc(sizeof(struct IO_APIC_route_entry)*nr_entry,
                                sizeof(struct IO_APIC_route_entry));
@@ -2156,7 +2156,7 @@
 
     spin_lock_irqsave(&ioapic_lock, flags);
     for (apic = 0; apic < nr_ioapics; apic++) {
-        for (i = 0; i < nr_ioapic_registers[apic]; i ++, entry ++ ) {
+        for (i = 0; i < nr_ioapic_entries[apic]; i ++, entry ++ ) {
             *(((int *)entry) + 1) = __io_apic_read(apic, 0x11 + 2 * i);
             *(((int *)entry) + 0) = __io_apic_read(apic, 0x10 + 2 * i);
         }
@@ -2178,7 +2178,7 @@
             reg_00.bits.ID = mp_ioapics[apic].mpc_apicid;
             __io_apic_write(apic, 0, reg_00.raw);
         }
-        for (i = 0; i < nr_ioapic_registers[apic]; i++, entry++) {
+        for (i = 0; i < nr_ioapic_entries[apic]; i++, entry++) {
             __io_apic_write(apic, 0x11+2*i, *(((int *)entry)+1));
             __io_apic_write(apic, 0x10+2*i, *(((int *)entry)+0));
         }
@@ -2605,8 +2605,8 @@
         {
             /* The number of IO-APIC IRQ registers (== #pins): */
             reg_01.raw = io_apic_read(i, 1);
-            nr_ioapic_registers[i] = reg_01.bits.entries + 1;
-            nr_irqs_gsi += nr_ioapic_registers[i];
+            nr_ioapic_entries[i] = reg_01.bits.entries + 1;
+            nr_irqs_gsi += nr_ioapic_entries[i];
         }
     }
 
diff -r e78cd03b0308 -r a50da1a6423f xen/drivers/passthrough/amd/iommu_intr.c
--- a/xen/drivers/passthrough/amd/iommu_intr.c	Thu Sep 29 16:31:24 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_intr.c	Fri Sep 30 21:14:34 2011 +0100
@@ -165,7 +165,7 @@
     /* Read ioapic entries and update interrupt remapping table accordingly */
     for ( apic = 0; apic < nr_ioapics; apic++ )
     {
-        for ( pin = 0; pin < nr_ioapic_registers[apic]; pin++ )
+        for ( pin = 0; pin < nr_ioapic_entries[apic]; pin++ )
         {
             *(((int *)&rte) + 1) = io_apic_read(apic, 0x11 + 2 * pin);
             *(((int *)&rte) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
diff -r e78cd03b0308 -r a50da1a6423f xen/drivers/passthrough/vtd/intremap.c
--- a/xen/drivers/passthrough/vtd/intremap.c	Thu Sep 29 16:31:24 2011 +0100
+++ b/xen/drivers/passthrough/vtd/intremap.c	Fri Sep 30 21:14:34 2011 +0100
@@ -33,7 +33,7 @@
 
 #ifdef __ia64__
 #define nr_ioapics              iosapic_get_nr_iosapics()
-#define nr_ioapic_registers(i)  iosapic_get_nr_pins(i)
+#define nr_ioapic_entries(i)  iosapic_get_nr_pins(i)
 #define __io_apic_read(apic, reg) \
     (*IO_APIC_BASE(apic) = reg, *(IO_APIC_BASE(apic)+4))
 #define __io_apic_write(apic, reg, val) \
@@ -53,7 +53,7 @@
 #else
 #include <asm/apic.h>
 #include <asm/io_apic.h>
-#define nr_ioapic_registers(i)  nr_ioapic_registers[i]
+#define nr_ioapic_entries(i)  nr_ioapic_entries[i]
 #endif
 
 /*
@@ -91,7 +91,7 @@
 
     nr_pins = 0;
     for ( i = 0; i < nr_ioapics; i++ )
-        nr_pins += nr_ioapic_registers(i);
+        nr_pins += nr_ioapic_entries(i);
 
     _apic_pin_2_ir_idx = xmalloc_array(int, nr_pins);
     apic_pin_2_ir_idx = xmalloc_array(int *, nr_ioapics);
@@ -109,7 +109,7 @@
     for ( i = 0; i < nr_ioapics; i++ )
     {
         apic_pin_2_ir_idx[i] = &_apic_pin_2_ir_idx[nr_pins];
-        nr_pins += nr_ioapic_registers(i);
+        nr_pins += nr_ioapic_entries(i);
     }
 
     return 0;
diff -r e78cd03b0308 -r a50da1a6423f xen/include/asm-x86/io_apic.h
--- a/xen/include/asm-x86/io_apic.h	Thu Sep 29 16:31:24 2011 +0100
+++ b/xen/include/asm-x86/io_apic.h	Fri Sep 30 21:14:34 2011 +0100
@@ -77,7 +77,7 @@
  * # of IO-APICs and # of IRQ routing registers
  */
 extern int nr_ioapics;
-extern int nr_ioapic_registers[MAX_IO_APICS];
+extern int nr_ioapic_entries[MAX_IO_APICS];
 
 enum ioapic_irq_destination_types {
 	dest_Fixed = 0,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:35:00 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:35:00 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pPo-0005zV-JP; Fri, 30 Sep 2011 19:35:00 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pOC-0005MS-Ta
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1317436397!15462525!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14670 invoked from network); 1 Oct 2011 02:33:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:33:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pO9-0001Jw-Nq
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:17 +0100
Message-Id: <E1R9pO9-0001Jw-Nq@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:17 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] 
	[xen-unstable] x86, irq: Clean up __clear_irq_vector
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1317413721 -3600
# Node ID d568e2313fd6f055b66a6c3cb2bca6372b77692e
# Parent  a50da1a6423fc4cbbefe9ff391b5aab668170044
x86,irq: Clean up __clear_irq_vector

Fix and clean up the logic to __clear_irq_vector().

We always need to clear the things related to cfg->vector.

If the IRQ is currently in motion, then we need to also clear
out things related to cfg->old_vector.

This patch reorganizes the function to make the parallels between
the two clean-ups more obvious.

The main functional change here is with cfg->used_vectors; make
sure to clear cfg->vector always (even if !cfg->move_in_progress);
if cfg->move_in_progress, clear cfg->old_vector as well.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r a50da1a6423f -r d568e2313fd6 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Fri Sep 30 21:14:34 2011 +0100
+++ b/xen/arch/x86/irq.c	Fri Sep 30 21:15:21 2011 +0100
@@ -211,33 +211,23 @@
 
 static void __clear_irq_vector(int irq)
 {
-    int cpu, vector;
+    int cpu, vector, old_vector;
     cpumask_t tmp_mask;
     struct irq_cfg *cfg = irq_cfg(irq);
 
     BUG_ON(!cfg->vector);
 
+    /* Always clear cfg->vector */
     vector = cfg->vector;
     cpus_and(tmp_mask, cfg->cpu_mask, cpu_online_map);
 
-    trace_irq_mask(TRC_HW_IRQ_CLEAR_VECTOR, irq, vector, &tmp_mask);
-
-    for_each_cpu_mask(cpu, tmp_mask)
+    for_each_cpu_mask(cpu, tmp_mask) {
+        ASSERT( per_cpu(vector_irq, cpu)[vector] == irq );
         per_cpu(vector_irq, cpu)[vector] = -1;
+    }
 
     cfg->vector = IRQ_VECTOR_UNASSIGNED;
     cpus_clear(cfg->cpu_mask);
-    cfg->used = IRQ_UNUSED;
-
-    if (likely(!cfg->move_in_progress))
-        return;
-
-    cpus_and(tmp_mask, cfg->old_cpu_mask, cpu_online_map);
-    for_each_cpu_mask(cpu, tmp_mask) {
-        ASSERT( per_cpu(vector_irq, cpu)[cfg->old_vector] == irq );
-        TRACE_3D(TRC_HW_IRQ_MOVE_FINISH, irq, vector, cpu);
-        per_cpu(vector_irq, cpu)[cfg->old_vector] = -1;
-     }
 
     if ( cfg->used_vectors )
     {
@@ -245,9 +235,33 @@
         clear_bit(vector, cfg->used_vectors);
     }
 
-    cfg->move_in_progress = 0;
+    cfg->used = IRQ_UNUSED;
+
+    trace_irq_mask(TRC_HW_IRQ_CLEAR_VECTOR, irq, vector, &tmp_mask);
+
+    if (likely(!cfg->move_in_progress))
+        return;
+
+    /* If we were in motion, also clear cfg->old_vector */
+    old_vector = cfg->old_vector;
+    cpus_and(tmp_mask, cfg->old_cpu_mask, cpu_online_map);
+
+    for_each_cpu_mask(cpu, tmp_mask) {
+        ASSERT( per_cpu(vector_irq, cpu)[old_vector] == irq );
+        TRACE_3D(TRC_HW_IRQ_MOVE_FINISH, irq, old_vector, cpu);
+        per_cpu(vector_irq, cpu)[old_vector] = -1;
+     }
+
     cfg->old_vector = IRQ_VECTOR_UNASSIGNED;
     cpus_clear(cfg->old_cpu_mask);
+
+    if ( cfg->used_vectors )
+    {
+        ASSERT(test_bit(old_vector, cfg->used_vectors));
+        clear_bit(old_vector, cfg->used_vectors);
+    }
+
+    cfg->move_in_progress = 0;
 }
 
 void clear_irq_vector(int irq)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:35:13 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:35:13 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pQ1-00064L-7J; Fri, 30 Sep 2011 19:35:13 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pOI-0005O3-Kj
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1317436403!12633347!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6966 invoked from network); 1 Oct 2011 02:33:23 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:33:23 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pOF-0001Kf-Iv
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:23 +0100
Message-Id: <E1R9pOF-0001Kf-Iv@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:17 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] X86 MCE: Prevent malicious guest
	access broken page again
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1317413803 -3600
# Node ID 2215d7d7382617adbe97831fe35752a027917d1d
# Parent  d568e2313fd6f055b66a6c3cb2bca6372b77692e
X86 MCE: Prevent malicious guest access broken page again

To avoid recursive mce.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r d568e2313fd6 -r 2215d7d73826 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Fri Sep 30 21:15:21 2011 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Fri Sep 30 21:16:43 2011 +0100
@@ -657,6 +657,8 @@
     /* This is free page */
     if (status & PG_OFFLINE_OFFLINED)
         *result = MCER_RECOVERED;
+    else if (status & PG_OFFLINE_AGAIN)
+        *result = MCER_CONTINUE;
     else if (status & PG_OFFLINE_PENDING) {
         /* This page has owner */
         if (status & PG_OFFLINE_OWNED) {
diff -r d568e2313fd6 -r 2215d7d73826 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c	Fri Sep 30 21:15:21 2011 +0100
+++ b/xen/common/page_alloc.c	Fri Sep 30 21:16:43 2011 +0100
@@ -38,6 +38,7 @@
 #include <xen/tmem.h>
 #include <xen/tmem_xen.h>
 #include <public/sysctl.h>
+#include <public/sched.h>
 #include <asm/page.h>
 #include <asm/numa.h>
 #include <asm/flushtlb.h>
@@ -708,6 +709,19 @@
         return -EINVAL;
     }
 
+    /*
+     * NB. When broken page belong to guest, usually hypervisor will
+     * notify the guest to handle the broken page. However, hypervisor
+     * need to prevent malicious guest access the broken page again.
+     * Under such case, hypervisor shutdown guest, preventing recursive mce.
+     */
+    if ( (pg->count_info & PGC_broken) && (owner = page_get_owner(pg)) )
+    {
+        *status = PG_OFFLINE_AGAIN;
+        domain_shutdown(owner, SHUTDOWN_crash);
+        return 0;
+    }
+
     spin_lock(&heap_lock);
 
     old_info = mark_page_offline(pg, broken);
diff -r d568e2313fd6 -r 2215d7d73826 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h	Fri Sep 30 21:15:21 2011 +0100
+++ b/xen/include/public/sysctl.h	Fri Sep 30 21:16:43 2011 +0100
@@ -399,6 +399,7 @@
 #define PG_OFFLINE_OFFLINED  (0x1UL << 1)
 #define PG_OFFLINE_PENDING   (0x1UL << 2)
 #define PG_OFFLINE_FAILED    (0x1UL << 3)
+#define PG_OFFLINE_AGAIN     (0x1UL << 4)
 
 #define PG_ONLINE_FAILED     PG_OFFLINE_FAILED
 #define PG_ONLINE_ONLINED    PG_OFFLINE_OFFLINED

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

From xen-changelog-bounces@lists.xensource.com Fri Sep 30 19:35:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 30 Sep 2011 19:35:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1R9pQ6-00067J-Uj; Fri, 30 Sep 2011 19:35:18 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1R9pOJ-0005OF-3i
	for xen-changelog@lists.xensource.com; Fri, 30 Sep 2011 19:33:27 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1317436382!37956577!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26386 invoked from network); 1 Oct 2011 02:33:02 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Oct 2011 02:33:02 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1R9pOG-0001QL-4C
	for xen-changelog@lists.xensource.com; Sat, 01 Oct 2011 03:33:24 +0100
Message-Id: <E1R9pOG-0001QL-4C@xenbits.xen.org>
Date: Sat, 01 Oct 2011 03:33:23 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] build: fix grep invocation in
	cc-options
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1317413867 -3600
# Node ID 3d1664cc9e458809e399320204aca8536e401ee1
# Parent  2215d7d7382617adbe97831fe35752a027917d1d
build: fix grep invocation in cc-options

Currently the build produces lots of
        Usage: grep [OPTION]... PATTERN [FILE]...
        Try `grep --help' for more information.

This is due to the "grep -- $(2)" in cc-options. It seems that the
default of reading stdin is disabled when using "--". I don't know if
this is a bug in grep or how it is supposed to be but we can work
around it by explicitly passing in "-"

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 2215d7d73826 -r 3d1664cc9e45 Config.mk
--- a/Config.mk	Fri Sep 30 21:16:43 2011 +0100
+++ b/Config.mk	Fri Sep 30 21:17:47 2011 +0100
@@ -84,7 +84,7 @@
 #
 # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
 cc-option = $(shell if test -z "`echo 'void*p=1;' | \
-              $(1) $(2) -S -o /dev/null -xc - 2>&1 | grep -- $(2)`"; \
+              $(1) $(2) -S -o /dev/null -xc - 2>&1 | grep -- $(2) -`"; \
               then echo "$(2)"; else echo "$(3)"; fi ;)
 
 # cc-option-add: Add an option to compilation flags, but only if supported.

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

