xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Malcolm Crossley <malcolm.crossley@citrix.com>
Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH] hw/passthrough: Prevent QEMU from mapping PCI option ROM at address 0
Date: Mon, 12 May 2014 14:34:07 +0100	[thread overview]
Message-ID: <5370E9EF02000078000116E4@mail.emea.novell.com> (raw)
In-Reply-To: <5370CC22.6020408@citrix.com>

>>> On 12.05.14 at 15:26, <malcolm.crossley@citrix.com> wrote:
> On 12/05/14 14:09, Jan Beulich wrote:
>>>>> On 12.05.14 at 14:42, <malcolm.crossley@citrix.com> wrote:
>>> 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 non address parts of the BAR before comparing
>>> the address to 0.
>>> ---
>>>  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..7d6aefc 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_BASE_ADDRESS_MEM_MASK) == 0))
>> 
>> You talk of the low bit, but mask off the low 4 - how does that fit
>> together? Didn't you rather mean PCI_ROM_ADDRESS_MASK &
>> ~PCI_ROM_ADDRESS_ENABLE in text and code?
> 
> The description provides an example of a driver setting the lower bits
> of the BAR.
> 
> The intent of the fix is to ensure no BAR is mapped address 0 which is
> achieved by ensuring only the address bits of the BAR are used for the
> comparison with 0.

But the address bits here are bits 11-31, not 1-31 or 4-31.

Jan

  reply	other threads:[~2014-05-12 13:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 12:42 [PATCH] hw/passthrough: Prevent QEMU from mapping PCI option ROM at address 0 Malcolm Crossley
2014-05-12 13:09 ` Jan Beulich
2014-05-12 13:26   ` Malcolm Crossley
2014-05-12 13:34     ` Jan Beulich [this message]
2014-05-12 13:55       ` Malcolm Crossley
2014-05-12 14:00         ` Jan Beulich
2014-05-12 13:17 ` Ian Campbell
2014-05-12 13:31   ` Malcolm Crossley
2014-05-12 13:36     ` Ian Campbell
2014-05-12 13:52 ` Paul Durrant
2014-05-12 15:18 ` Ian Jackson
2014-05-12 15:48   ` Malcolm Crossley
  -- strict thread matches above, loose matches on Subject: below --
2014-05-12 14:31 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=5370E9EF02000078000116E4@mail.emea.novell.com \
    --to=jbeulich@suse.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=malcolm.crossley@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).