Re: [PATCH] iommu: parse pci device scope even only intr remap is defined

Yinghai Lu
2011-07-23T19:12:00Z

On Thu, Jul 21, 2011 at 1:56 AM, Ingo Molnar <mingo@elte.hu> wrote:
>

>>
>> +#ifndef CONFIG_DMAR
>> +/* When intr remapping is used but dmar remapping is not defined */
>> +int __init intel_iommu_init(void)
>> +{
>> +     if (dmar_table_init())
>> +             return  -ENODEV;
>> +
>> +     return dmar_dev_scope_init();
>> +}
>> +#endif
>
> So INTR_REMAP functionality really depends on dmar_table_init()?

it will need DMAR table and need to parse ioapic and pci device scope in them

and dev scope is needed to done later because it will put pci dev
pointer into drhd dev list.

>
> This looks very messy.
>
> CONFIG_DMAR has no clear meaning. The DMAR table parsing
> functionality is intermixed with the DMAR feature itself. The kernel
> code is littered with a couple of dozen CONFIG_DMAR #ifdefs with no
> clear structure to the initialization and to the separation of
> functionality.

CONFIG_DMAR is actually DMA_REMAP instead DMAR table.

or Do you prefer to clean them up further with following depency?

CONFIG_DMAR_TBL for DMAR table
CONFIG_DMA_REMAP for DMA remapping
CONFIG_INTR_REMAP for Interrupt remapping
and XXX_REMAP will select DMAR_TBL

Thanks

Yinghai