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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181203125346.qjxhuepu3nhnc7wp@mac>
Date:   Mon, 3 Dec 2018 13:53:46 +0100
From:   Roger Pau Monné <roger.pau@...rix.com>
To:     Marek Marczykowski-Górecki 
        <marmarek@...isiblethingslab.com>
CC:     Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Juergen Gross <jgross@...e.com>,
        Stefano Stabellini <sstabellini@...nel.org>,
        Dwayne Litzenberger <dlitz@...tz.net>,
        <xen-devel@...ts.xenproject.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [Xen-devel] [PATCH 2/2] xen-pciback: Allow enabling/disabling
 expansion ROM

On Sun, Dec 02, 2018 at 06:47:33PM +0100, Marek Marczykowski-Górecki wrote:
> From: Dwayne Litzenberger <dlitz@...tz.net>
> 
> Newer AMD GPUs store their initialization routines as bytecode on the
> ROM.  This fixes the following initialization error inside the VM when
> doing PCI passthrough:
> 
>     radeon 0000:00:05.0: Invalid PCI ROM header signature: expecting 0xaa55, got 0xffff
>     radeon 0000:00:05.0: Invalid PCI ROM header signature: expecting 0xaa55, got 0xffff
>     [drm:radeon_get_bios [radeon]] *ERROR* Unable to locate a BIOS ROM
>     radeon 0000:00:05.0: Fatal error during GPU init
> 
> Signed-off-by: Dwayne Litzenberger <dlitz@...tz.net>
> ---
>  drivers/xen/xen-pciback/conf_space_header.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/xen/xen-pciback/conf_space_header.c b/drivers/xen/xen-pciback/conf_space_header.c
> index 697d0a8..bc145d3 100644
> --- a/drivers/xen/xen-pciback/conf_space_header.c
> +++ b/drivers/xen/xen-pciback/conf_space_header.c
> @@ -150,21 +150,21 @@ static int rom_write(struct pci_dev *dev, int offset, u32 value, void *data)
>  	if ((value | ~PCI_ROM_ADDRESS_MASK) == ~0U)
>  		bar->which = 1;
>  	else {
> -		u32 tmpval;
> -		err = pci_read_config_dword(dev, offset, &tmpval);
> +		u32 newval = bar->val;

Naming this newval is quite confusing IMO, since at this point it's
actually the old value.

> +
> +		/* Allow enabling/disabling rom, if present */
> +		if (newval & PCI_ROM_ADDRESS_MASK) {
> +			newval &= ~PCI_ROM_ADDRESS_ENABLE;
> +			newval |= value & PCI_ROM_ADDRESS_ENABLE;
> +		}
> +		err = pci_write_config_dword(dev, offset, newval);
>  		if (err)
>  			goto out;
> -		if (tmpval != bar->val && value == bar->val) {
> -			/* Allow restoration of bar value. */
> -			err = pci_write_config_dword(dev, offset, bar->val);
> -			if (err)
> -				goto out;
> -		}
> +		bar->val = newval;

I'm not sure there's much value in storing this, the only difference
is the setting of the enable bit, which is ignored anyway.

Thanks, Roger.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ