Re: [PATCH] iommu/amd: Disable guest vapic logging during early kdump init

From: Jerry Snitselaar
Date: Sat Jul 23 2022 - 12:33:35 EST


On Fri, Jul 22, 2022 at 04:37:13PM +0200, Joerg Roedel wrote:
> On Wed, Jul 20, 2022 at 05:34:39PM -0700, Jerry Snitselaar wrote:
> > diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
> > index 1d08f87e734b..2b00d7f28df7 100644
> > --- a/drivers/iommu/amd/init.c
> > +++ b/drivers/iommu/amd/init.c
> > @@ -815,6 +815,11 @@ static void free_ga_log(struct amd_iommu *iommu)
> > #endif
> > }
> >
> > +static void iommu_ga_log_disable(struct amd_iommu *iommu)
> > +{
> > + iommu_feature_disable(iommu, CONTROL_GALOG_EN);
> > +}
> > +
> > static int iommu_ga_log_enable(struct amd_iommu *iommu)
> > {
> > #ifdef CONFIG_IRQ_REMAP
> > @@ -2504,6 +2509,7 @@ static void early_enable_iommus(void)
> > for_each_iommu(iommu) {
> > iommu_disable_command_buffer(iommu);
> > iommu_disable_event_buffer(iommu);
> > + iommu_ga_log_disable(iommu);
> > iommu_enable_command_buffer(iommu);
> > iommu_enable_event_buffer(iommu);
> > iommu_enable_ga(iommu);
>
> Looks about right, but I also let Suravee comment on this.
>
> Disabling the GA-Log under a device still using it should hopefully not
> put it into some undefined state.

Hi Joerg,

Yes, I sent email to Suravee a few days ago as well to see what he thought,
but haven't heard back yet. It might be a couple days as I think he is
overseas at the moment.

Minor, stupid thing, but I wasn't sure whether it would be better to
name it iommu_disable_ga_log() like everything else called here, or
name it in the format of the other functions relating to logs. I opted
for the latter.

Did you see my other email about kdump kernels on vt-d with scalable
mode and passthrough enabled?

https://lore.kernel.org/linux-iommu/20220702154956.x2dxqalzjuzjraxk@cantor/

I've been looking at it, but haven't figured out what to do about tracking
the copying if can't borrow a bit in one of the pasid fields now. Any thoughts
on that?

Regards,
Jerry