From: Fam Zheng <fam@euphon.net>
To: Penny Zheng <penny.zheng@arm.com>
Cc: xen-devel@lists.xenproject.org, sstabellini@kernel.org,
julien@xen.org, Bertrand.Marquis@arm.com, Kaly.Xin@arm.com,
Wei.Chen@arm.com, nd@arm.com
Subject: Re: [RFC] design: design doc for 1:1 direct-map
Date: Tue, 8 Dec 2020 10:29:05 +0000 [thread overview]
Message-ID: <20201208102905.GB118611@dev> (raw)
In-Reply-To: <20201208052113.1641514-1-penny.zheng@arm.com>
On 2020-12-08 13:21, Penny Zheng wrote:
> +The document is an early draft for direct-map memory map
> +(`guest physical == physical`) of domUs. And right now, it constrains to ARM
> +architecture.
I'm also working on direct-map DomU on x86, so let's coordinate and
cover both arches.
> +
> +It aims to describe why and how the guest would be created as direct-map domain.
> +
> +This document is partly based on Stefano Stabellini's patch serie v1:
> +[direct-map DomUs](
> +https://lists.xenproject.org/archives/html/xen-devel/2020-04/msg00707.html).
> +
> +This is a first draft and some questions are still unanswered. When this is the
> +case, the text shall contain XXX.
> +
> +# Introduction
> +
> +## Background
> +
> +Cases where domU needs direct-map memory map:
> +
> + * IOMMU not present in the system.
> + * IOMMU disabled, since it doesn't cover a specific device.
> + * IOMMU disabled, since it doesn't have enough bandwidth.
> + * IOMMU disabled, since it adds too much latency.
> +
> +*WARNING:
> +Users should be careful that it is not always secure to assign a device without
> +IOMMU/SMMU protection.
> +Users must be aware of this risk, that guests having access to hardware with
> +DMA capacity must be trusted, or it could use the DMA engine to access any
> +other memory area.
> +Guests could use additional security hardware component like NOC, System MPU
> +to protect the memory.
> +
> +## Design
> +
> +The implementation may cover following aspects:
> +
> +### Native Address and IRQ numbers for GIC and UART(vPL011)
> +
> +Today, fixed addresses and IRQ numbers are used to map GIC and UART(vPL011)
> +in DomUs. And it may cause potential clash on direct-map domains.
> +So, Using native addresses and irq numbers for GIC, UART(vPL011), in
> +direct-map domains is necessary.
> +e.g.
> +For the virtual interrupt of vPL011: instead of always using `GUEST_VPL011_SPI`,
> +try to reuse the physical SPI number if possible.
> +
> +### Device tree option: `direct_map`
> +
> +Introduce a new device tree option `direct_map` for direct-map domains.
> +Then, when users try to allocate one direct-map domain(except DOM0),
> +`direct-map` property needs to be added under the appropriate `/chosen/domUx`.
> +
> +
> + chosen {
> + ...
> + domU1 {
> + compatible = "xen, domain";
> + #address-cells = <0x2>;
> + #size-cells = <0x1>;
> + direct-map;
> + ...
> + };
> + ...
> + };
> +
> +If users are using imagebuilder, they can add to boot.source something like the
> +following:
> +
> + fdt set /chosen/domU1 direct-map
> +
> +Users could also use `xl` to create direct-map domains, just use the following
> +config option: `direct-map=true`
> +
> +### direct-map guest memory allocation
> +
> +Func `allocate_memory_direct_map` is based on `allocate_memory_11`, and shall
> +be refined to allocate memory for all direct-map domains, including DOM0.
> +Roughly speaking, firstly, it tries to allocate arbitrary memory chunk of
> +requested size from domain sub-allocator(`alloc_domheap_pages`). If fail,
> +split the chunk into halves, and re-try, until it succeed or bail out with the
> +smallest chunk size.
> +Then, `insert_11_bank` shall insert above allocated pages into a memory bank,
> +which are ordered by address, and also set up guest P2M mapping(
> +`guest_physmap_add_page`) to ensure `gfn == mfn`.
A high level comment from x86 PoV: in the mfn addr space, we want to
explicitly reserve range for direct-map. This ensures Xen or Dom0 will
leave the pages for DomU at boot time, since as Julien mentioned, x86
machines have fixed mem layout starting from 0, so the corresponding
pages mustn't go into xenheap/domheap in the first place.
IOW x86 depends on some mechanism very similar to what badpage= does.
But I wouldn't overload/abuse the parameter for direct-map. Maybe
introduce a new option, like "identpage=".
Fam
next prev parent reply other threads:[~2020-12-08 10:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-08 5:21 [RFC] design: design doc for 1:1 direct-map Penny Zheng
2020-12-08 9:07 ` Julien Grall
2020-12-08 9:12 ` Jan Beulich
2020-12-08 10:22 ` Fam Zheng
2020-12-08 10:53 ` Jan Beulich
2020-12-08 11:23 ` Fam Zheng
2020-12-10 7:02 ` Penny Zheng
2021-01-05 12:41 ` Julien Grall
2020-12-08 10:29 ` Fam Zheng [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-01-06 11:51 Penny Zheng
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=20201208102905.GB118611@dev \
--to=fam@euphon.net \
--cc=Bertrand.Marquis@arm.com \
--cc=Kaly.Xin@arm.com \
--cc=Wei.Chen@arm.com \
--cc=julien@xen.org \
--cc=nd@arm.com \
--cc=penny.zheng@arm.com \
--cc=sstabellini@kernel.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 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.