|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [RFC v1 3/5] xen/arm: introduce SCMI-SMC mediator driver
Hi, On 06/01/2022 15:43, Oleksii Moisieiev wrote: On Thu, Jan 06, 2022 at 02:02:10PM +0000, Julien Grall wrote:On 06/01/2022 13:53, Oleksii Moisieiev wrote:Hi Julien,Hi,On Mon, Jan 03, 2022 at 01:14:17PM +0000, Julien Grall wrote:Hi, On 24/12/2021 17:02, Oleksii Moisieiev wrote:On Fri, Dec 24, 2021 at 03:42:42PM +0100, Julien Grall wrote:On 20/12/2021 16:41, Oleksii Moisieiev wrote: Just for avoidance of doubt. I was clarify option 2 and not requesting to implement. That said, if you want to implement option 2 I would be happy to review it. We still have plenty of space in the guest memory map. So the former is probably going to be fine for now.Then I get paddr of the scmi channel for this domain and use XEN_DOMCTL_memory_mapping to map scmi channel address to gfn. > Hope I wass able to answer your question.What you provided me is how the guest OS will locate the shared memory. This still doesn't tell me which memory attribute will be used to map the page in Stage-1 (guest page-tables). To find that out, you want to look at the driver and how the mapping is done. The Linux driver (drivers/firmware/arm_scmi) is using devm_ioremap() (see smc_chan_setup()). Under the hood, the function devm_ioremap() is using PROT_DEVICE_nGnRE (arm64) which is one of the most restrictive memory attribute. This means the firmware should be able to deal with the most restrictive attribute and therefore using XEN_DOMCTL_memory_mapping to map the shared page in stage-2 should be fine.I'm using vmap call to map channel memory (see smc_create_channel()). vmap call sets PAGE_HYPERVISOR flag which sets MT_NORMAL (0x7) flag.You want to use ioremap().I've used ioremap originally, but changed it to vmap because ioremap doesn't support memcpy. What if I use __vmap with MT_DEVICE_nGnRE flag? That's not going to help. Our implementation of memcpy() is using unaligned access (which is forbidden on Device memory). You will need something similar to memcpy_toio() in Linux. I don't think we have one today in Xen, so I would suggest to import the implementation from Linux. Considering that protocol is synchronous and only one agent per channel is expected - this works fine for now. But I agree that the same memory attributes should be used in xen and kernel. I fill fix that in v2.I am a bit confused. Are you mapping the full shared memory area in Xen? If yes, why do you need to map the memory that is going to be shared with a domain?Xen should have an access to all agent channels because it should send SCMI_BASE_DISCOVER_AGENT to each channel and receive agent_id during scmi_probe call. Hmmm... Just to confirm, this will only happen during Xen boot? IOW, Xen will never write to the channel when a domain is running? If yes, then I think it would be best to unmap the channel once they are used. This would prevent all sort of issues (e.g. Xen mistakenly written in them). Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |