Skip to contentSkip to conversation

VT-d: make remap_entry_to_msi_msg() return consistent message

PATCH In review Jan Beulich 3 participants 4 messages Oct 2, 2012 – Oct 3, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VT-d: make remap_entry_to_msi_msg() return consistent message

During debugging of another problem I found that in x2APIC mode, the destination field of the low address value wasn't passed back correctly. While this is benign in most cases (as the value isn't being used anywhere), it can be confusing (and misguiding) when printing the value read or when comparing it to the one previously passed into the inverse function.

xen/drivers/passthrough/vtd/intremap.c +4 -0
@@ -504,7 +504,11 @@ static int remap_entry_to_msi_msg(
             MSI_ADDR_REDIRECTION_CPU:
             MSI_ADDR_REDIRECTION_LOWPRI);
     if ( x2apic_enabled )
+    {
         msg->dest32 = iremap_entry->lo.dst;
+        msg->address_lo |=
+            (iremap_entry->lo.dst & 0xff) << MSI_ADDR_DEST_ID_SHIFT;
+    }
     else
         msg->address_lo |=
             ((iremap_entry->lo.dst >> 8) & 0xff ) << MSI_ADDR_DEST_ID_SHIFT;

VT-d: make remap_entry_to_msi_msg() return consistent message

During debugging of another problem I found that in x2APIC mode, the destination field of the low address value wasn't passed back correctly. While this is benign in most cases (as the value isn't being used anywhere), it can be confusing (and misguiding) when printing the value read or when comparing it to the one previously passed into the inverse function.

xen/drivers/passthrough/vtd/intremap.c +4 -0
@@ -504,7 +504,11 @@ static int remap_entry_to_msi_msg(
             MSI_ADDR_REDIRECTION_CPU:
             MSI_ADDR_REDIRECTION_LOWPRI);
     if ( x2apic_enabled )
+    {
         msg->dest32 = iremap_entry->lo.dst;
+        msg->address_lo |=
+            (iremap_entry->lo.dst & 0xff) << MSI_ADDR_DEST_ID_SHIFT;
+    }
     else
         msg->address_lo |=
             ((iremap_entry->lo.dst >> 8) & 0xff ) << MSI_ADDR_DEST_ID_SHIFT;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jan Beulich

During debugging of another problem I found that in x2APIC mode, the destination field of the low address value wasn't passed back correctly. While this is benign in most cases (as the value isn't being used anywhere), it can be confusing (and misguiding) when printing the value read or when comparing it to the one previously passed into the inverse function.

Quoted 21 lines
xen/drivers/passthrough/vtd/intremap.c +4 -0
@@ -504,7 +504,11 @@ static int remap_entry_to_msi_msg(
             MSI_ADDR_REDIRECTION_CPU:
             MSI_ADDR_REDIRECTION_LOWPRI);
     if ( x2apic_enabled )
+    {
         msg->dest32 = iremap_entry->lo.dst;
+        msg->address_lo |=
+            (iremap_entry->lo.dst & 0xff) << MSI_ADDR_DEST_ID_SHIFT;
+    }
     else
         msg->address_lo |=
             ((iremap_entry->lo.dst >> 8) & 0xff ) << MSI_ADDR_DEST_ID_SHIFT;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
Quoted 10 lines
Quoted 1 line
Quoted 1 line

Keir Fraser <[email protected]> 10/02/12 7:01 PM >>>

Quoted 7 lines · Jan Beulich

During debugging of another problem I found that in x2APIC mode, the destination field of the low address value wasn't passed back correctly. While this is benign in most cases (as the value isn't being used anywhere), it can be confusing (and misguiding) when printing the value read or when comparing it to the one previously passed into the inverse function.

Quoted 3 lines
Quoted 1 line

Actually on my way home yesterday I realized that this is not consistent, i.e. fails to cover symmetrically the !x2apic case. Therefore, I'd like to adjust this to pull out the msg->dest32 assignment from the conditional. Will that be okay to commit without re-submission?

Jan

Quoted 21 lines
xen/drivers/passthrough/vtd/intremap.c +4 -0
@@ -504,7 +504,11 @@ static int remap_entry_to_msi_msg(
             MSI_ADDR_REDIRECTION_CPU:
             MSI_ADDR_REDIRECTION_LOWPRI);
     if ( x2apic_enabled )
+    {
         msg->dest32 = iremap_entry->lo.dst;
+        msg->address_lo |=
+            (iremap_entry->lo.dst & 0xff) << MSI_ADDR_DEST_ID_SHIFT;
+    }
     else
         msg->address_lo |=
             ((iremap_entry->lo.dst >> 8) & 0xff ) << MSI_ADDR_DEST_ID_SHIFT;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line

Keir Fraser <[email protected]> 10/02/12 7:01 PM >>>

Quoted 8 lines · Jan Beulich

During debugging of another problem I found that in x2APIC mode, the destination field of the low address value wasn't passed back correctly. While this is benign in most cases (as the value isn't being used anywhere), it can be confusing (and misguiding) when printing the value read or when comparing it to the one previously passed into the inverse function.

Quoted 7 lines
Quoted 1 line

Actually on my way home yesterday I realized that this is not consistent, i.e. fails to cover symmetrically the !x2apic case. Therefore, I'd like to adjust this
to pull out the msg->dest32 assignment from the conditional. Will that be okay to commit without re-submission?

Yes, that's fine by me.

-- Keir

Quoted 28 lines

Jan

Quoted 21 lines
xen/drivers/passthrough/vtd/intremap.c +4 -0
@@ -504,7 +504,11 @@ static int remap_entry_to_msi_msg(
             MSI_ADDR_REDIRECTION_CPU:
             MSI_ADDR_REDIRECTION_LOWPRI);
     if ( x2apic_enabled )
+    {
         msg->dest32 = iremap_entry->lo.dst;
+        msg->address_lo |=
+            (iremap_entry->lo.dst & 0xff) << MSI_ADDR_DEST_ID_SHIFT;
+    }
     else
         msg->address_lo |=
             ((iremap_entry->lo.dst >> 8) & 0xff ) << MSI_ADDR_DEST_ID_SHIFT;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel