From: Jan Beulich <jbeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org,
Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wl@xen.org>,
Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [Xen-devel] [PATCH] x86/hvmloader: align BAR position to 4K
Date: Thu, 16 Jan 2020 11:56:20 +0100 [thread overview]
Message-ID: <32fee1fe-3269-fea5-7fd8-74ecdc152a5d@suse.com> (raw)
In-Reply-To: <20200114181345.27565-1-roger.pau@citrix.com>
On 14.01.2020 19:13, Roger Pau Monne wrote:
> When placing BARs with sizes smaller than 4K multiple BARs can end
> up mapped to the same guest physical address, and thus won't work
> correctly.
BARs of the same device can very well share a page in the common
case, can't they? (There may be reasons, like things getting too
complicated, for not actually honoring this, but then the
description should say so imo.)
> Align all BARs placement to 4K in hvmloader to prevent such
> overlapping.
>
> Note that the guest can still move the BARs around and create this
> collisions, and that BARs not filling up a physical page might leak
> access to other MMIO regions placed in the same host physical page.
Throughout the description and in the title I think you would
better say "memory BAR".
> --- a/tools/firmware/hvmloader/pci.c
> +++ b/tools/firmware/hvmloader/pci.c
> @@ -489,6 +489,10 @@ void pci_setup(void)
>
> resource->base = base;
>
> + if ( (bar_data & PCI_BASE_ADDRESS_SPACE) ==
> + PCI_BASE_ADDRESS_SPACE_MEMORY )
> + resource->base = ROUNDUP(resource->base, PAGE_SIZE);
Doesn't this need adjustments to the calculation of the MMIO
hole size higher up in the function?
Also, as per a few lines up, perhaps
if ( resource == &mem_resource)
?
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2020-01-16 10:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 18:13 [Xen-devel] [PATCH] x86/hvmloader: align BAR position to 4K Roger Pau Monne
2020-01-16 10:56 ` Jan Beulich [this message]
2020-01-16 19:57 ` Jason Andryuk
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=32fee1fe-3269-fea5-7fd8-74ecdc152a5d@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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).