Skip to contentSkip to conversation

IVDB DTE_ALL Settings

DISCUSSION David Kiarie 3 participants 5 messages Aug 4, 2015 – Aug 5, 2015 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

I hope am not messing something up,...

The Linux AMD IOMMU driver does not seem to be applying DTE settings listed in the ALL field correctly.

The relevant code:

  switch (e->type) {

case IVHD_DEV_ALL:

    DUMP_printk("  DEV_ALL\t\t\t first devid: %02x:%02x.%x"
                " last device %02x:%02x.%x flags: %02x\n",
                PCI_BUS_NUM(iommu->first_device),
                PCI_SLOT(iommu->first_device),
                PCI_FUNC(iommu->first_device),
                PCI_BUS_NUM(iommu->last_device),
                PCI_SLOT(iommu->last_device),
                PCI_FUNC(iommu->last_device),
                         e->flags);

               for (dev_i = iommu->first_device;
                    dev_i <= iommu->last_device; ++dev_i)
                    set_dev_entry_from_acpi(iommu, dev_i,
                                    e->flags, 0);
                    break;

case IVHD_DEV_SELECT:

Basically, the iommu->last/first_device fields are initialized in another state of the driver much later in the code(during PCI initialization); the values iommu->first/last_device are used before initialization which breaks the logic of this code.

On the other hand, this might be a lame bug as I have not seen any IOMMU using the ALL settings but I haven't seen many.

Cheers,
David.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi David,

Quoted 4 lines · David Kiarie

Basically, the iommu->last/first_device fields are initialized in another state of the driver much later in the code(during PCI initialization); the values iommu->first/last_device are used before initialization which breaks the logic of this code.

You are right, this is probably broken for some time, on the other side it doesn't matter for now as I've never seen an IVRS table with an IVHD_ALL field. I'll do a patch to fix this, thanks for the report.

Joerg

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi Joerg,

Quoted 11 lines · Joerg Roedel

Hi David,

Quoted 4 lines · David Kiarie

Basically, the iommu->last/first_device fields are initialized in another state of the driver much later in the code(during PCI initialization); the values iommu->first/last_device are used before initialization which breaks the logic of this code.

You are right, this is probably broken for some time, on the other side it doesn't matter for now as I've never seen an IVRS table with an IVHD_ALL field. I'll do a patch to fix this, thanks for the report.

Not directly related to the issue David discovered, but as we discuss IVRS handling: the specification says that ACPI tables data overrides what's in hardware registers (Sect. 5). To the best of my understanding, this means e.g. I should take HATS value not from EFR but from IVHD Type 10 block. However, amd_iommu driver code checks for features directly - for what reason? I'm not suggesting this is a bug, but rather asking your opinion here.

Thanks,
Valentine

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 7 lines · Valentine Sinitsyn

Not directly related to the issue David discovered, but as we discuss IVRS handling: the specification says that ACPI tables data overrides what's in hardware registers (Sect. 5). To the best of my understanding, this means e.g. I should take HATS value not from EFR but from IVHD Type 10 block. However, amd_iommu driver code checks for features directly - for what reason? I'm not suggesting this is a bug, but rather asking your opinion here.

In my experience the hardware is more trustable than the ACPI table. We had several issues with broken BIOSes that screw up the IVRS ACPI table, so my trust in the values there is limited.

Joerg

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Hi Joerg,

Quoted 9 lines · Joerg Roedel
Quoted 7 lines · Valentine Sinitsyn

Not directly related to the issue David discovered, but as we discuss IVRS handling: the specification says that ACPI tables data overrides what's in hardware registers (Sect. 5). To the best of my understanding, this means e.g. I should take HATS value not from EFR but from IVHD Type 10 block. However, amd_iommu driver code checks for features directly - for what reason? I'm not suggesting this is a bug, but rather asking your opinion here.

Quoted 3 lines

In my experience the hardware is more trustable than the ACPI table. We had several issues with broken BIOSes that screw up the IVRS ACPI table, so my trust in the values there is limited.

Makes sense. Thank you for sharing.

Valentine