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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZbJqzTD9v25SAPmd@x1-carbon>
Date: Thu, 25 Jan 2024 15:06:05 +0100
From: Niklas Cassel <cassel@...nel.org>
To: Lennert Buytenhek <kernel@...tstofly.org>
Cc: Damien Le Moal <dlemoal@...nel.org>, linux-ide@...r.kernel.org,
	linux-kernel@...r.kernel.org, Robin Murphy <robin.murphy@....com>,
	John Garry <john.g.garry@...cle.com>,
	Joerg Roedel <jroedel@...e.de>
Subject: Re: [PATCH] ahci: add 43-bit DMA address quirk for ASMedia ASM106x
 controllers

On Thu, Jan 25, 2024 at 03:43:06PM +0200, Lennert Buytenhek wrote:
> On Thu, Jan 25, 2024 at 02:30:14PM +0100, Niklas Cassel wrote:

(snip)

> > > @@ -943,11 +951,19 @@ static int ahci_pci_device_resume(struct device *dev)
> > >  
> > >  #endif /* CONFIG_PM */
> > >  
> > > -static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)
> > > +static int ahci_configure_dma_masks(struct pci_dev *pdev,
> > > +				    struct ahci_host_priv *hpriv)
> > >  {
> > > -	const int dma_bits = using_dac ? 64 : 32;
> > > +	int dma_bits;
> > >  	int rc;
> > >  
> > > +	if (!(hpriv->cap & HOST_CAP_64))
> > > +		dma_bits = 32;
> > > +	else if (hpriv->flags & AHCI_HFLAG_43BIT_ONLY)
> > > +		dma_bits = 43;
> > > +	else
> > > +		dma_bits = 64;
> > > +
> > 
> > I would prefer if you write this as:
> > 
> > if (hpriv->cap & HOST_CAP_64) {
> > 	dma_bits = 64;
> > 	if (hpriv->flags & AHCI_HFLAG_43BIT_ONLY)
> > 		dma_bits = 43;
> > } else {
> > 	dma_bits = 32;
> > }
> > 
> > Such that we still require the device to advertize 64 bit support,
> > and the quirk.
> > If the device does not advertize 64, we don't want it to be possible
> > to use a mask >32, even if the quirk flag is set.
> 
> Isn't that logic exactly the same as in my version?  I.e. in both
> versions, HOST_CAP_64 has to be set and AHCI_HFLAG_43BIT_ONLY has
> to be set for dma_bits to become 43.
> 
> (I don't mind doing it your way, I just don't see a functional
> difference between the versions. :-) )

Yes, you are right.

But please change it to not use an inverted check for the flag anyway,
as such pattern has apparently proven to be too complicated for my brain
to interpret correctly already :)


Kind regards,
Niklas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ