All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Orzel, Michal" <michal.orzel@amd.com>
To: Luca Fancellu <luca.fancellu@arm.com>, xen-devel@lists.xenproject.org
Cc: "Penny Zheng" <Penny.Zheng@arm.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien@xen.org>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Bob Eshleman" <bobbyeshleman@gmail.com>,
	"Connor Davis" <connojdavis@gmail.com>,
	"Oleksii Kurochko" <oleksii.kurochko@gmail.com>,
	"Wei Chen" <wei.chen@arm.com>
Subject: Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
Date: Tue, 18 Mar 2025 10:11:58 +0100	[thread overview]
Message-ID: <7e1e34cd-1582-4308-8fa6-260150b88967@amd.com> (raw)
In-Reply-To: <20250317200727.798696-7-luca.fancellu@arm.com>



On 17/03/2025 21:07, Luca Fancellu wrote:
> 
> 
> From: Penny Zheng <Penny.Zheng@arm.com>
> 
> ARM MPU system doesn't need to use paging memory pool, as MPU memory
> mapping table at most takes only one 4KB page, which is enough to
> manage the maximum 255 MPU memory regions, for all EL2 stage 1
> translation and EL1 stage 2 translation.
> 
> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
> MMU systems, x86 and RISC-V.
> 
> Wrap the code inside 'construct_domU' that deal with p2m paging
> allocation in a new function 'domain_p2m_set_allocation', protected
> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
> the former function with #ifdefs and improve readability
> 
> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
> with !ARCH_PAGING_MEMPOOL.
> 
> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
> field is not required.
> 
> Signed-off-by: Penny Zheng <penny.zheng@arm.com>
> Signed-off-by: Wei Chen <wei.chen@arm.com>
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
> ---
> v3 changes:
>  - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
> v2 changes:
>  - make Kconfig HAS_PAGING_MEMPOOL common
>  - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>  - do not define p2m_teardown{_allocation} in this patch
>  - change commit message
> ---
>  xen/arch/arm/Kconfig              |  1 +
>  xen/arch/arm/dom0less-build.c     | 74 ++++++++++++++++++++-----------
>  xen/arch/arm/include/asm/domain.h |  2 +
>  xen/arch/riscv/Kconfig            |  1 +
>  xen/arch/x86/Kconfig              |  1 +
>  xen/common/Kconfig                |  3 ++
>  xen/include/xen/domain.h          | 17 +++++++
>  7 files changed, 73 insertions(+), 26 deletions(-)
> 
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index 5ac6ec0212d2..a4af0b85f158 100644
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -75,6 +75,7 @@ choice
> 
>  config MMU
>         bool "MMU"
> +       select ARCH_PAGING_MEMPOOL
>         select HAS_LLC_COLORING if !NUMA && ARM_64
>         select HAS_PMAP
>         select HAS_VMAP
> diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
> index 573b0d25ae41..6eef6ba91444 100644
> --- a/xen/arch/arm/dom0less-build.c
> +++ b/xen/arch/arm/dom0less-build.c
> @@ -673,21 +673,6 @@ static int __init prepare_dtb_domU(struct domain *d, struct kernel_info *kinfo)
>      return -EINVAL;
>  }
> 
> -static unsigned long __init domain_p2m_pages(unsigned long maxmem_kb,
> -                                             unsigned int smp_cpus)
> -{
> -    /*
> -     * Keep in sync with libxl__get_required_paging_memory().
> -     * 256 pages (1MB) per vcpu, plus 1 page per MiB of RAM for the P2M map,
> -     * plus 128 pages to cover extended regions.
> -     */
> -    unsigned long memkb = 4 * (256 * smp_cpus + (maxmem_kb / 1024) + 128);
> -
> -    BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
> -
> -    return DIV_ROUND_UP(memkb, 1024) << (20 - PAGE_SHIFT);
> -}
> -
>  static int __init alloc_xenstore_evtchn(struct domain *d)
>  {
>      evtchn_alloc_unbound_t alloc;
> @@ -841,6 +826,53 @@ static void __init domain_vcpu_affinity(struct domain *d,
>      }
>  }
> 
> +#ifdef CONFIG_ARCH_PAGING_MEMPOOL
> +
NIT: here and elsewhere. We don't usually separate code from #idef/#else/#endif
with empty lines.

For Arm:
Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal


  reply	other threads:[~2025-03-18  9:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17 20:07 [PATCH v3 0/7] MPU mm subsystem skeleton Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 1/7] arm/mpu: Add HYPERVISOR_VIRT_START and avoid a check in xen.lds.S Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 2/7] xen/arm: Implement virt/maddr conversion in MPU system Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 3/7] xen/arm: Introduce frame_table and virt_to_page Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 4/7] arm/mpu: Kconfig symbols for MPU build Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 5/7] arm/mpu: Implement stubs for ioremap_attr on MPU Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL Luca Fancellu
2025-03-18  9:11   ` Orzel, Michal [this message]
2025-03-18 13:05   ` Oleksii Kurochko
2025-03-19 11:35     ` Jan Beulich
2025-03-19 12:18       ` Luca Fancellu
2025-03-19 12:24         ` Luca Fancellu
2025-03-19 12:26         ` Luca Fancellu
2025-03-19 16:31       ` Oleksii Kurochko
2025-03-20  7:32         ` Jan Beulich
2025-03-26  9:39           ` Orzel, Michal
2025-03-26  9:46             ` Oleksii Kurochko
2025-03-26  9:53               ` Orzel, Michal
2025-03-26  9:54             ` Jan Beulich
2025-03-26  9:59               ` Orzel, Michal
2025-03-26 10:04                 ` Jan Beulich
2025-03-17 20:07 ` [PATCH v3 7/7] arm/mpu: Create the skeleton for MPU compilation Luca Fancellu
2025-03-18  9:27   ` Orzel, Michal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e1e34cd-1582-4308-8fa6-260150b88967@amd.com \
    --to=michal.orzel@amd.com \
    --cc=Penny.Zheng@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=alistair.francis@wdc.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=bertrand.marquis@arm.com \
    --cc=bobbyeshleman@gmail.com \
    --cc=connojdavis@gmail.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=luca.fancellu@arm.com \
    --cc=oleksii.kurochko@gmail.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wei.chen@arm.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.