xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Stefano Stabellini <sstabellini@kernel.org>,
	Jan Beulich <JBeulich@suse.com>, Wei Liu <wei.liu2@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Tim Deegan <tim@xen.org>, Ian Jackson <Ian.Jackson@eu.citrix.com>,
	edgar.iglesias@xilinx.com
Cc: Steve Capper <Steve.Capper@arm.com>,
	Shannon Zhao <shannon.zhao@linaro.org>,
	Xen Devel <xen-devel@lists.xen.org>
Subject: [for-4.7] Request input on XENMAPSPACE_dev_mmio
Date: Tue, 24 May 2016 14:24:22 +0100	[thread overview]
Message-ID: <57445606.7030806@arm.com> (raw)

Hi all,

Sorry for noticing this problem late in the release process.

The mapping space XENMAPSPACE_dev_mmio has been introduced recently 
(will be present in Xen 4.7) to let dom0 map device MMIO regions when 
ACPI is in-use on ARM platform.

Xen ARM will map those regions in the stage-2 page table using the 
memory attribute Device_nGnRE (i.e non-Gathering, non-Reordering, 
no-unaligned access).

The final memory attribute is a combination of stage-1 (handled by the 
kernel) and stage-2 attributes. It will always result to a restrictive 
memory attribute (see D4.4.3 in ARM DDI 0487A.i).

Device_nGnRE is one of the most restrictive memory attribute, whilst it 
fits in lot of case, the performance are not great on device such as 
graphic cards, and it makes impossible to access those regions with 
unaligned access (a lot of Linux drivers uses memcpy which does 
unaligned access).

Unfortunately it is not possible to find a weaker memory attribute that 
would fit for everyone. For instance, we would need to map static RAM 
with normal memory attribute to allow speculation and unaligned access.

However, the same normal memory could not be used for MMIOs having 
side-effect (such as an UART) because the processor would be allowed to 
fetch additional memory locations.

For more details about the different memory attributes see B2.8 in ARM 
DDI 0487A.i.

In the case of ACPI, only DOM0 has access to the full description of the 
device and know the memory attribute to use. So we need to expand
XENMAPSPACE_dev_mmio to provide the memory attribute (this could be done 
using the top bits of 'space').

For ARM we would need at least the following attributes:
   - normal uncached memory: for write-combine on SRAM or video RAM
   - Device_nGnRE: non-gathering and non-reordering
   - Device_GRE: gathering and redordering

It might be worth to also consider "normal cache memory".

Xen 4.7 will be release very soon (~ couple of weeks), so we have few 
solutions:
     1) Extend XENMAPSPACE_dev_mmio for Xen 4.7
     2) Wait for Xen 4.8 to fix it: this may require to introduce a new 
space to be backward compatible.
     3) Revert XENMAPSPACE_dev_mmio for Xen 4.7 and re-introduce it 
properly on Xen 4.8: It is only used by ACPI on ARM which is a tech preview.

I would lean toward the solution 1) to avoid delaying ACPI support for 
ARM and avoid introducing an sub-hypercall which does not fit for our usage.

I think the space could be extend in a lightweight version for Xen 4.7 
by introducing only one memory attribute and warn on any other value.

Do you have any opinions on the way to fix it? I can provide a patch as 
soon as possible.

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2016-05-24 13:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24 13:24 Julien Grall [this message]
2016-05-24 13:57 ` [for-4.7] Request input on XENMAPSPACE_dev_mmio Jan Beulich
2016-05-24 14:39   ` Julien Grall
2016-05-24 14:38 ` Wei Liu

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=57445606.7030806@arm.com \
    --to=julien.grall@arm.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=Steve.Capper@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=george.dunlap@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=shannon.zhao@linaro.org \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@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).