RE: [PATCH v1 1/1] iommu/amd: set iommu for early mapped ioapic/hpet

From: Su, Friendy
Date: Fri Sep 05 2014 - 07:22:54 EST


Hi, Joerg,

> -----Original Message-----
> From: joro@xxxxxxxxxx [mailto:joro@xxxxxxxxxx]
> Sent: Wednesday, September 03, 2014 11:06 PM
> To: Su, Friendy
> Cc: iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v1 1/1] iommu/amd: set iommu for early mapped
> ioapic/hpet
>
> On Mon, Sep 01, 2014 at 02:17:44PM +0800, Su, Friendy wrote:
> > diff --git a/drivers/iommu/amd_iommu_init.c
> b/drivers/iommu/amd_iommu_init.c
> > index 3783e0b..148ab61 100644
> > --- a/drivers/iommu/amd_iommu_init.c
> > +++ b/drivers/iommu/amd_iommu_init.c
> > @@ -747,7 +747,7 @@ static int __init add_special_device(u8 type, u8 id,
> u16 devid, bool cmd_line)
> > return 0;
> > }
> >
> > -static int __init add_early_maps(void)
> > +static int __init add_early_maps(struct amd_iommu *iommu)
> > {
> > int i, ret;
> >
> > @@ -758,6 +758,11 @@ static int __init add_early_maps(void)
> > early_ioapic_map[i].cmd_line);
> > if (ret)
> > return ret;
> > + /*
> > + * early mapped ioapci overrides ACPI IVRS,
> > + * they should be always controlled by iommu.
> > + */
> > + set_iommu_for_device(iommu, early_ioapic_map[i].devid);
> > }
> >
> > for (i = 0; i < early_hpet_map_size; ++i) {
> > @@ -767,6 +772,11 @@ static int __init add_early_maps(void)
> > early_hpet_map[i].cmd_line);
> > if (ret)
> > return ret;
> > + /*
> > + * early mapped hpet overrides ACPI IVRS,
> > + * they should be always controlled by iommu.
> > + */
> > + set_iommu_for_device(iommu, early_hpet_map[i].devid);
>
> This doesn't work on machines with multiple IOMMUs in it. Also the
> problem only exists if there is no IVHD entry in the IVRS table for the
> device containing IOAPIC and HPET.
>
> But if this IVHD entry is not present we can't reliably know which IOMMU
> is responsible for a given IOAPIC/HPET.
>
>
> Joerg
>
Thanks. You are correct, we should handle early mapped inside IOMMU whose IVHD reports the same ID. I will update.

Friendy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/