]> xenbits.xensource.com Git - qemu-xen-4.2-testing.git/commitdiff
passthrough: Fix older kernel assigned device resume failure problem
authorIan Jackson <ian.jackson@eu.citrix.com>
Wed, 22 Apr 2009 15:16:40 +0000 (16:16 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 22 Apr 2009 15:16:40 +0000 (16:16 +0100)
We found when do S3 resume, some older kernel(such as rh5.1)
cmd register might be restored before BAR registers, Since
pt_bar_mapping is done when writing cmd register, it will cause
mapping incorrect address.
It's the root_cause of when doing RH5.1 HVM S3, assigned e1000e
network card fails to resume back. (set pci_power_mgmt=1 in guest
config file, let PM support device enter D3 hot state during guest S3)

we should call pt_bar_mapping in pt_bar_reg_write to avoid this problem
for supporting older kernels.

Signed-off-by: Liping Ke <Liping.Ke@intel.com>
Signed-off-by: Yu Zhao<yu.zhao@intel.com>
Acked-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
hw/pass-through.c

index 710acbfa41c60284466708fb6390d94bc870c318..7bd2febb6919b57244e05a1b332abd475aef32c1 100644 (file)
@@ -3169,6 +3169,15 @@ exit:
     throughable_mask = ~bar_emu_mask & valid_mask;
     *value = PT_MERGE_VALUE(*value, dev_value, throughable_mask);
 
+    /* After BAR reg update, we need to remap BAR*/
+    reg_grp_entry = pt_find_reg_grp(ptdev, PCI_COMMAND);
+    if (reg_grp_entry)
+    {
+        reg_entry = pt_find_reg(reg_grp_entry, PCI_COMMAND);
+        if (reg_entry)
+            pt_bar_mapping(ptdev, reg_entry->data & PCI_COMMAND_IO,
+                                  reg_entry->data & PCI_COMMAND_MEMORY);
+    }
     return 0;
 }