[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 17:46:31 +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=1pGhMeX1ES8SvaJ9i2ibwt+ui1KvMWBcqi0tw9y4FOE=; b=e8wjAbK0fhSZwsWkl+Q3JHFv0etSa1DzoAgvXTLgCpDe9G2hb6rQ8DegkU/+wDj9po9n8E6MH7EMkPK7SLvv91sQ4J26gM8XC1iix8v6bBMKgnPrr+AuR554nVWaOyHsS3aAAN0JgHdcgv4xyF88xv1QFT7xO0OHwSEr56P9Su1HUGPMgYJTPzB0Hl+EiLBoOrCPIjBymphn8r2TwDeGi8zvinemCnf5vX/OP2VJRKQ0D2v8M1q2NNrHLJ56O7MRMPIXJi10ZmvHJeKAqbv1OCg20/V6/lssYff0f0im/BYPPArk/hSgPsrzFS0dsfHeTD15AF5fWLtdwv/Nw5/bxA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QDJksvdHtqPzvIHxXHhZBYm6XqBcEuG853wPl74kKEZnyBZ+qKvArv9rBrffAZvfBoa1vvescD/Tgq3wBmUXnkZCemC19+voYbPasrXx37YRsVz0zwKLDAUmUCAjDfmT0KFd0afP1ZNULwRzSJbVI++xtarQ+0QaNh73JI04hG9F1iq/XHCE7noru5xj9Tza/ayg1AfyHWI9Psb+xZG3ohpdF3T0Mp3T/uWyFMvwgaXtjiZRwr60KddXhJhoM1sf6AOmSCbMSlGgg44vZ9lJ1Q95tG+JgtlFtCmzXKHwuaB0oSQCdhpS//pcEy/5k4GaCA+wo+uhxhon7G2B0UAxqQ==
  • 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 15:46:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

~Michal



 


Rackspace

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