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

Re: [PATCH v2 1/4] xen: arm: Add a new helper update_boot_mapping()


  • To: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, <sstabellini@xxxxxxxxxx>, <bertrand.marquis@xxxxxxx>, <Volodymyr_Babchuk@xxxxxxxx>, <julien@xxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Fri, 9 Aug 2024 14:01:37 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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=arcselector10001; 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=d3drCeaBQ0zyexRbZtgHyzy7lkzVED4F8scqv1cCEWs=; b=V/rkfjuwYMit0jkcE4+5/ZTAfQyaSQmTqCru8sc+tsn38ex4OGSaKoxNmGJzvxxKBrxFxx95XlEA5UFMhdnWZnPYPnloDYllFttfhWZxdqZ+OVlS0rUCKKL79DfZMWyte2/owpT5HmPGAZQsi1VU70XKdC5bOvrisngdNHROT333pt2/+Cj6bfclRwd9XnSA8fQvRuGJ3uZbqPTmfpjQ8VJv05kuNf+jjZSzoOUhaXOnFsunsIOKdttPpw7kb+8GLfqpFK6F4IyzgGwCzfumbdEXlqswevw5c3iCBlxFHiCZR8yl5aXMhfGPqJvLPQBxSW+aQfP5OLg7TJFPQhZMkw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JmwO9p2qUnOK8klfbjzof9TC3oEdpYjNnSNkKxUo8yvV7fJ79irHIDRRZw/wjpAqiDq7OShucafRrIUrQl36dZtdfm+AU0QgiUYZ5s1jGd049Z+pi4ieX5ZDWxmaQYZE8If3FuEapnUycyp7R1SLg1FnteVqsBXsWzH0rkIQNDLeqYazaqp4mkweabBPNhwVoQgFUneYOnbpLXqP0CZLBnfbxSy1WYzDSSuTAOZ62BYld25nj3/6LLM7KzO6gF7ty6GOJp0aokAgTAtkaEtJBmV3Le3ZIjiwmoF4RLl2yyJZ/k9yKJYgC93Qg38HiT/SY+7AkHCSx0YhYIHsugmYaA==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 09 Aug 2024 12:02:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Ayan,

On 08/08/2024 14:09, Ayan Kumar Halder wrote:
> update_boot_mapping() invokes update_identity_mapping() for the MMU specific
> code.
> Later when the MPU code is added, update_boot_mapping() would invoke the
> equivalent.
> 
> The common code now invokes update_boot_mapping() instead of
> update_identity_mapping(). So, that there is clear abstraction between the
> common and MMU/MPU specific logic.
> 
> This is in continuation to commit
> f661a20aa880: "Extract MMU-specific MM code".
> 
> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
> ---
> Changes from :-
> 
> v1 - 1. Introduced update_boot_mapping() which invokes
> update_identity_mapping() in MMU specific code.
> 
>  xen/arch/arm/arm64/mmu/mm.c   | 5 +++++
>  xen/arch/arm/arm64/smpboot.c  | 6 +++---
>  xen/arch/arm/include/asm/mm.h | 2 ++
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/arm64/mmu/mm.c b/xen/arch/arm/arm64/mmu/mm.c
> index 293acb67e0..72e089a339 100644
> --- a/xen/arch/arm/arm64/mmu/mm.c
> +++ b/xen/arch/arm/arm64/mmu/mm.c
> @@ -125,6 +125,11 @@ void update_identity_mapping(bool enable)
>      BUG_ON(rc);
>  }
>  
> +void update_boot_mapping(bool enable)
> +{
> +    update_identity_mapping(enable);
With your approach, update_identity_mapping() would only be called from within 
this file,
therefore it should be marked as static and the prototype removed.

> +}
> +
>  extern void switch_ttbr_id(uint64_t ttbr);
>  
>  typedef void (switch_ttbr_fn)(uint64_t ttbr);
> diff --git a/xen/arch/arm/arm64/smpboot.c b/xen/arch/arm/arm64/smpboot.c
> index a225fae64d..789f352ab6 100644
> --- a/xen/arch/arm/arm64/smpboot.c
> +++ b/xen/arch/arm/arm64/smpboot.c
> @@ -112,18 +112,18 @@ int arch_cpu_up(int cpu)
>      if ( !smp_enable_ops[cpu].prepare_cpu )
>          return -ENODEV;
>  
> -    update_identity_mapping(true);
> +    update_boot_mapping(true);
>  
>      rc = smp_enable_ops[cpu].prepare_cpu(cpu);
>      if ( rc )
> -        update_identity_mapping(false);
> +        update_boot_mapping(false);
>  
>      return rc;
>  }
>  
>  void arch_cpu_up_finish(void)
>  {
> -    update_identity_mapping(false);
> +    update_boot_mapping(false);
>  }
>  
>  /*
> diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
> index f6ba611f01..e769d2d3b3 100644
> --- a/xen/arch/arm/include/asm/mm.h
> +++ b/xen/arch/arm/include/asm/mm.h
> @@ -426,6 +426,8 @@ static inline void page_set_xenheap_gfn(struct page_info 
> *p, gfn_t gfn)
>      } while ( (y = cmpxchg(&p->u.inuse.type_info, x, nx)) != x );
>  }
>  
> +void update_boot_mapping(bool enable);
The definition is only present for arm64. Shouldn't the prototype be moved to 
arm64 header?

~Michal



 


Rackspace

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