Re: [PATCH] x86: Reenable the AMD IOMMU if it's mysteriously vanished over suspend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 04, 2010 at 03:43:39PM +0200, Roedel, Joerg wrote:
> > +	pci_read_config_dword(iommu->dev, 0x44, &iommu->stored_addr_lo);
> > +	pci_read_config_dword(iommu->dev, 0x48, &iommu->stored_addr_hi);
> 
> Can you use iommu->cap_ptr here? This variant should be safe too but the
> magic numbers are non-descriptive.

Sure.

> > +	/* There may be one iommu per bus, so find the appropriate bridge */
> > +	while (pdev && (pdev->bus->number != iommu->dev->bus->number)) {
> > +		pci_dev_put(pdev);
> > +		pdev = pci_get_device(PCI_VENDOR_ID_ATI, device_id, pdev);
> > +	}
> 
> This does not work reliably with more than one IOMMU in the system. I
> suggest to get the NB device by using the bus/dev/fn of the IOMMU
> device. The IOMMU in RD890 is always function 2 of the NB device. So
> just take the bus/dev/fn of the IOMMU device, set fn to zero and get the
> NB device for re-enabling function two.

The docs imply that the northbridge will always be device 0 on a given 
bus, so this ought to work? On the other hand, your approach is simpler.

> >  	for_each_iommu(iommu) {
> >  		iommu_disable(iommu);
> > -		iommu_apply_quirks(iommu);
> >  		iommu_init_flags(iommu);
> >  		iommu_set_device_table(iommu);
> >  		iommu_enable_command_buffer(iommu);
> > @@ -1173,6 +1278,11 @@ static void disable_iommus(void)
> >  
> >  static int amd_iommu_resume(struct sys_device *dev)
> >  {
> > +	struct amd_iommu *iommu;
> > +
> > +	for_each_iommu(iommu)
> > +		iommu_apply_quirks(iommu);
> > +
> >  	/* re-load the hardware */
> >  	enable_iommus();
> 
> Why have you moved this out of the enable_iommus() loop?

enable_iommus() is called on init, whereas this should only be performed 
on resume.

I'll send out an updated patch later today.

-- 
Matthew Garrett | mjg59@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux