|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 13/40] xen/mpu: introduce unified function setup_early_uart to map early UART
Hi Penny, On 31/01/2023 05:38, Penny Zheng wrote: -----Original Message----- From: Julien Grall <julien@xxxxxxx> Sent: Monday, January 30, 2023 6:00 PM To: Penny Zheng <Penny.Zheng@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx Cc: Wei Chen <Wei.Chen@xxxxxxx>; Stefano Stabellini <sstabellini@xxxxxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>; Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx> Subject: Re: [PATCH v2 13/40] xen/mpu: introduce unified function setup_early_uart to map early UART On 30/01/2023 06:24, Penny Zheng wrote:Hi, JulienHi Penny,-----Original Message----- From: Julien Grall <julien@xxxxxxx> Sent: Sunday, January 29, 2023 3:43 PM To: Penny Zheng <Penny.Zheng@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxxCc: Wei Chen <Wei.Chen@xxxxxxx>; Stefano Stabellini <sstabellini@xxxxxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>; Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx> Subject: Re: [PATCH v2 13/40] xen/mpu: introduce unified function setup_early_uart to map early UART Hi Penny, On 29/01/2023 06:17, Penny Zheng wrote:-----Original Message----- From: Julien Grall <julien@xxxxxxx> Sent: Wednesday, January 25, 2023 3:09 AM To: Penny Zheng <Penny.Zheng@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxxCc: Wei Chen <Wei.Chen@xxxxxxx>; Stefano Stabellini <sstabellini@xxxxxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>; Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx> Subject: Re: [PATCH v2 13/40] xen/mpu: introduce unified function setup_early_uart to map early UART Hi Peny,Hi Julien,On 13/01/2023 05:28, Penny Zheng wrote:In MMU system, we map the UART in the fixmap (when earlyprintk isused).However in MPU system, we map the UART with a transient MPUmemory Thanks! ''' Xen MPU Map before reorg: xen_mpumap[0] : Xen text xen_mpumap[1] : Xen read-only data xen_mpumap[2] : Xen read-only after init data xen_mpumap[3] : Xen read-write data xen_mpumap[4] : Xen BSS xen_mpumap[5] : Xen static heap ...... xen_mpumap[max_xen_mpumap - 7]: Static shared memory section xen_mpumap[max_xen_mpumap - 6]: Boot Module memory section(kernel, initramfs, etc) xen_mpumap[max_xen_mpumap - 5]: Device memory section xen_mpumap[max_xen_mpumap - 4]: Guest memory section xen_mpumap[max_xen_mpumap - 3]: Early FDT xen_mpumap[max_xen_mpumap - 2]: Xen init data xen_mpumap[max_xen_mpumap - 1]: Xen init text In the end of boot, function init_done will do the reorg and boot-only region clean-up: Xen MPU Map after reorg(idle vcpu): xen_mpumap[0] : Xen text xen_mpumap[1] : Xen read-only data xen_mpumap[2] : Xen read-only after init data In theory 1 and 2 could be merged after boot. But I guess it might be complicated? xen_mpumap[3] : Xen read-write data xen_mpumap[4] : Xen BSS xen_mpumap[5] : Xen static heap xen_mpumap[6] : Guest memory section Why do you need to map the "Guest memory section" for the idle vCPU? xen_mpumap[7] : Device memory section I might be missing some context here. But why this section is not also mapped in the context of the guest vCPU? For instance, how would you write to the serial console when the context is the guest vCPU? xen_mpumap[6] : Static shared memory section Xen MPU Map on runtime(guest vcpu): xen_mpumap[0] : Xen text xen_mpumap[1] : Xen read-only data xen_mpumap[2] : Xen read-only after init data xen_mpumap[3] : Xen read-write data xen_mpumap[4] : Xen BSS xen_mpumap[5] : Xen static heap xen_mpumap[6] : Guest memory xen_mpumap[7] : vGIC map xen_mpumap[8] : vPL011 map I was expected the PL011 to be fully emulated. So why is this necessary? xen_mpumap[9] : Passthrough device map(UART, etc) xen_mpumap[10] : Static shared memory sectionThat will be already at least 13 MPU regions ;\.The section I am the most concern of is mpu,device-memory-section because it would likely mean that all the devices will be mapped in Xen. Is there any risk that the guest may use different memory attribute?Yes, on current implementation, per-domain vgic, vpl011, and passthrough device map will be individually added into per-domain P2M mapping, then when switching into guest vcpu from xen idle vcpu, device memory section will be replaced by vgic, vpl011, passthrough device map. Per above, I am not entirely sure how you could remove the device memory section when using the guest vCPU. Now about the layout between init and runtime. From previous discussion, you said you didn't want to have init section to be fixed because of the section "Xen static heap". Furthermore, you also mention that you didn't want a bitmap. So how about the following for the assembly part: xen_mpumap[0] : Xen text xen_mpumap[1] : Xen read-only data xen_mpumap[2] : Xen read-only after init data xen_mpumap[3] : Xen read-write data xen_mpumap[4] : Xen BSS xen_mpumap[5]: Early FDT xen_mpumap[6]: Xen init data xen_mpumap[7]: Xen init text xen_mpumap[8]: Early UART (optional) Then when you switch to C, you could have: xen_mpumap[0] : Xen text xen_mpumap[1] : Xen read-only data xen_mpumap[2] : Xen read-only after init data xen_mpumap[3] : Xen read-write data xen_mpumap[4] : Xen BSS xen_mpumap[5]: Early FDT xen_mpumap[6]: Xen init data xen_mpumap[7]: Xen init text xen_mpumap[max_xen_mpumap - 4]: Device memory section xen_mpumap[max_xen_mpumap - 3]: Guest memory section xen_mpumap[max_xen_mpumap - 2]: Static shared memory section xen_mpumap[max_xen_mpumap - 1] : Xen static heapAnd at runtime, you would keep the "Xen static heap" right at the end of the MPU and keep the middle entries as the switchable one. There would be not bitmap with this solution and all the entries for the assembly code would be fixed. Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |