From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Tim Deegan <tim@xen.org>, Ian Jackson <Ian.Jackson@eu.citrix.com>,
Jun Nakajima <jun.nakajima@intel.com>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v7] x86/p2m: use large pages for MMIO mappings
Date: Tue, 2 Feb 2016 15:27:22 +0000 [thread overview]
Message-ID: <56B0CADA.2090405@citrix.com> (raw)
In-Reply-To: <56B0D61302000078000CD962@prv-mh.provo.novell.com>
On 02/02/16 15:15, Jan Beulich wrote:
> @@ -2095,6 +2131,30 @@ void *map_domain_gfn(struct p2m_domain *
> return map_domain_page(*mfn);
> }
>
> +static unsigned int mmio_order(const struct domain *d,
> + unsigned long start_fn, unsigned long nr)
> +{
> + if ( !need_iommu(d) || !iommu_use_hap_pt(d) ||
> + (start_fn & ((1UL << PAGE_ORDER_2M) - 1)) || !(nr >> PAGE_ORDER_2M) )
> + return PAGE_ORDER_4K;
> +
> + if ( 0 /*
> + * Don't use 1Gb pages, to limit the iteration count in
> + * set_typed_p2m_entry() when it needs to zap M2P entries
> + * for a RAM range.
> + */ &&
> + !(start_fn & ((1UL << PAGE_ORDER_1G) - 1)) && (nr >> PAGE_ORDER_1G) &&
> + hap_has_1gb )
> + return PAGE_ORDER_1G;
> +
> + if ( hap_has_2mb )
> + return PAGE_ORDER_2M;
> +
> + return PAGE_ORDER_4K;
> +}
Apologises again for only just spotting this. PV guests need to be
restricted to 4K mappings. Currently, this function can return
PAGE_ORDER_2M for PV guests, based on hap_has_2mb.
All the callers are presently gated on !paging_mode_translate(d), which
will exclude PV guests, but it mmio_order() isn't in principle wrong to
call for a PV guest.
With either a suitable PV path, or assertion excluding PV guests,
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> (to avoid
another on-list iteration for just this issue)
next prev parent reply other threads:[~2016-02-02 15:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 15:15 [PATCH v7] x86/p2m: use large pages for MMIO mappings Jan Beulich
2016-02-02 15:27 ` Andrew Cooper [this message]
2016-02-02 15:41 ` Jan Beulich
2016-02-08 18:04 ` George Dunlap
2016-02-09 8:42 ` Jan Beulich
2016-02-09 10:56 ` George Dunlap
2016-02-09 11:48 ` Jan Beulich
2016-02-09 12:17 ` George Dunlap
2016-02-09 12:35 ` Jan Beulich
2016-02-10 10:06 ` Ian Campbell
2016-02-10 10:19 ` George Dunlap
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=56B0CADA.2090405@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=ian.campbell@citrix.com \
--cc=jun.nakajima@intel.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.