[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86/HPET: cache MSI message last written


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Thu, 25 Oct 2012 21:55:10 +0000
  • Delivery-date: Thu, 25 Oct 2012 21:55:19 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1351167968 -7200
# Node ID 5fb601e96d0fcabfd19605aa7a314cbb3d321e7d
# Parent  a89f1299b134bbcd969b6e7b193a6b2b17dd10cd
x86/HPET: cache MSI message last written

Rather than spending measurable amounts of time reading back the most
recently written message, cache it in space previously unused, and thus
accelerate the CPU's entering of the intended C-state.

hpet_msi_read() ends up being unused after this change, but rather than
removing the function, it's being marked "unused" in order - that way
it can easily get used again should a new need for it arise.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---


diff -r a89f1299b134 -r 5fb601e96d0f xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Thu Oct 25 14:24:55 2012 +0200
+++ b/xen/arch/x86/hpet.c       Thu Oct 25 14:26:08 2012 +0200
@@ -253,17 +253,19 @@ static void hpet_msi_mask(struct irq_des
 
 static void hpet_msi_write(struct hpet_event_channel *ch, struct msi_msg *msg)
 {
+    ch->msi.msg = *msg;
     if ( iommu_intremap )
         iommu_update_ire_from_msi(&ch->msi, msg);
     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(struct hpet_event_channel *ch, struct msi_msg *msg)
+static void __maybe_unused
+hpet_msi_read(struct hpet_event_channel *ch, struct msi_msg *msg)
 {
     msg->data = hpet_read32(HPET_Tn_ROUTE(ch->idx));
     msg->address_lo = hpet_read32(HPET_Tn_ROUTE(ch->idx) + 4);
-    msg->address_hi = 0;
+    msg->address_hi = MSI_ADDR_BASE_HI;
     if ( iommu_intremap )
         iommu_read_msi_from_ire(&ch->msi, msg);
 }
@@ -285,20 +287,19 @@ static void hpet_msi_ack(struct irq_desc
 
 static void hpet_msi_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
 {
-    struct msi_msg msg;
-    unsigned int dest;
+    struct hpet_event_channel *ch = desc->action->dev_id;
+    struct msi_msg msg = ch->msi.msg;
 
-    dest = set_desc_affinity(desc, mask);
-    if (dest == BAD_APICID)
+    msg.dest32 = set_desc_affinity(desc, mask);
+    if ( msg.dest32 == BAD_APICID )
         return;
 
-    hpet_msi_read(desc->action->dev_id, &msg);
     msg.data &= ~MSI_DATA_VECTOR_MASK;
     msg.data |= MSI_DATA_VECTOR(desc->arch.vector);
     msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
-    msg.address_lo |= MSI_ADDR_DEST_ID(dest);
-    msg.dest32 = dest;
-    hpet_msi_write(desc->action->dev_id, &msg);
+    msg.address_lo |= MSI_ADDR_DEST_ID(msg.dest32);
+    if ( msg.data != ch->msi.msg.data || msg.dest32 != ch->msi.msg.dest32 )
+        hpet_msi_write(ch, &msg);
 }
 
 /*

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.