xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Malcolm Crossley <malcolm.crossley@citrix.com>
To: xen-devel@lists.xen.org, Ian.Jackson@citrix.com,
	JBeulich@suse.com, Ian.Campbell@citrix.com,
	Paul.Durrant@citrix.com
Cc: Malcolm Crossley <malcolm.crossley@citrix.com>
Subject: [PATCH v3] hw/passthrough: Prevent QEMU from mapping PCI option ROM at address 0
Date: Mon, 12 May 2014 15:37:00 +0100	[thread overview]
Message-ID: <1399905420-4782-1-git-send-email-malcolm.crossley@citrix.com> (raw)

The PCI option ROM BAR uses the LSB to indicate if the BAR is enabled.
The AMD graphics driver sets the address bit's of the BAR to 0 but leaves the
LSB set to 1. Whilst this is not good practice, QEMU should be ignoring the
non address parts of the BAR.

This patch adds masking of the bits 0-10 (4k page) parts of the BAR
before comparing the address to 0.

Signed-off-by: Malcolm Crossley <malcolm.crossley@citrix.com>
---
 hw/pass-through.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/pass-through.c b/hw/pass-through.c
index 304c438..f83c88c 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -2208,7 +2208,7 @@ static void pt_bar_mapping_one(struct pt_dev *ptdev, int bar, int io_enable,
     }
 
     /* prevent guest software mapping memory resource to 00000000h */
-    if ((base->bar_flag == PT_BAR_FLAG_MEM) && (r_addr == 0))
+    if ((base->bar_flag == PT_BAR_FLAG_MEM) && ((r_addr & PCI_ROM_ADDRESS_MASK) == 0))
         r_addr = -1;
 
     /* align resource size (memory type only) */
-- 
1.7.1

             reply	other threads:[~2014-05-12 14:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 14:37 Malcolm Crossley [this message]
2014-05-12 14:53 ` [PATCH v3] hw/passthrough: Prevent QEMU from mapping PCI option ROM at address 0 Jan Beulich
2014-05-12 15:32   ` Malcolm Crossley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399905420-4782-1-git-send-email-malcolm.crossley@citrix.com \
    --to=malcolm.crossley@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).