lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101004135552.GA5063@srcf.ucam.org>
Date:	Mon, 4 Oct 2010 14:55:52 +0100
From:	Matthew Garrett <mjg59@...f.ucam.org>
To:	"Roedel, Joerg" <Joerg.Roedel@....com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	"x86@...nel.org" <x86@...nel.org>,
	"jbarnes@...tuousgeek.org" <jbarnes@...tuousgeek.org>,
	"stable@...nel.org" <stable@...nel.org>
Subject: Re: [PATCH] x86: Reenable the AMD IOMMU if it's mysteriously
	vanished over suspend

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@...f.ucam.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ