diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2011-04-29 11:05:33 +0200 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2011-05-03 16:16:17 -0300 |
commit | 21cee191882ecd695500da39a9b8245bf18ecceb (patch) | |
tree | 00e0bc9e86b667ae5859da1470e5c5c67965b7c9 | |
parent | d5b727959d40200267a5f8e348f77e2e76e1875e (diff) |
pci-assign: Convert need_emulate_cmd into a bitmask
Define a mask of PCI command register bits that need to be emulated,
i.e. read back from their shadow state. We will need this for
selectively emulating the INTx mask bit.
Note: No initialization of emulate_cmd_mask to zero needed, the device
state is already zero-initialized.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r-- | hw/device-assignment.c | 11 | ||||
-rw-r--r-- | hw/device-assignment.h | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/hw/device-assignment.c b/hw/device-assignment.c index cc81e1e1d..0f7f5aa84 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -522,9 +522,9 @@ again: DEBUG("(%x.%x): address=%04x val=0x%08x len=%d\n", (d->devfn >> 3) & 0x1F, (d->devfn & 0x7), address, val, len); - if (pci_dev->need_emulate_cmd) { + if (pci_dev->emulate_cmd_mask) { val = merge_bits(val, pci_default_read_config(d, address, len), - address, len, PCI_COMMAND, 0xffff); + address, len, PCI_COMMAND, pci_dev->emulate_cmd_mask); } /* @@ -796,10 +796,9 @@ again: /* dealing with virtual function device */ snprintf(name, sizeof(name), "%sphysfn/", dir); - if (!stat(name, &statbuf)) - pci_dev->need_emulate_cmd = 1; - else - pci_dev->need_emulate_cmd = 0; + if (!stat(name, &statbuf)) { + pci_dev->emulate_cmd_mask = 0xffff; + } dev->region_number = r; return 0; diff --git a/hw/device-assignment.h b/hw/device-assignment.h index 86af0a941..ae1bc58cf 100644 --- a/hw/device-assignment.h +++ b/hw/device-assignment.h @@ -109,7 +109,7 @@ typedef struct AssignedDevice { void *msix_table_page; target_phys_addr_t msix_table_addr; int mmio_index; - int need_emulate_cmd; + uint32_t emulate_cmd_mask; char *configfd_name; int32_t bootindex; QLIST_ENTRY(AssignedDevice) next; |