The domain part as above, with the vcpu_id printed in decimal.
e.g. d0v1
d[IDLE]v0
+
+PCI:
+
+ %pp PCI device address in S:B:D.F format from a pci_sbdf_t.
+ e.g. 0004:02:00.0
if ( rc )
{
- gdprintk(XENLOG_ERR,
- "%04x:%02x:%02x.%u: failed to bind PIRQ %u: %d\n",
- pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
- PCI_FUNC(pdev->devfn), pirq + i, rc);
+ gdprintk(XENLOG_ERR, "%pp: failed to bind PIRQ %u: %d\n",
+ &pdev->sbdf, pirq + i, rc);
while ( bind.machine_irq-- > pirq )
pt_irq_destroy_bind(pdev->domain, &bind);
return rc;
&msi_info);
if ( rc )
{
- gdprintk(XENLOG_ERR, "%04x:%02x:%02x.%u: failed to map PIRQ: %d\n",
- pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
- PCI_FUNC(pdev->devfn), rc);
+ gdprintk(XENLOG_ERR, "%pp: failed to map PIRQ: %d\n", &pdev->sbdf, rc);
return rc;
}
{
pdev->msix->warned = domid;
printk(XENLOG_G_WARNING
- "cannot mask IRQ %d: masking MSI-X on Dom%d's %04x:%02x:%02x.%u\n",
- desc->irq, domid, seg, bus, slot, func);
+ "cannot mask IRQ %d: masking MSI-X on Dom%d's %pp\n",
+ desc->irq, domid, &pdev->sbdf);
}
}
pdev->msix->host_maskall = maskall;
struct domain *d = dev->domain ?: currd;
if ( !is_hardware_domain(currd) || d != currd )
- printk("%s use of MSI-X on %04x:%02x:%02x.%u by Dom%d\n",
+ printk("%s use of MSI-X on %pp by %pd\n",
is_hardware_domain(currd)
? XENLOG_WARNING "Potentially insecure"
: XENLOG_ERR "Insecure",
- seg, bus, slot, func, d->domain_id);
+ &dev->sbdf, d);
if ( !is_hardware_domain(d) &&
/* Assume a domain without memory has no mappings yet. */
(!is_hardware_domain(currd) || domain_tot_pages(d)) )
old_desc = find_msi_entry(pdev, msi->irq, PCI_CAP_ID_MSI);
if ( old_desc )
{
- printk(XENLOG_ERR "irq %d already mapped to MSI on %04x:%02x:%02x.%u\n",
- msi->irq, msi->seg, msi->bus,
- PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
+ printk(XENLOG_ERR "irq %d already mapped to MSI on %pp\n",
+ msi->irq, &pdev->sbdf);
return -EEXIST;
}
old_desc = find_msi_entry(pdev, -1, PCI_CAP_ID_MSIX);
if ( old_desc )
{
- printk(XENLOG_WARNING "MSI-X already in use on %04x:%02x:%02x.%u\n",
- msi->seg, msi->bus,
- PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn));
+ printk(XENLOG_WARNING "MSI-X already in use on %pp\n", &pdev->sbdf);
__pci_disable_msix(old_desc);
}
static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc)
{
struct pci_dev *pdev;
- u8 slot = PCI_SLOT(msi->devfn);
- u8 func = PCI_FUNC(msi->devfn);
struct msi_desc *old_desc;
ASSERT(pcidevs_locked());
old_desc = find_msi_entry(pdev, msi->irq, PCI_CAP_ID_MSIX);
if ( old_desc )
{
- printk(XENLOG_ERR "irq %d already mapped to MSI-X on %04x:%02x:%02x.%u\n",
- msi->irq, msi->seg, msi->bus, slot, func);
+ printk(XENLOG_ERR "irq %d already mapped to MSI-X on %pp\n",
+ msi->irq, &pdev->sbdf);
return -EEXIST;
}
old_desc = find_msi_entry(pdev, -1, PCI_CAP_ID_MSI);
if ( old_desc )
{
- printk(XENLOG_WARNING "MSI already in use on %04x:%02x:%02x.%u\n",
- msi->seg, msi->bus, slot, func);
+ printk(XENLOG_WARNING "MSI already in use on %pp\n", &pdev->sbdf);
__pci_disable_msi(old_desc);
}
writel(1, entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
else if ( !(control & PCI_MSIX_FLAGS_MASKALL) )
{
- printk(XENLOG_WARNING
- "cannot disable IRQ %d: masking MSI-X on %04x:%02x:%02x.%u\n",
- entry->irq, seg, bus, slot, func);
+ printk(XENLOG_WARNING "cannot disable IRQ %d: masking MSI-X on %pp\n",
+ entry->irq, &dev->sbdf);
maskall = true;
}
dev->msix->host_maskall = maskall;
struct msi_desc *entry, *tmp;
struct irq_desc *desc;
struct msi_msg msg;
- u8 slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
unsigned int type = 0, pos = 0;
u16 control = 0;
if (desc->msi_desc != entry)
{
bogus:
- dprintk(XENLOG_ERR,
- "Restore MSI for %04x:%02x:%02x:%u entry %u not set?\n",
- pdev->seg, pdev->bus, slot, func, i);
+ dprintk(XENLOG_ERR, "Restore MSI for %pp entry %u not set?\n",
+ &pdev->sbdf, i);
spin_unlock_irqrestore(&desc->lock, flags);
if ( type == PCI_CAP_ID_MSIX )
pci_conf_write16(pdev->sbdf, msix_control_reg(pos),
return number(str + 1, end, v->vcpu_id, 10, -1, -1, 0);
}
+static char *print_pci_addr(char *str, const char *end, const pci_sbdf_t *sbdf)
+{
+ str = number(str, end, sbdf->seg, 16, 4, -1, ZEROPAD);
+ if ( str < end )
+ *str = ':';
+ str = number(str + 1, end, sbdf->bus, 16, 2, -1, ZEROPAD);
+ if ( str < end )
+ *str = ':';
+ str = number(str + 1, end, sbdf->dev, 16, 2, -1, ZEROPAD);
+ if ( str < end )
+ *str = '.';
+ return number(str + 1, end, sbdf->fn, 8, -1, -1, 0);
+}
+
static char *pointer(char *str, const char *end, const char **fmt_ptr,
const void *arg, int field_width, int precision,
int flags)
}
}
+ case 'p': /* PCI SBDF. */
+ ++*fmt_ptr;
+ return print_pci_addr(str, end, arg);
+
case 's': /* Symbol name with offset and size (iff offset != 0) */
case 'S': /* Symbol name unconditionally with offset and size */
{
iommu, &ivrs_mappings[alias_id].intremap_inuse, 0);
if ( !ivrs_mappings[alias_id].intremap_table )
- panic("No memory for %04x:%02x:%02x.%u's IRT\n",
- iommu->seg, PCI_BUS(alias_id), PCI_SLOT(alias_id),
- PCI_FUNC(alias_id));
+ panic("No memory for %pp's IRT\n",
+ &PCI_SBDF2(iommu->seg, alias_id));
}
}
return 0;
}
- AMD_IOMMU_DEBUG("IVHD Special: %04x:%02x:%02x.%u variety %#x handle %#x\n",
- seg, PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf),
- special->variety, special->handle);
+ AMD_IOMMU_DEBUG("IVHD Special: %pp variety %#x handle %#x\n",
+ &PCI_SBDF2(seg, bdf), special->variety, special->handle);
add_ivrs_mapping_entry(bdf, bdf, special->header.data_setting, true,
iommu);
if ( idx < nr_ioapic_sbdf )
{
AMD_IOMMU_DEBUG("IVHD: Command line override present for IO-APIC %#x"
- "(IVRS: %#x devID %04x:%02x:%02x.%u)\n",
- ioapic_sbdf[idx].id, special->handle, seg,
- PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf));
+ "(IVRS: %#x devID %pp)\n",
+ ioapic_sbdf[idx].id, special->handle,
+ &PCI_SBDF2(seg, bdf));
break;
}
break;
case HPET_CMDL:
AMD_IOMMU_DEBUG("IVHD: Command line override present for HPET %#x "
- "(IVRS: %#x devID %04x:%02x:%02x.%u)\n",
- hpet_sbdf.id, special->handle, seg, PCI_BUS(bdf),
- PCI_SLOT(bdf), PCI_FUNC(bdf));
+ "(IVRS: %#x devID %pp)\n",
+ hpet_sbdf.id, special->handle,
+ &PCI_SBDF2(seg, bdf));
break;
case HPET_NONE:
/* set device id of hpet */
if ( !iommu )
{
- AMD_IOMMU_DEBUG("%s: Can't find iommu for %04x:%02x:%02x.%u\n",
- __func__, pdev->seg, pdev->bus,
- PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+ AMD_IOMMU_DEBUG("%s: Can't find iommu for %pp\n",
+ __func__, &pdev->sbdf);
return;
}
rt = pci_ro_device(iommu->seg, bus, PCI_DEVFN(dev, func));
if ( rt )
- printk(XENLOG_ERR
- "Could not mark config space of %04x:%02x:%02x.%u read-only (%d)\n",
- iommu->seg, bus, dev, func, rt);
+ printk(XENLOG_ERR "Could not mark config space of %pp read-only (%d)\n",
+ &PCI_SBDF2(iommu->seg, iommu->bdf), rt);
list_add_tail(&iommu->list, &amd_iommu_head);
rt = 0;
unsigned int flags = MASK_EXTR(entry[1], IOMMU_EVENT_FLAGS_MASK);
uint64_t addr = *(uint64_t *)(entry + 2);
- printk(XENLOG_ERR "AMD-Vi: %s: %04x:%02x:%02x.%u d%d addr %016"PRIx64
+ printk(XENLOG_ERR "AMD-Vi: %s: %pp d%u addr %016"PRIx64
" flags %#x%s%s%s%s%s%s%s%s%s%s\n",
- code_str, iommu->seg, PCI_BUS(device_id), PCI_SLOT(device_id),
- PCI_FUNC(device_id), domain_id, addr, flags,
+ code_str, &PCI_SBDF2(iommu->seg, device_id),
+ domain_id, addr, flags,
(flags & 0xe00) ? " ??" : "",
(flags & 0x100) ? " TR" : "",
(flags & 0x080) ? " RZ" : "",
pcidevs_unlock();
if ( !iommu->msi.dev )
{
- AMD_IOMMU_DEBUG("IOMMU: no pdev for %04x:%02x:%02x.%u\n",
- iommu->seg, PCI_BUS(iommu->bdf),
- PCI_SLOT(iommu->bdf), PCI_FUNC(iommu->bdf));
+ AMD_IOMMU_DEBUG("IOMMU: no pdev for %pp\n",
+ &PCI_SBDF2(iommu->seg, iommu->bdf));
return 0;
}
static void amd_iommu_erratum_746_workaround(struct amd_iommu *iommu)
{
u32 value;
- u8 bus = PCI_BUS(iommu->bdf);
- u8 dev = PCI_SLOT(iommu->bdf);
- u8 func = PCI_FUNC(iommu->bdf);
if ( (boot_cpu_data.x86 != 0x15) ||
(boot_cpu_data.x86_model < 0x10) ||
pci_conf_write32(PCI_SBDF2(iommu->seg, iommu->bdf), 0xf4, value | (1 << 2));
printk(XENLOG_INFO
- "AMD-Vi: Applying erratum 746 workaround for IOMMU at %04x:%02x:%02x.%u\n",
- iommu->seg, bus, dev, func);
+ "AMD-Vi: Applying erratum 746 workaround for IOMMU at %pp\n",
+ &PCI_SBDF2(iommu->seg, iommu->bdf));
/* Clear the enable writing bit */
pci_conf_write32(PCI_SBDF2(iommu->seg, iommu->bdf), 0xf0, 0x90);
if ( iommu )
return iommu;
- AMD_IOMMU_DEBUG("No IOMMU for MSI dev = %04x:%02x:%02x.%u\n",
- seg, PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf));
+ AMD_IOMMU_DEBUG("No IOMMU for MSI dev = %pp\n", &PCI_SBDF2(seg, bdf));
return ERR_PTR(-EINVAL);
}
if ( ivrs_mapping )
{
- printk(" %04x:%02x:%02x:%u:\n", iommu->seg,
- PCI_BUS(ivrs_mapping->dte_requestor_id),
- PCI_SLOT(ivrs_mapping->dte_requestor_id),
- PCI_FUNC(ivrs_mapping->dte_requestor_id));
+ printk(" %pp:\n",
+ &PCI_SBDF2(iommu->seg, ivrs_mapping->dte_requestor_id));
ivrs_mapping = NULL;
}
tmp.dte_requestor_id = bdf;
ivrs_mappings[bdf] = tmp;
- printk(XENLOG_WARNING "%04x:%02x:%02x.%u not found in ACPI tables;"
- " using same IOMMU as function 0\n",
- seg, PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf));
+ printk(XENLOG_WARNING "%pp not found in ACPI tables;"
+ " using same IOMMU as function 0\n", &PCI_SBDF2(seg, bdf));
/* write iommu field last */
ivrs_mappings[bdf].iommu = ivrs_mappings[bd0].iommu;
return rc;
amd_iommu_setup_domain_device(target, iommu, devfn, pdev);
- AMD_IOMMU_DEBUG("Re-assign %04x:%02x:%02x.%u from dom%d to dom%d\n",
- pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
- source->domain_id, target->domain_id);
+ AMD_IOMMU_DEBUG("Re-assign %pp from dom%d to dom%d\n",
+ &pdev->sbdf, source->domain_id, target->domain_id);
return 0;
}
if ( pdev->type == DEV_TYPE_PCI_HOST_BRIDGE &&
is_hardware_domain(pdev->domain) )
{
- AMD_IOMMU_DEBUG("Skipping host bridge %04x:%02x:%02x.%u\n",
- pdev->seg, pdev->bus, PCI_SLOT(devfn),
- PCI_FUNC(devfn));
+ AMD_IOMMU_DEBUG("Skipping host bridge %pp\n", &pdev->sbdf);
return 0;
}
- AMD_IOMMU_DEBUG("No iommu for %04x:%02x:%02x.%u; cannot be handed to d%d\n",
- pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
- pdev->domain->domain_id);
+ AMD_IOMMU_DEBUG("No iommu for %pp; cannot be handed to d%d\n",
+ &pdev->sbdf, pdev->domain->domain_id);
return -ENODEV;
}
iommu = find_iommu_for_device(pdev->seg, bdf);
if ( !iommu )
{
- AMD_IOMMU_DEBUG("Fail to find iommu."
- " %04x:%02x:%02x.%u cannot be removed from dom%d\n",
- pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
- pdev->domain->domain_id);
+ AMD_IOMMU_DEBUG("Fail to find iommu. %pp cannot be removed from %pd\n",
+ &pdev->sbdf, pdev->domain);
return -ENODEV;
}
(PCI_STATUS_PARITY | PCI_STATUS_SIG_TARGET_ABORT | \
PCI_STATUS_REC_TARGET_ABORT | PCI_STATUS_REC_MASTER_ABORT | \
PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY)
- u16 seg = pdev->seg;
- u8 bus = pdev->bus;
- u8 dev = PCI_SLOT(pdev->devfn);
- u8 func = PCI_FUNC(pdev->devfn);
u16 val;
if ( command_mask )
val = pci_conf_read16(pdev->sbdf, PCI_STATUS);
if ( val & PCI_STATUS_CHECK )
{
- printk(XENLOG_INFO "%04x:%02x:%02x.%u status %04x -> %04x\n",
- seg, bus, dev, func, val, val & ~PCI_STATUS_CHECK);
+ printk(XENLOG_INFO "%pp status %04x -> %04x\n",
+ &pdev->sbdf, val, val & ~PCI_STATUS_CHECK);
pci_conf_write16(pdev->sbdf, PCI_STATUS, val & PCI_STATUS_CHECK);
}
}
val = pci_conf_read16(pdev->sbdf, PCI_SEC_STATUS);
if ( val & PCI_STATUS_CHECK )
{
- printk(XENLOG_INFO
- "%04x:%02x:%02x.%u secondary status %04x -> %04x\n",
- seg, bus, dev, func, val, val & ~PCI_STATUS_CHECK);
+ printk(XENLOG_INFO "%pp secondary status %04x -> %04x\n",
+ &pdev->sbdf, val, val & ~PCI_STATUS_CHECK);
pci_conf_write16(pdev->sbdf, PCI_SEC_STATUS,
val & PCI_STATUS_CHECK);
}
break;
default:
- printk(XENLOG_WARNING "%04x:%02x:%02x.%u: unknown type %d\n",
- pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pdev->type);
+ printk(XENLOG_WARNING "%pp: unknown type %d\n",
+ &pdev->sbdf, pdev->type);
break;
}
if ( flags & PCI_BAR_LAST )
{
printk(XENLOG_WARNING
- "%sdevice %04x:%02x:%02x.%u with 64-bit %sBAR in last slot\n",
- (flags & PCI_BAR_VF) ? "SR-IOV " : "", sbdf.seg, sbdf.bus,
- sbdf.dev, sbdf.fn, (flags & PCI_BAR_VF) ? "vf " : "");
+ "%sdevice %pp with 64-bit %sBAR in last slot\n",
+ (flags & PCI_BAR_VF) ? "SR-IOV " : "", &sbdf,
+ (flags & PCI_BAR_VF) ? "vf " : "");
*psize = 0;
return 1;
}
PCI_BASE_ADDRESS_SPACE_IO )
{
printk(XENLOG_WARNING
- "SR-IOV device %04x:%02x:%02x.%u with vf BAR%u"
- " in IO space\n",
- seg, bus, slot, func, i);
+ "SR-IOV device %pp with vf BAR%u in IO space\n",
+ &pdev->sbdf, i);
continue;
}
ret = pci_size_mem_bar(pdev->sbdf, idx, NULL,
}
}
else
- printk(XENLOG_WARNING
- "SR-IOV device %04x:%02x:%02x.%u has its virtual"
- " functions already enabled (%04x)\n",
- seg, bus, slot, func, ctrl);
+ printk(XENLOG_WARNING "SR-IOV device %pp has its virtual"
+ " functions already enabled (%04x)\n", &pdev->sbdf, ctrl);
}
check_pdev(pdev);
pcidevs_unlock();
if ( !ret )
{
- printk(XENLOG_DEBUG "PCI add %s %04x:%02x:%02x.%u\n", pdev_type,
- seg, bus, slot, func);
+ printk(XENLOG_DEBUG "PCI add %s %pp\n", pdev_type, &pdev->sbdf);
while ( pdev->phantom_stride )
{
func += pdev->phantom_stride;
if ( PCI_SLOT(func) )
break;
- printk(XENLOG_DEBUG "PCI phantom %04x:%02x:%02x.%u\n",
- seg, bus, slot, func);
+ printk(XENLOG_DEBUG "PCI phantom %pp\n",
+ &PCI_SBDF(seg, bus, slot, func));
}
}
return ret;
if ( pdev->domain )
list_del(&pdev->domain_list);
pci_cleanup_msi(pdev);
+ printk(XENLOG_DEBUG "PCI remove device %pp\n", &pdev->sbdf);
free_pdev(pseg, pdev);
- printk(XENLOG_DEBUG "PCI remove device %04x:%02x:%02x.%u\n",
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
break;
}
out:
if ( ret )
- printk(XENLOG_G_ERR "%pd: deassign (%04x:%02x:%02x.%u) failed (%d)\n",
- d, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), ret);
+ printk(XENLOG_G_ERR "%pd: deassign (%pp) failed (%d)\n",
+ d, &PCI_SBDF3(seg, bus, devfn), ret);
return ret;
}
pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
if ( !pdev )
{
- printk(XENLOG_WARNING "%04x:%02x:%02x.%u: alloc_pdev failed\n",
- pseg->nr, bus, dev, func);
+ printk(XENLOG_WARNING "%pp: alloc_pdev failed\n",
+ &PCI_SBDF(pseg->nr, bus, dev, func));
return -ENOMEM;
}
err = ctxt->handler(devfn, pdev);
if ( err )
{
- printk(XENLOG_ERR "setup %04x:%02x:%02x.%u for d%d failed (%d)\n",
- pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
- ctxt->d->domain_id, err);
+ printk(XENLOG_ERR "setup %pp for d%d failed (%d)\n",
+ &pdev->sbdf, ctxt->d->domain_id, err);
if ( devfn == pdev->devfn )
return;
}
pdev->domain = dom_xen;
}
else if ( pdev->domain != ctxt->d )
- printk(XENLOG_WARNING "Dom%d owning %04x:%02x:%02x.%u?\n",
- pdev->domain->domain_id, pseg->nr, bus,
- PCI_SLOT(devfn), PCI_FUNC(devfn));
+ printk(XENLOG_WARNING "Dom%d owning %pp?\n",
+ pdev->domain->domain_id, &pdev->sbdf);
if ( iommu_verbose )
{
list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
{
- printk("%04x:%02x:%02x.%u - %pd - node %-3d - MSIs < ",
- pseg->nr, pdev->bus,
- PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), pdev->domain,
+ printk("%pp - %pd - node %-3d - MSIs < ",
+ &pdev->sbdf, pdev->domain,
(pdev->node != NUMA_NO_NODE) ? pdev->node : -1);
list_for_each_entry ( msi, &pdev->msi_list, list )
printk("%d ", msi->irq);
return 0;
rc = hd->platform_ops->add_device(devfn, pci_to_dev(pdev));
if ( rc )
- printk(XENLOG_WARNING "IOMMU: add %04x:%02x:%02x.%u failed (%d)\n",
- pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc);
+ printk(XENLOG_WARNING "IOMMU: add %pp failed (%d)\n",
+ &pdev->sbdf, rc);
}
}
if ( !rc )
continue;
- printk(XENLOG_ERR "IOMMU: remove %04x:%02x:%02x.%u failed (%d)\n",
- pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc);
+ printk(XENLOG_ERR "IOMMU: remove %pp failed (%d)\n", &pdev->sbdf, rc);
return rc;
}
done:
if ( rc )
- printk(XENLOG_G_WARNING "%pd: assign (%04x:%02x:%02x.%u) failed (%d)\n",
- d, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc);
+ printk(XENLOG_G_WARNING "%pd: assign (%pp) failed (%d)\n",
+ d, &PCI_SBDF3(seg, bus, devfn), rc);
/* The device is assigned to dom_io so mark it as quarantined */
else if ( d == dom_io )
pdev->quarantine = true;
_pci_hide_device(pdev);
if ( !d->is_shutting_down && printk_ratelimit() )
- printk(XENLOG_ERR
- "dom%d: ATS device %04x:%02x:%02x.%u flush failed\n",
- d->domain_id, pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
- PCI_FUNC(pdev->devfn));
+ printk(XENLOG_ERR "dom%d: ATS device %pp flush failed\n",
+ d->domain_id, &pdev->sbdf);
if ( !is_hardware_domain(d) )
domain_crash(d);
{
if ( ret )
{
- printk(XENLOG_G_INFO
- "%04x:%02x:%02x.%u already assigned, or non-existent\n",
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+ printk(XENLOG_G_INFO "%pp already assigned, or non-existent\n",
+ &PCI_SBDF3(seg, bus, devfn));
ret = -EINVAL;
}
}
sub_bus = pci_conf_read8(PCI_SBDF(seg, bus, path->dev, path->fn),
PCI_SUBORDINATE_BUS);
if ( iommu_verbose )
- printk(VTDPREFIX
- " bridge: %04x:%02x:%02x.%u start=%x sec=%x sub=%x\n",
- seg, bus, path->dev, path->fn,
+ printk(VTDPREFIX " bridge: %pp start=%x sec=%x sub=%x\n",
+ &PCI_SBDF(seg, bus, path->dev, path->fn),
acpi_scope->bus, sec_bus, sub_bus);
dmar_scope_add_buses(scope, sec_bus, sub_bus);
case ACPI_DMAR_SCOPE_TYPE_HPET:
if ( iommu_verbose )
- printk(VTDPREFIX " MSI HPET: %04x:%02x:%02x.%u\n",
- seg, bus, path->dev, path->fn);
+ printk(VTDPREFIX " MSI HPET: %pp\n",
+ &PCI_SBDF(seg, bus, path->dev, path->fn));
if ( drhd )
{
case ACPI_DMAR_SCOPE_TYPE_ENDPOINT:
if ( iommu_verbose )
- printk(VTDPREFIX " endpoint: %04x:%02x:%02x.%u\n",
- seg, bus, path->dev, path->fn);
+ printk(VTDPREFIX " endpoint: %pp\n",
+ &PCI_SBDF(seg, bus, path->dev, path->fn));
if ( drhd )
{
case ACPI_DMAR_SCOPE_TYPE_IOAPIC:
if ( iommu_verbose )
- printk(VTDPREFIX " IOAPIC: %04x:%02x:%02x.%u\n",
- seg, bus, path->dev, path->fn);
+ printk(VTDPREFIX " IOAPIC: %pp\n",
+ &PCI_SBDF(seg, bus, path->dev, path->fn));
if ( drhd )
{
if ( !pci_device_detect(drhd->segment, b, d, f) )
printk(XENLOG_WARNING VTDPREFIX
- " Non-existent device (%04x:%02x:%02x.%u) in this DRHD's scope!\n",
- drhd->segment, b, d, f);
+ " Non-existent device (%pp) in this DRHD's scope!\n",
+ &PCI_SBDF(drhd->segment, b, d, f));
}
acpi_register_drhd_unit(dmaru);
if ( pci_device_detect(rmrru->segment, b, d, f) == 0 )
{
dprintk(XENLOG_WARNING VTDPREFIX,
- " Non-existent device (%04x:%02x:%02x.%u) is reported"
- " in RMRR [%"PRIx64",%"PRIx64"]'s scope!\n",
- rmrru->segment, b, d, f,
+ " Non-existent device (%pp) is reported"
+ " in RMRR [%"PRIx64", %"PRIx64"]'s scope!\n",
+ &PCI_SBDF(rmrru->segment, b, d, f),
rmrru->base_address, rmrru->end_address);
ignore = true;
}
}
else
dprintk(XENLOG_WARNING VTDPREFIX,
- "d%d: no upstream bridge for %04x:%02x:%02x.%u\n",
- pdev->domain->domain_id,
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+ "d%d: no upstream bridge for %pp\n",
+ pdev->domain->domain_id, &pdev->sbdf);
break;
default:
- dprintk(XENLOG_WARNING VTDPREFIX,
- "d%d: unknown(%u): %04x:%02x:%02x.%u\n",
- pdev->domain->domain_id, pdev->type,
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+ dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): %pp\n",
+ pdev->domain->domain_id, pdev->type, &pdev->sbdf);
break;
}
}
{
case DMA_REMAP:
printk(XENLOG_G_WARNING VTDPREFIX
- "DMAR:[%s] Request device [%04x:%02x:%02x.%u] "
+ "DMAR:[%s] Request device [%pp] "
"fault addr %"PRIx64"\n",
(type ? "DMA Read" : "DMA Write"),
- seg, PCI_BUS(source_id), PCI_SLOT(source_id),
- PCI_FUNC(source_id), addr);
+ &PCI_SBDF2(seg, source_id), addr);
kind = "DMAR";
break;
case INTR_REMAP:
printk(XENLOG_G_WARNING VTDPREFIX
- "INTR-REMAP: Request device [%04x:%02x:%02x.%u] "
+ "INTR-REMAP: Request device [%pp] "
"fault index %"PRIx64"\n",
- seg, PCI_BUS(source_id), PCI_SLOT(source_id),
- PCI_FUNC(source_id), addr >> 48);
+ &PCI_SBDF2(seg, source_id), addr >> 48);
kind = "INTR-REMAP";
break;
default:
printk(XENLOG_G_WARNING VTDPREFIX
- "UNKNOWN: Request device [%04x:%02x:%02x.%u] "
+ "UNKNOWN: Request device [%pp] "
"fault addr %"PRIx64"\n",
- seg, PCI_BUS(source_id), PCI_SLOT(source_id),
- PCI_FUNC(source_id), addr);
+ &PCI_SBDF2(seg, source_id), addr);
kind = "UNKNOWN";
break;
}
{
if ( pdev->domain != domain )
{
- printk(XENLOG_G_INFO VTDPREFIX
- "%pd: %04x:%02x:%02x.%u owned by %pd\n",
- domain, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+ printk(XENLOG_G_INFO VTDPREFIX "%pd: %pp owned by %pd",
+ domain, &PCI_SBDF3(seg, bus, devfn),
pdev->domain);
res = -EINVAL;
}
if ( cdomain < 0 )
{
printk(XENLOG_G_WARNING VTDPREFIX
- "%pd: %04x:%02x:%02x.%u mapped, but can't find owner\n",
- domain, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+ "%pd: %pp mapped, but can't find owner\n",
+ domain, &PCI_SBDF3(seg, bus, devfn));
res = -EINVAL;
}
else if ( cdomain != domain->domain_id )
{
printk(XENLOG_G_INFO VTDPREFIX
- "%pd: %04x:%02x:%02x.%u already mapped to d%d\n",
- domain,
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
- cdomain);
+ "%pd: %pp already mapped to d%d",
+ domain, &PCI_SBDF3(seg, bus, devfn), cdomain);
res = -EINVAL;
}
}
{
case DEV_TYPE_PCI_HOST_BRIDGE:
if ( iommu_debug )
- printk(VTDPREFIX "d%d:Hostbridge: skip %04x:%02x:%02x.%u map\n",
- domain->domain_id, seg, bus,
- PCI_SLOT(devfn), PCI_FUNC(devfn));
+ printk(VTDPREFIX "%pd:Hostbridge: skip %pp map\n",
+ domain, &PCI_SBDF3(seg, bus, devfn));
if ( !is_hardware_domain(domain) )
return -EPERM;
break;
case DEV_TYPE_PCIe_ENDPOINT:
if ( iommu_debug )
- printk(VTDPREFIX "d%d:PCIe: map %04x:%02x:%02x.%u\n",
- domain->domain_id, seg, bus,
- PCI_SLOT(devfn), PCI_FUNC(devfn));
+ printk(VTDPREFIX "%pd:PCIe: map %pp\n",
+ domain, &PCI_SBDF3(seg, bus, devfn));
ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn,
pdev);
if ( !ret && devfn == pdev->devfn && ats_device(pdev, drhd) > 0 )
case DEV_TYPE_PCI:
if ( iommu_debug )
- printk(VTDPREFIX "d%d:PCI: map %04x:%02x:%02x.%u\n",
- domain->domain_id, seg, bus,
- PCI_SLOT(devfn), PCI_FUNC(devfn));
+ printk(VTDPREFIX "%pd:PCI: map %pp\n",
+ domain, &PCI_SBDF3(seg, bus, devfn));
ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn,
pdev);
break;
default:
- dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): %04x:%02x:%02x.%u\n",
- domain->domain_id, pdev->type,
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+ dprintk(XENLOG_ERR VTDPREFIX, "%pd:unknown(%u): %pp\n",
+ domain, pdev->type, &PCI_SBDF3(seg, bus, devfn));
ret = -EINVAL;
break;
}
{
case DEV_TYPE_PCI_HOST_BRIDGE:
if ( iommu_debug )
- printk(VTDPREFIX "d%d:Hostbridge: skip %04x:%02x:%02x.%u unmap\n",
- domain->domain_id, seg, bus,
- PCI_SLOT(devfn), PCI_FUNC(devfn));
+ printk(VTDPREFIX "%pd:Hostbridge: skip %pp unmap\n",
+ domain, &PCI_SBDF3(seg, bus, devfn));
if ( !is_hardware_domain(domain) )
return -EPERM;
goto out;
case DEV_TYPE_PCIe_ENDPOINT:
if ( iommu_debug )
- printk(VTDPREFIX "d%d:PCIe: unmap %04x:%02x:%02x.%u\n",
- domain->domain_id, seg, bus,
- PCI_SLOT(devfn), PCI_FUNC(devfn));
+ printk(VTDPREFIX "%pd:PCIe: unmap %pp\n",
+ domain, &PCI_SBDF3(seg, bus, devfn));
ret = domain_context_unmap_one(domain, iommu, bus, devfn);
if ( !ret && devfn == pdev->devfn && ats_device(pdev, drhd) > 0 )
disable_ats_device(pdev);
case DEV_TYPE_PCI:
if ( iommu_debug )
- printk(VTDPREFIX "d%d:PCI: unmap %04x:%02x:%02x.%u\n",
- domain->domain_id, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+ printk(VTDPREFIX "%pd:PCI: unmap %pp\n",
+ domain, &PCI_SBDF3(seg, bus, devfn));
ret = domain_context_unmap_one(domain, iommu, bus, devfn);
if ( ret )
break;
break;
default:
- dprintk(XENLOG_ERR VTDPREFIX, "d%d:unknown(%u): %04x:%02x:%02x.%u\n",
- domain->domain_id, pdev->type,
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+ dprintk(XENLOG_ERR VTDPREFIX, "%pd:unknown(%u): %pp\n",
+ domain, pdev->type, &PCI_SBDF3(seg, bus, devfn));
ret = -EINVAL;
goto out;
}
bool_t relaxed = !!(flag & XEN_DOMCTL_DEV_RDM_RELAXED);
printk(XENLOG_GUEST "%s" VTDPREFIX
- " It's %s to assign %04x:%02x:%02x.%u"
- " with shared RMRR at %"PRIx64" for Dom%d.\n",
+ " It's %s to assign %pp"
+ " with shared RMRR at %"PRIx64" for %pd.\n",
relaxed ? XENLOG_WARNING : XENLOG_ERR,
relaxed ? "risky" : "disallowed",
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
- rmrr->base_address, d->domain_id);
+ &PCI_SBDF3(seg, bus, devfn), rmrr->base_address, d);
if ( !relaxed )
return -EPERM;
}
if ( rc )
{
printk(XENLOG_ERR VTDPREFIX
- " failed to reclaim %04x:%02x:%02x.%u from %pd (%d)\n",
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), d, rc);
+ " failed to reclaim %pp from %pd (%d)\n",
+ &PCI_SBDF3(seg, bus, devfn), d, rc);
domain_crash(d);
}
break;
{
int seg = pdev->seg;
int bus = pdev->bus;
- int dev = PCI_SLOT(pdev->devfn);
- int func = PCI_FUNC(pdev->devfn);
int pos;
bool_t ff;
u32 val, val2;
case 0x3c28: /* Sandybridge */
val = pci_conf_read32(pdev->sbdf, 0x1AC);
pci_conf_write32(pdev->sbdf, 0x1AC, val | (1 << 31));
- printk(XENLOG_INFO "Masked VT-d error signaling on %04x:%02x:%02x.%u\n",
- seg, bus, dev, func);
+ printk(XENLOG_INFO "Masked VT-d error signaling on %pp\n", &pdev->sbdf);
break;
/* Tylersburg (EP)/Boxboro (MP) chipsets (NHM-EP/EX, WSM-EP/EX) */
ff = pcie_aer_get_firmware_first(pdev);
if ( !pos )
{
- printk(XENLOG_WARNING "%04x:%02x:%02x.%u without AER capability?\n",
- seg, bus, dev, func);
+ printk(XENLOG_WARNING "%pp without AER capability?\n", &pdev->sbdf);
break;
}
val = pci_conf_read32(pdev->sbdf, 0x20c);
pci_conf_write32(pdev->sbdf, 0x20c, val | (1 << 4));
- printk(XENLOG_INFO "%s UR signaling on %04x:%02x:%02x.%u\n",
- action, seg, bus, dev, func);
+ printk(XENLOG_INFO "%s UR signaling on %pp\n", action, &pdev->sbdf);
break;
case 0x0040: case 0x0044: case 0x0048: /* Nehalem/Westmere */
{
__set_bit(0x1c8 * 8 + 20, va);
iounmap(va);
- printk(XENLOG_INFO "Masked UR signaling on %04x:%02x:%02x.%u\n",
- seg, bus, dev, func);
+ printk(XENLOG_INFO "Masked UR signaling on %pp\n", &pdev->sbdf);
}
else
- printk(XENLOG_ERR "Could not map %"PRIpaddr" for %04x:%02x:%02x.%u\n",
- pa, seg, bus, dev, func);
+ printk(XENLOG_ERR "Could not map %"PRIpaddr" for %pp\n",
+ pa, &pdev->sbdf);
}
else
- printk(XENLOG_WARNING "Bogus DMIBAR %#"PRIx64" on %04x:%02x:%02x.%u\n",
- bar, seg, bus, dev, func);
+ printk(XENLOG_WARNING "Bogus DMIBAR %#"PRIx64" on %pp\n",
+ bar, &pdev->sbdf);
break;
}
}
u64 *l, val;
u32 l_index, level;
- printk("print_vtd_entries: iommu #%u dev %04x:%02x:%02x.%u gmfn %"PRI_gfn"\n",
- iommu->index, iommu->drhd->segment, bus,
- PCI_SLOT(devfn), PCI_FUNC(devfn), gmfn);
+ printk("print_vtd_entries: iommu #%u dev %pp gmfn %"PRI_gfn"\n",
+ iommu->index, &PCI_SBDF3(iommu->drhd->segment, bus, devfn),
+ gmfn);
if ( iommu->root_maddr == 0 )
{
BUG_ON(!pos);
if ( iommu_verbose )
- dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS capability found\n",
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+ dprintk(XENLOG_INFO, "%pp: ATS capability found\n", &pdev->sbdf);
value = pci_conf_read16(pdev->sbdf, pos + ATS_REG_CTL);
if ( value & ATS_ENABLE )
}
if ( iommu_verbose )
- dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS %s enabled\n",
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
- pos ? "is" : "was");
+ dprintk(XENLOG_INFO, "%pp: ATS %s enabled\n",
+ &pdev->sbdf, pos ? "is" : "was");
return pos;
}
void disable_ats_device(struct pci_dev *pdev)
{
u32 value;
- u16 seg = pdev->seg;
- u8 bus = pdev->bus, devfn = pdev->devfn;
BUG_ON(!pdev->ats.cap_pos);
list_del(&pdev->ats.list);
if ( iommu_verbose )
- dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS is disabled\n",
- seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+ dprintk(XENLOG_INFO, "%pp: ATS is disabled\n", &pdev->sbdf);
}
uint32_t val, void *data)
{
struct vpci_bar *bar = data;
- uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
bool hi = false;
if ( bar->type == VPCI_BAR_MEM64_HI )
/* If the value written is the current one avoid printing a warning. */
if ( val != (uint32_t)(bar->addr >> (hi ? 32 : 0)) )
gprintk(XENLOG_WARNING,
- "%04x:%02x:%02x.%u: ignored BAR %lu write with memory decoding enabled\n",
- pdev->seg, pdev->bus, slot, func,
- bar - pdev->vpci->header.bars + hi);
+ "%pp: ignored BAR %lu write with memory decoding enabled\n",
+ &pdev->sbdf, bar - pdev->vpci->header.bars + hi);
return;
}
{
struct vpci_header *header = &pdev->vpci->header;
struct vpci_bar *rom = data;
- uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
uint16_t cmd = pci_conf_read16(pdev->sbdf, PCI_COMMAND);
bool new_enabled = val & PCI_ROM_ADDRESS_ENABLE;
if ( (cmd & PCI_COMMAND_MEMORY) && header->rom_enabled && new_enabled )
{
gprintk(XENLOG_WARNING,
- "%04x:%02x:%02x.%u: ignored ROM BAR write with memory decoding enabled\n",
- pdev->seg, pdev->bus, slot, func);
+ "%pp: ignored ROM BAR write with memory decoding enabled\n",
+ &pdev->sbdf);
return;
}
msi = pdev->vpci->msi;
if ( msi && msi->enabled )
{
- printk("%04x:%02x:%02x.%u MSI\n", pdev->seg, pdev->bus,
- PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+ printk("%pp MSI\n", &pdev->sbdf);
printk(" enabled: %d 64-bit: %d",
msi->enabled, msi->address64);
{
int rc;
- printk("%04x:%02x:%02x.%u MSI-X\n", pdev->seg, pdev->bus,
- PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+ printk("%pp MSI-X\n", &pdev->sbdf);
printk(" entries: %u maskall: %d enabled: %d\n",
msix->max_entries, msix->masked, msix->enabled);
static int update_entry(struct vpci_msix_entry *entry,
const struct pci_dev *pdev, unsigned int nr)
{
- uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
int rc = vpci_msix_arch_disable_entry(entry, pdev);
/* Ignore ENOENT, it means the entry wasn't setup. */
if ( rc && rc != -ENOENT )
{
gprintk(XENLOG_WARNING,
- "%04x:%02x:%02x.%u: unable to disable entry %u for update: %d\n",
- pdev->seg, pdev->bus, slot, func, nr, rc);
+ "%pp: unable to disable entry %u for update: %d\n",
+ &pdev->sbdf, nr, rc);
return rc;
}
VPCI_MSIX_TABLE));
if ( rc )
{
- gprintk(XENLOG_WARNING,
- "%04x:%02x:%02x.%u: unable to enable entry %u: %d\n",
- pdev->seg, pdev->bus, slot, func, nr, rc);
+ gprintk(XENLOG_WARNING, "%pp: unable to enable entry %u: %d\n",
+ &pdev->sbdf, nr, rc);
/* Entry is likely not properly configured. */
return rc;
}
static void control_write(const struct pci_dev *pdev, unsigned int reg,
uint32_t val, void *data)
{
- uint8_t slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn);
struct vpci_msix *msix = data;
bool new_masked = val & PCI_MSIX_FLAGS_MASKALL;
bool new_enabled = val & PCI_MSIX_FLAGS_ENABLE;
/* Ignore non-present entry. */
break;
default:
- gprintk(XENLOG_WARNING,
- "%04x:%02x:%02x.%u: unable to disable entry %u: %d\n",
- pdev->seg, pdev->bus, slot, func, i, rc);
+ gprintk(XENLOG_WARNING, "%pp: unable to disable entry %u: %d\n",
+ &pdev->sbdf, i, rc);
return;
}
}
return true;
gprintk(XENLOG_WARNING,
- "%04x:%02x:%02x.%u: unaligned or invalid size MSI-X table access\n",
- pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+ "%pp: unaligned or invalid size MSI-X table access\n", &pdev->sbdf);
return false;
}
default:
put_gfn(d, start);
gprintk(XENLOG_WARNING,
- "%04x:%02x:%02x.%u: existing mapping (mfn: %" PRI_mfn
+ "%pp: existing mapping (mfn: %" PRI_mfn
"type: %d) at %#lx clobbers MSIX MMIO area\n",
- pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
- PCI_FUNC(pdev->devfn), mfn_x(mfn), t, start);
+ &pdev->sbdf, mfn_x(mfn), t, start);
return -EEXIST;
}
put_gfn(d, start);