From: Ian Jackson Date: Wed, 22 Apr 2009 15:16:40 +0000 (+0100) Subject: passthrough: Fix older kernel assigned device resume failure problem X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=dbb8aafa702b8b4f5568e08641d98471fd04e0f8;p=xenclient%2Fioemu.git passthrough: Fix older kernel assigned device resume failure problem 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 Signed-off-by: Yu Zhao Acked-by: Yuji Shimada --- diff --git a/hw/pass-through.c b/hw/pass-through.c index 710acbfa..7bd2febb 100644 --- a/hw/pass-through.c +++ b/hw/pass-through.c @@ -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; }