Re: [PATCH v2 5/5] iommu/amd - Add a debugfs entry to specify a IOMMU device table entry

From: Andy Shevchenko
Date: Tue Mar 13 2018 - 13:20:50 EST


On Fri, Mar 9, 2018 at 2:51 AM, Gary R Hook <gary.hook@xxxxxxx> wrote:
> Initially (at boot) the device table values dumped are all of the
> active devices. Add a devid debugfs file to allow the user to select a
> single device table entry to dump (active or not). Let any devid value
> greater than the maximum allowable PCI ID (0xFFFF) restore the
> behavior to that effective at boot.

> + oboff += OSCNPRINTF("%02x:%02x:%x (%u / %04x)\n",
> + PCI_BUS_NUM(amd_iommu_devid),
> + PCI_SLOT(amd_iommu_devid),
> + PCI_FUNC(amd_iommu_devid),

Perhaps at some point we will have an extension to %p to print PCI BDFs.

> + if (strnchr(obuf, OBUFLEN, ':'))
> + {

Style

> + } else if (obuf[0] == '0' && obuf[1] == 'x') {
> + n = sscanf(obuf, "%x", &amd_iommu_devid);
> + } else {
> + n = sscanf(obuf, "%d", &amd_iommu_devid);
> + }

kstrtoint() ?

--
With Best Regards,
Andy Shevchenko