Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6091187imu; Sun, 2 Dec 2018 09:49:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/VFIR+Iz0S1sZWHikrp7Bdpd+XIVPrltS3zHZ9T/oYT9jgse2sbOMPfoo3nF/o6q6zs+elZ X-Received: by 2002:a17:902:690c:: with SMTP id j12mr12902340plk.206.1543772997831; Sun, 02 Dec 2018 09:49:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543772997; cv=none; d=google.com; s=arc-20160816; b=JBL+tIcXZYldbXi/PI0w2Wmht+vq7DMTcAuQGqOxAPD8dH1zDTk1CmMv8qW8Gu/+Kb ZJfTlwRpwJvA/TWqBUarwEWXvscrGAkuqflyTk/B61msqawlBbAZLOQvYcXZwux2+hRY 9M3x3OMeH5QFFdj8yj6/V3pnCAGvJeai8PizMZqDrX5aAd6mhvL+M60GC+BZxIEGr7wR 4/8EgMgx51Rk+0HureGAlzcwsD6FywHC0sui1AN4hbSlRm+moPVAa9AF0/eVoZyDxAMs ZMb5iWXZi+Y7c50qOPyTxHJahfsptasuD79KUy4y+QgQ6b3z+ww2YXvJMBOxmGN0M6kS 1LSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=bkazlMeqSQMZGXmkvr4gNc7lrThuSBOK6guOJYB5HUo=; b=Xx/vY9AypBzZUJ7bdW6lBjqNmlw/P6FGvUrh2i5fUoTog/PWiskpOtA37E47wovhCW tdRcM9GoVG5ni/Gy4dQTu1B96cTnGt379QpmpCdv5I2I5d6sTbdk0y/fMhMVKRDi0Jox qIwN57VFSzqCOQyWggOocRnkikJz7PNJKB4OGfPPlBTIaFJ2wLUlFy8clcGHlKGLvMbG MmUt3npkvhRIs5Y1KKHqrIzAMIsQCPNYpprQl8CL4e7w6f4w+Mt+UeN3HNVm+0XHHse6 YlkUh964UDbHC/6G95qNROgy4gp2aCibYHUBkYeOrDj8pNf8zPfSyLdaqbhcF4Pu32LC 6cfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=CARZRSdJ; 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 v16si11393753plo.182.2018.12.02.09.49.40; Sun, 02 Dec 2018 09:49:57 -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; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=CARZRSdJ; 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 S1725804AbeLBRtH (ORCPT + 99 others); Sun, 2 Dec 2018 12:49:07 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:40121 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725613AbeLBRtH (ORCPT ); Sun, 2 Dec 2018 12:49:07 -0500 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 74E0F21CFC; Sun, 2 Dec 2018 12:49:04 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sun, 02 Dec 2018 12:49:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:in-reply-to :message-id:references:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=bkazlM eqSQMZGXmkvr4gNc7lrThuSBOK6guOJYB5HUo=; b=CARZRSdJTO+PosEizGkLLI nKPsPdmrH8s1ksLnNhu8Uq6uNpWAyoiZxxyegLxC/bYF2uJiwa/JGum1auBemmBe pwQ2gZd1f5y++dZeRwY0HNbLxx1DJobnc8O14orGJnRZXb4w0Q0A0UCwqmZ2RnDS ydA57wVt+gvf9OPQwAdqREcFgNZVNUFSlLbWz188C8TwjQ+/y5SkTVZX2BmirYic /DC/zY/B0HnRLfiOjDsOjefNBX2Yfb7FBafiT3y8BnzzjK3fWrjf+GXoWQX2qwfD lk2fxx9Ar8kyfCnY6SAVXcKLo93D4T1ro2yXyDZi9gj0lH26aM9ljrJsiddJMBlA == X-ME-Sender: X-ME-Proxy: Received: from localhost.localdomain (ip5b40a57c.dynamic.kabel-deutschland.de [91.64.165.124]) by mail.messagingengine.com (Postfix) with ESMTPA id 2AE6CE44DF; Sun, 2 Dec 2018 12:49:03 -0500 (EST) From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: Boris Ostrovsky , Juergen Gross , Stefano Stabellini Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Dwayne Litzenberger Subject: [PATCH 2/2] xen-pciback: Allow enabling/disabling expansion ROM Date: Sun, 2 Dec 2018 18:47:33 +0100 Message-Id: X-Mailer: git-send-email 2.17.2 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; + + /* 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; bar->which = 0; } - /* Do we need to support enabling/disabling the rom address here? */ - out: return err; } -- git-series 0.9.1