Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 618009 Details for
Bug 849223
RHEL5 Xen SR-IOV VF PCI passthru does not work to RHEL6 HVM guest; no interrupts received on the guest VF
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
qemu-dm debug messages (v3), track "valid" flag too
0001-debug-messages-for-bz849223-print-PCI-BDFs-track-val.patch (text/plain), 13.96 KB, created by
Laszlo Ersek
on 2012-09-27 11:12:55 UTC
(
hide
)
Description:
qemu-dm debug messages (v3), track "valid" flag too
Filename:
MIME Type:
Creator:
Laszlo Ersek
Created:
2012-09-27 11:12:55 UTC
Size:
13.96 KB
patch
obsolete
>From 7e3107368272b68c53cb917ea00447c234eddba4 Mon Sep 17 00:00:00 2001 >From: Laszlo Ersek <lersek@redhat.com> >Date: Wed, 19 Sep 2012 14:49:44 +0200 >Subject: [PATCH] debug messages for bz849223, print PCI BDFs, track valid flag > > >Signed-off-by: Laszlo Ersek <lersek@redhat.com> >--- > tools/ioemu/hw/pass-through.c | 60 ++++++++++++++++++++++++++++++++++++++-- > tools/ioemu/hw/pci.c | 5 +++ > tools/ioemu/hw/piix4acpi.c | 5 +++- > tools/ioemu/hw/pt-msi.c | 35 ++++++++++++++++++++++- > tools/ioemu/vl.c | 2 + > 5 files changed, 101 insertions(+), 6 deletions(-) > >diff --git a/tools/ioemu/hw/pass-through.c b/tools/ioemu/hw/pass-through.c >index 1a18f44..82d1cba 100644 >--- a/tools/ioemu/hw/pass-through.c >+++ b/tools/ioemu/hw/pass-through.c >@@ -755,10 +755,14 @@ static int __insert_to_pci_slot(int bus, int dev, int func, int slot) > { > int i, php_slot; > >+ PT_LOG("1: %02x:%02x.%x slot=%d\n", bus, dev, func, slot); >+ > /* preferred virt pci slot */ > if ( slot >= PHP_SLOT_START && slot < PHP_SLOT_END ) > { > php_slot = PCI_TO_PHP_SLOT(slot); >+ PT_LOG("2: php_slot=%d valid=%d\n", php_slot, >+ dpci_infos.php_devs[php_slot].valid); > if ( !dpci_infos.php_devs[php_slot].valid ) > { > goto found; >@@ -773,6 +777,7 @@ static int __insert_to_pci_slot(int bus, int dev, int func, int slot) > /* slot == 0, pick up a free one */ > for ( i = 0; i < PHP_SLOT_LEN; i++ ) > { >+ PT_LOG("3: i=%d valid=%d\n", i, dpci_infos.php_devs[i].valid); > if ( !dpci_infos.php_devs[i].valid ) > { > php_slot = i; >@@ -784,6 +789,7 @@ static int __insert_to_pci_slot(int bus, int dev, int func, int slot) > return 0; > > found: >+ PT_LOG("4: php_slot=%d setting valid\n", php_slot); > dpci_infos.php_devs[php_slot].valid = 1; > dpci_infos.php_devs[php_slot].r_bus = bus; > dpci_infos.php_devs[php_slot].r_dev = dev; >@@ -799,6 +805,8 @@ int insert_to_pci_slot(char *bdf_slt) > int seg, bus, dev, func, slot; > char *bdf_str, *slt_str, *delim="@"; > >+ PT_LOG("1: bdf_slt='%s'\n", bdf_slt ? bdf_slt : "NULL"); >+ > bdf_str = strsep(&bdf_slt, delim); > slt_str = bdf_slt; > slot = token_value(slt_str); >@@ -808,8 +816,8 @@ int insert_to_pci_slot(char *bdf_slt) > return -1; > } > >+ PT_LOG("2\n"); > return __insert_to_pci_slot(bus, dev, func, slot); >- > } > > /* Test if a pci slot has a device >@@ -821,10 +829,13 @@ int test_pci_slot(int slot) > { > int php_slot; > >+ PT_LOG("1: slot=%d\n", slot); > if ( slot < PHP_SLOT_START || slot >= PHP_SLOT_END ) > return -1; > > php_slot = PCI_TO_PHP_SLOT(slot); >+ PT_LOG("2: php_slot=%d valid=%d\n", php_slot, >+ dpci_infos.php_devs[php_slot].valid); > if ( dpci_infos.php_devs[php_slot].valid ) > return 1; > else >@@ -836,23 +847,31 @@ int bdf_to_slot(char *bdf_str) > { > int seg, bus, dev, func, i; > >+ PT_LOG("1: bdf_str='%s'\n", bdf_str ? bdf_str : "NULL"); > if ( !next_bdf(&bdf_str, &seg, &bus, &dev, &func)) > { > return -1; > } > >+ PT_LOG("2: %04x:%02x:%02x.%x\n", seg, bus, dev, func); >+ > /* locate the virtual pci slot for this VTd device */ > for ( i = 0; i < PHP_SLOT_LEN; i++ ) > { >+ PT_LOG("3: i=%d valid=%d %02x:%02x.%x\n", i, >+ dpci_infos.php_devs[i].valid, dpci_infos.php_devs[i].r_bus, >+ dpci_infos.php_devs[i].r_dev, dpci_infos.php_devs[i].r_func); > if ( dpci_infos.php_devs[i].valid && > dpci_infos.php_devs[i].r_bus == bus && > dpci_infos.php_devs[i].r_dev == dev && > dpci_infos.php_devs[i].r_func == func ) > { >+ PT_LOG("4: found, pci_slot=%d\n", PHP_TO_PCI_SLOT(i)); > return PHP_TO_PCI_SLOT(i); > } > } > >+ PT_LOG("5: not found\n"); > return -1; > } > >@@ -868,6 +887,8 @@ void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size, > assigned_device->bases[i].e_physbase = e_phys; > assigned_device->bases[i].e_size= e_size; > >+ PT_LOG("%02x:%02x.%x\n", pci_bus_num(d->bus), (d->devfn >> 3) & 0x1F, >+ (d->devfn & 0x7)); > PT_LOG("e_phys=%08x maddr=%lx type=%d len=%d index=%d first_map=%d\n", > e_phys, (unsigned long)assigned_device->bases[i].access.maddr, > type, e_size, i, first_map); >@@ -875,8 +896,12 @@ void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size, > if ( e_size == 0 ) > return; > >+ PT_LOG("1\n"); >+ > if ( !first_map && old_ebase != -1 ) > { >+ PT_LOG("2\n"); >+ > add_msix_mapping(assigned_device, i); > /* Remove old mapping */ > ret = xc_domain_memory_mapping(xc_handle, domid, >@@ -891,9 +916,13 @@ void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size, > } > } > >+ PT_LOG("3\n"); >+ > /* map only valid guest address */ > if (e_phys != -1) > { >+ PT_LOG("4\n"); >+ > /* Create new mapping */ > ret = xc_domain_memory_mapping(xc_handle, domid, > assigned_device->bases[i].e_physbase >> XC_PAGE_SHIFT, >@@ -910,8 +939,10 @@ void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size, > if ( ret != 0 ) > PT_LOG("Error: remove MSI-X mmio mapping failed!\n"); > >- if ( old_ebase != e_phys && old_ebase != -1 ) >+ if ( old_ebase != e_phys && old_ebase != -1 ) { >+ PT_LOG("5\n"); > pt_msix_update_remap(assigned_device, i); >+ } > } > } > >@@ -3007,8 +3038,14 @@ static int pt_msixctrl_reg_write(struct pt_dev *ptdev, > uint16_t throughable_mask = 0; > uint16_t old_ctrl = cfg_entry->data; > >+ PT_LOG("%02x:%02x.%x\n", pci_bus_num(ptdev->dev.bus), >+ (ptdev->dev.devfn >> 3) & 0x1F, (ptdev->dev.devfn & 0x7)); >+ > /* modify emulate register */ > writable_mask = reg->emu_mask & ~reg->ro_mask & valid_mask; >+ PT_LOG("emu_mask=%04x ro_mask=%04x valid_mask=%04x writable_mask=%04x\n", >+ reg->emu_mask, reg->ro_mask, valid_mask, writable_mask); >+ PT_LOG("value=%04x dev_value=%04x\n", *value, dev_value); > cfg_entry->data = ((*value & writable_mask) | > (cfg_entry->data & ~writable_mask)); > >@@ -3017,12 +3054,16 @@ static int pt_msixctrl_reg_write(struct pt_dev *ptdev, > /* create value for writing to I/O device register */ > throughable_mask = ~reg->emu_mask & valid_mask; > *value = ((*value & throughable_mask) | (dev_value & ~throughable_mask)); >+ PT_LOG("throughable_mask=%04x new_value=%04x\n", throughable_mask, *value); > > /* update MSI-X */ >- if ((*value & PCI_MSIX_ENABLE) && !(*value & PCI_MSIX_MASK)) >+ if ((*value & PCI_MSIX_ENABLE) && !(*value & PCI_MSIX_MASK)) { >+ PT_LOG("1\n"); > pt_msix_update(ptdev); >+ } > > ptdev->msix->enabled = !!(*value & PCI_MSIX_ENABLE); >+ PT_LOG("msix_enabled=%d\n", ptdev->msix->enabled); > > return 0; > } >@@ -3163,17 +3204,29 @@ int unregister_real_device(int php_slot) > uint32_t bdf = 0; > int rc = -1; > >+ PT_LOG("1: php_slot=%d\n", php_slot); > if ( php_slot < 0 || php_slot >= PHP_SLOT_LEN ) > return -1; > > php_dev = &dpci_infos.php_devs[php_slot]; >+ PT_LOG("2: %02x:%02x.%x\n", php_dev->r_bus, php_dev->r_dev, >+ php_dev->r_func); >+ > assigned_device = php_dev->pt_dev; > >+ PT_LOG("3: assigned_device=%p valid=%d\n", (void*)assigned_device, >+ php_dev->valid); > if ( !assigned_device || !php_dev->valid ) > return -1; > > pci_dev = assigned_device->pci_dev; > >+ PT_LOG("4: %02x:%02x.%x / %02x:%02x.%x\n", >+ pci_bus_num(assigned_device->dev.bus), >+ (assigned_device->dev.devfn >> 3) & 0x1F, >+ (assigned_device->dev.devfn & 0x7), >+ pci_dev->bus & 0xff, pci_dev->dev & 0x1f, pci_dev->func & 0x1f); >+ > /* hide pci dev from qemu */ > pci_hide_device((PCIDevice*)assigned_device); > >@@ -3212,6 +3265,7 @@ int unregister_real_device(int php_slot) > PT_LOG("Error: Revoking the device failed! rc=%d\n", rc); > > /* mark this slot as free */ >+ PT_LOG("5: clearing valid\n"); > php_dev->valid = 0; > php_dev->pt_dev = NULL; > qemu_free(assigned_device); >diff --git a/tools/ioemu/hw/pci.c b/tools/ioemu/hw/pci.c >index c62a91a..09213da 100644 >--- a/tools/ioemu/hw/pci.c >+++ b/tools/ioemu/hw/pci.c >@@ -586,6 +586,11 @@ void pci_unplug_netifs(void) > for (bus = first_bus; bus; bus = NULL) { > for (x = 0; x < 256; x++) { > dev = bus->devices[x]; >+ if (dev) { >+ fprintf(logfile, "%s: x=%d:%s ethernet controller\n", >+ __FUNCTION__, x, (dev->config[0xa] == 0 && >+ dev->config[0xb] == 2) ? "" : " not an"); >+ } > if (dev && > dev->config[0xa] == 0 && > dev->config[0xb] == 2 >diff --git a/tools/ioemu/hw/piix4acpi.c b/tools/ioemu/hw/piix4acpi.c >index 14e70f7..056bd5e 100644 >--- a/tools/ioemu/hw/piix4acpi.c >+++ b/tools/ioemu/hw/piix4acpi.c >@@ -315,8 +315,11 @@ static void php_slots_init(void) > > /* update the pci slot status */ > for ( i = 0; i < PHP_SLOT_LEN; i++ ) { >- if ( test_pci_slot( PHP_TO_PCI_SLOT(i) ) == 1 ) >+ fprintf(logfile, "%s: 1: %d\n", __FUNCTION__, i); >+ if ( test_pci_slot( PHP_TO_PCI_SLOT(i) ) == 1 ) { >+ fprintf(logfile, "%s: 2: %d\n", __FUNCTION__, i); > slots->slot[i].status = 0xf; >+ } > } > > >diff --git a/tools/ioemu/hw/pt-msi.c b/tools/ioemu/hw/pt-msi.c >index 6c94bde..e05b0e2 100644 >--- a/tools/ioemu/hw/pt-msi.c >+++ b/tools/ioemu/hw/pt-msi.c >@@ -192,12 +192,17 @@ static int pt_msix_update_one(struct pt_dev *dev, int entry_nr) > uint32_t gflags = __get_msi_gflags(entry->io_mem[2], gaddr); > int ret; > >+ PT_LOG("%02x:%02x.%x -- 1\n", pci_bus_num(dev->dev.bus), >+ (dev->dev.devfn >> 3) & 0x1F, (dev->dev.devfn & 0x7)); > if ( !entry->flags ) > return 0; > >+ PT_LOG("2\n"); >+ > /* Check if this entry is already mapped */ > if ( entry->pirq == -1 ) > { >+ PT_LOG("3\n"); > ret = xc_physdev_map_pirq_msi(xc_handle, domid, AUTO_ASSIGN, &pirq, > dev->pci_dev->dev << 3 | dev->pci_dev->func, > dev->pci_dev->bus, entry_nr, >@@ -220,6 +225,7 @@ static int pt_msix_update_one(struct pt_dev *dev, int entry_nr) > return ret; > } > >+ PT_LOG("4\n"); > entry->flags = 0; > > return 0; >@@ -234,8 +240,12 @@ int pt_msix_update(struct pt_dev *dev) > dev->pci_dev->dev << 3 | dev->pci_dev->func, > dev->pci_dev->bus, dev->msix->mmio_base_addr); > >+ PT_LOG("%02x:%02x.%x -- 1\n", pci_bus_num(dev->dev.bus), >+ (dev->dev.devfn >> 3) & 0x1F, (dev->dev.devfn & 0x7)); > for ( i = 0; i < msix->total_entries; i++ ) > { >+ PT_LOG("%02x:%02x.%x -- 2: %d\n", pci_bus_num(dev->dev.bus), >+ (dev->dev.devfn >> 3) & 0x1F, (dev->dev.devfn & 0x7), i); > pt_msix_update_one(dev, i); > } > >@@ -297,14 +307,20 @@ int pt_msix_update_remap(struct pt_dev *dev, int bar_index) > struct msix_entry_info *entry; > int i, ret; > >+ PT_LOG("%02x:%02x.%x -- 1, bar_index=%d\n", pci_bus_num(dev->dev.bus), >+ (dev->dev.devfn >> 3) & 0x1F, (dev->dev.devfn & 0x7), bar_index); > if ( !(dev->msix && dev->msix->bar_index == bar_index) ) > return 0; > >+ PT_LOG("2\n"); > for ( i = 0; i < dev->msix->total_entries; i++ ) > { >+ PT_LOG("3: %d\n", i); > entry = &dev->msix->msix_entry[i]; > if ( entry->pirq != -1 ) > { >+ PT_LOG("4: %d\n", i); >+ > ret = xc_domain_unbind_pt_irq(xc_handle, domid, entry->pirq, > PT_IRQ_TYPE_MSI, 0, 0, 0, 0); > if ( ret ) >@@ -333,6 +349,9 @@ static void pci_msix_writel(void *opaque, target_phys_addr_t addr, uint32_t val) > void *phys_off; > uint32_t vec_ctrl; > >+ PT_LOG("%02x:%02x.%x -- 1: addr=%016llx val=%08x\n", >+ pci_bus_num(dev->dev.bus), (dev->dev.devfn >> 3) & 0x1F, >+ (dev->dev.devfn & 0x7), (long long unsigned)addr, val); > if ( addr % 4 ) > { > PT_LOG("unaligned dword access to MSI-X table, addr %016lx\n", >@@ -344,6 +363,10 @@ static void pci_msix_writel(void *opaque, target_phys_addr_t addr, uint32_t val) > entry = &msix->msix_entry[entry_nr]; > offset = ((addr - msix->mmio_base_addr) % 16) / 4; > >+ PT_LOG("%02x:%02x.%x: entry_nr=%d offset=%d\n", pci_bus_num(dev->dev.bus), >+ (dev->dev.devfn >> 3) & 0x1F, (dev->dev.devfn & 0x7), entry_nr, >+ offset); >+ > /* > * If Xen intercepts the mask bit access, io_mem[3] may not be > * up-to-date. Read from hardware directly. >@@ -351,6 +374,9 @@ static void pci_msix_writel(void *opaque, target_phys_addr_t addr, uint32_t val) > phys_off = dev->msix->phys_iomem_base + 16 * entry_nr + 12; > vec_ctrl = *(uint32_t *)phys_off; > >+ PT_LOG("%02x:%02x.%x: vec_ctrl=%08x\n", pci_bus_num(dev->dev.bus), >+ (dev->dev.devfn >> 3) & 0x1F, (dev->dev.devfn & 0x7), vec_ctrl); >+ > if ( offset != 3 && msix->enabled && !(vec_ctrl & 0x1) ) > { > PT_LOG("can not update msix entry %d since MSI-X is already \ >@@ -358,14 +384,19 @@ static void pci_msix_writel(void *opaque, target_phys_addr_t addr, uint32_t val) > return; > } > >- if ( offset != 3 && entry->io_mem[offset] != val ) >+ if ( offset != 3 && entry->io_mem[offset] != val ) { >+ PT_LOG("2\n"); > entry->flags = 1; >+ } > entry->io_mem[offset] = val; > > if ( offset == 3 ) > { >- if ( msix->enabled && !(val & 0x1) ) >+ PT_LOG("3\n"); >+ if ( msix->enabled && !(val & 0x1) ) { >+ PT_LOG("4\n"); > pt_msix_update_one(dev, entry_nr); >+ } > mask_physical_msix_entry(dev, entry_nr, entry->io_mem[3] & 0x1); > } > } >diff --git a/tools/ioemu/vl.c b/tools/ioemu/vl.c >index 773e2e2..d02a142 100644 >--- a/tools/ioemu/vl.c >+++ b/tools/ioemu/vl.c >@@ -4151,6 +4151,8 @@ void do_pci_add(char *devname) > { > int pci_slot; > >+ (void)fprintf(logfile, "%s: devname='%s'\n", __FUNCTION__, devname ? >+ devname : "NULL"); > pci_slot = insert_to_pci_slot(devname); > > acpi_php_add(pci_slot); >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 849223
:
606043
|
606044
|
606045
|
606046
|
606050
|
606051
|
606365
|
606370
|
606639
|
610520
|
611505
|
613668
|
614372
|
614373
|
614374
|
614596
|
615391
|
615392
|
615482
|
616740
|
617217
|
617218
|
617260
|
617261
|
617528
|
617541
|
617718
| 618009 |
618145
|
618240
|
618241
|
618312