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

Re: [PATCH v3 1/4] xen/arm/static-shmem: Static-shmem should be direct-mapped for direct-mapped domains


  • To: Henry Wang <xin.wang2@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Luca Fancellu" <Luca.Fancellu@xxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Mon, 20 May 2024 18:09:45 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=r01wKV+EZkO49GWXKN3y+QUk+8tw/NOThTl1UerYC4A=; b=Vg9f40DSenIaDkFK4KSC4P+Pz4OayEsXFFPVR5vMCQpVHUl1lzdHGG8ysHWIW+/ljIrYd5F8sRcsRKkma05P7AMfBYR3w2y8zHKC50ZHGBRpBDF/zppGBlD6Yf5cKU4kn9aQ0l9wKVEHf6rJQbj+NCNivYkKX9MHGL28Rd+TSPR/ZdENCKjJPdB3iTtmSkWpCsMSm1A4eFPGU1ubuqdrxGTJnp0+q7WdQP/HRKEB89LAeeGlQXlZsdShPYprDqu7KTLPSL/ZeN/FRJEzG6n0la1dAD1iWhzIgdY8Eoq9Re6/ONy5ukNJkAGzk3u/qOoJ/NzcTw7gekX6eEuqLUlC0Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DHHn9PNBiNqi7zYGh8JcwBswzHaehcZ6FjN/ES+J8EjtQjg9H9f24LTmdVJrMpCpgO7QyuC9489ebn5oy7CnI8wYUB7tLuNjDrfyYoE12bXJKpGdw5fAlmElFGxqhFvxigjLsqhLrE+qOnW+z89VzG8vT22NOao6v9PQ1hTbCSptubWwJfA7CZi7xZY3zL3ND1ueCm+wBN/lp3x7Z1Grjp0zSBA0w+UiQV/KHoCmVu6pFvVZP0AgO/K2Sqar13b6j/AuMvtRxc0Zdl1Au1cz7AK41oV+NCbDLKDqlVR13Wr45y2m2xlIZwHZW8U1Xq8lS0JD77o6x28VtEoX38MDPg==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 20 May 2024 16:10:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 20/05/2024 17:51, Henry Wang wrote:
> Hi Michal,
> 
> On 5/20/2024 11:46 PM, Michal Orzel wrote:
>> Hi Henry,
>>
>> On 20/05/2024 16:52, Henry Wang wrote:
>>> Hi Michal, Luca,
>>>
>>> On 5/20/2024 7:24 PM, Michal Orzel wrote:
>>>> Hi Henry,
>>>>
>>>> +CC: Luca
>>>>
>>>> On 17/05/2024 05:21, Henry Wang wrote:
>>>>> To make things easier, add restriction that static shared memory
>>>>> should also be direct-mapped for direct-mapped domains. Check the
>>>>> host physical address to be matched with guest physical address when
>>>>> parsing the device tree. Document this restriction in the doc.
>>>> I'm ok with this restriction.
>>>>
>>>> @Luca, do you have any use case preventing us from making this restriction?
>>>>
>>>> This patch clashes with Luca series so depending on which goes first,
>>> I agree that there will be some conflicts between the two series. To
>>> avoid back and forth, if Luca's series goes in first, would it be ok for
>>> you if I place the same check from this patch in
>>> handle_shared_mem_bank() like below?
>>>
>>> diff --git a/xen/arch/arm/static-shmem.c b/xen/arch/arm/static-shmem.c
>>> index 9c3a83042d..2d23fa4917 100644
>>> --- a/xen/arch/arm/static-shmem.c
>>> +++ b/xen/arch/arm/static-shmem.c
>>> @@ -219,6 +219,13 @@ static int __init handle_shared_mem_bank(struct
>>> domain *d, paddr_t gbase,
>>>        pbase = shm_bank->start;
>>>        psize = shm_bank->size;
>>>
>>> +    if ( is_domain_direct_mapped(d) && (pbase != gbase) )
>>> +    {
>>> +        printk("%pd: physical address 0x%"PRIpaddr" and guest address
>>> 0x%"PRIpaddr" are not direct-mapped.\n",
>>> +               d, pbase, gbase);
>>> +        return -EINVAL;
>>> +    }
>>> +
>>>        printk("%pd: SHMEM map from %s: mphys 0x%"PRIpaddr" -> gphys
>>> 0x%"PRIpaddr", size 0x%"PRIpaddr"\n",
>>>               d, bank_from_heap ? "Xen heap" : "Host", pbase, gbase, psize);
>>>
>>>> Acked-by: Michal Orzel <michal.orzel@xxxxxxx>
>>> Thanks. I will take the tag if you are ok with above diff (for the case
>>> if this series goes in later than Luca's).
>> I would move this check to process_shm() right after "gbase = dt_read_paddr" 
>> setting.
>> This would be the most natural placement for such a check.
> 
> That sounds good. Thanks! IIUC we only need to add the check for the 
> pbase != INVALID_PADDR case correct?
Yes, but at the same time I wonder whether we should also return error if a 
user omits pbase
for direct mapped domain.

~Michal



 


Rackspace

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