[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC v1 3/5] xen/arm: introduce SCMI-SMC mediator driver


  • To: Julien Grall <julien@xxxxxxx>
  • From: Oleksii Moisieiev <Oleksii_Moisieiev@xxxxxxxx>
  • Date: Fri, 17 Dec 2021 13:58:56 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T9raHJaVzXottLrjlJKE8XrEr3Amie7Jgf9biIHBeL4=; b=juzSeI8a49ycjtobV6XIxuqTUZNuDfhtSzMfbH3VYZtiWos+udD6yqtCfNvnmpDhkzpMzrvCkfucYyOAIOkjQMQZq2K+siHurm44dwAWrKxeYUG2kbWVOosNnUQCZmxutSXHn2e57OXch4tDmoImRKJjFk9hPkIhJOQnwVPDYVHkAO1HcAs5Z4Mau4RW3cjtLMjiigJYnk7h9JhyBPt0U9OslgOC6qn6weA0W6uHpPuVPCg5FKNV7KKfG3BxY8qrTX/JIjvOhv+uaKtfZFkK6Y8b49EjieAmj8peelpqaA6GO4+ZgDuFalZUL9maFTcwqrDG6guFQxY/CLpIq9CsOg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iHZG88eDrMQULTV9sBNc9p2GUSpj5YakKD2h7a4rmUR6h86A0EMUOmXel3FC2wuWe8aft4HsIKAQT6eTX5DZ+5q7YhfYCCNIkU5f0lYaR5g6UNMZCyc0oS7EUVwdFHxWyOL28t0HCnAux7Xtrp82m6u90Na8UUbs/w7xnn/y8mxNVsxfX8xXrmeq7NMKpghM458lsGb7C4Ru1oTGOel5gnW0PrUBuB4YitvJWsTwIluhTJEI8uF7LaC7baBmLl4PEDyqN0WpV1QyH35kfOgA94D5iy4XPgoxB6PNWQkuO7azpxQUSB/0/+WPeVfTJB8nv8BfJfNGz/RthoP9wy7P8g==
  • Cc: Oleksandr <olekstysh@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Fri, 17 Dec 2021 13:59:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHX8M3JF7Ng56/tV0+8/7pODiaWfKw2ks6AgAAeBwCAAAQPgIAABfaA
  • Thread-topic: [RFC v1 3/5] xen/arm: introduce SCMI-SMC mediator driver

Hi Julien,

On Fri, Dec 17, 2021 at 01:37:35PM +0000, Julien Grall wrote:
> Hi,
> 
> On 17/12/2021 13:23, Oleksii Moisieiev wrote:
> > > > +static int map_memory_to_domain(struct domain *d, uint64_t addr, 
> > > > uint64_t len)
> > > > +{
> > > > +    return iomem_permit_access(d, paddr_to_pfn(addr),
> > > > +                paddr_to_pfn(PAGE_ALIGN(addr + len -1)));
> > > > +}
> > > > +
> > > > +static int unmap_memory_from_domain(struct domain *d, uint64_t addr,
> > > > +                                     uint64_t len)
> > > > +{
> > > > +    return iomem_deny_access(d, paddr_to_pfn(addr),
> > > > +                paddr_to_pfn(PAGE_ALIGN(addr + len -1)));
> > > > +}
> > > 
> > > I wonder, why we need an extra level of indirection here. And if this is
> > > really needed, I wonder why map(unmap)_memory* name was chosen, as there 
> > > is
> > > no memory mapping/unmapping really happens here.
> > > 
> > 
> > I've added extra indirection to hide math like
> > paddr_to_pfn(PAGE_ALIGN(addr + len -1)
> > so you don't have to math in each call. unmap_memory_from_domain called
> > from 2 places, so I moved both calls to separate function.
> > Although, I agree that map/unmap is not perfect name. I consider
> > renaming it to mem_permit_acces and mam_deny_access.
> 
> I haven't looked at the rest of the series. But this discussion caught my
> eye. This code implies that the address is page-aligned but the length not.
> Is that intended?
> 
> That said, if you give permission to the domain on a full page then it means
> it may be able to access address it should not. Can you explain why this is
> fine?
> 

The idea was that xen receives some memory from the dt_node linux,scmi_mem,
then we split memory between the agents, so each agent get 1 page (we
allocate 0x10 pages right now).
But this is a good point, I think we should check length to be aligned
before making any permission changes.
I will add it in v2. 
Thank you for remark.

Oleksii.


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.