Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6907200imu; Mon, 3 Dec 2018 04:54:47 -0800 (PST) X-Google-Smtp-Source: AFSGD/X+0RHvwkULZQpTyqxnmr4xI+DL1iO/b9svYW1QKg4hIXHxR1qgGVkNhe+UGib07lz+tUbY X-Received: by 2002:a62:a209:: with SMTP id m9mr16110512pff.218.1543841686976; Mon, 03 Dec 2018 04:54:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543841686; cv=none; d=google.com; s=arc-20160816; b=YzLRiBQ3rkmHdwrRJr6AR81xDpmDrBuzqTegXFCncokm2ZymKLY76oQAPkxlDYfzZo sZ+bLeV0gagIVqpGoSXkpXKDgEp7GHzyww7ydDjTfKq0YlWYKC9hx2bm6Vr/p3FbZTT1 7KXeDvxJ5OiCTs9mrPgcNfz8JtdrbddOXNx7OYqCYVjFGTplemKuOT1GJHPZ6ChXyZ9X GpuelP6kkqZlWmKVHr2o2nPGwvxXhL4xHtMbiHK4Gdu36sEPePfL4ADhmyC1VRT53bqR PSDxrVFduTBv0QyXCPl/7FXvgqNYefpvwRJhnak9PyOKxisuoGK+61k7o1ZqOtFPKFA9 Evzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=I8U0LLAhJYTfeCWYFCJJVa4pSqvnbyquUW6hRqrvDtE=; b=DCuOz4kvnrv+FzYFTy9zbVc+hMNiL7D2i3IOqD6z+HWigT+ioXM1uSKuZqcOOMDwWV V2LZ77Dyg36jHS4foGoupJ+qJ6wq1yXHoPusmmIllz+XAsz6VycRxqHMzmB1C5vjrGra oTPmcrGfd/hgw05pvME9PHFjBO+DSOs88Th9pb7z5a/j7YItGGP5yB/h/Z5O+yv2JQVH kP2Mls6keBBrLWI+yIQAdEDpoH7Iy2TypN8rsc7HjTTZjrQI1XfvrfPp8Yic6RPBGGtM ez8eYWangbiFwX0LoxhNgEELvNhrXdS78JHgEBYyx6uiB5Pe1YPHaOvIcmojExap1zVK pyKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h13si11271541pgs.17.2018.12.03.04.54.31; Mon, 03 Dec 2018 04:54:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726471AbeLCMyu (ORCPT + 99 others); Mon, 3 Dec 2018 07:54:50 -0500 Received: from smtp.eu.citrix.com ([185.25.65.24]:42410 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbeLCMyu (ORCPT ); Mon, 3 Dec 2018 07:54:50 -0500 X-IronPort-AV: E=Sophos;i="5.56,310,1539648000"; d="scan'208";a="82686855" Date: Mon, 3 Dec 2018 13:53:46 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= CC: Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Dwayne Litzenberger , , Subject: Re: [Xen-devel] [PATCH 2/2] xen-pciback: Allow enabling/disabling expansion ROM Message-ID: <20181203125346.qjxhuepu3nhnc7wp@mac> References: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 02, 2018 at 06:47:33PM +0100, Marek Marczykowski-G?recki wrote: > From: Dwayne Litzenberger > > 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 > --- > 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.