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

Re: [XEN v4 07/11] xen/arm: Introduce choice to enable 64/32 bit physical addressing


  • To: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 21 Mar 2023 15:22:08 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=B1EnL6983SI0TKLh3dr0X/w3dETG+vIo/DRpVGM2Gt0=; b=eu2jxdCUNt6r2YGwDJ4U1oPtP0qZiGE/BcCIi0JMesnkzxBrFIPRDCqKZ12h4bGD1KVVW8REsguGRSl7q3YEpuNHm52Ybd7jzwsDhVh+IR/9oY09cNY6V3HHRmlxBUN+czL/ezEBc6MP1CuQ3tx7+7SEO6XunLvEOxnuIbJRCF+p9863B6nrc+0/30MaflTQIFIvPvI4IYwhcYglH/uVSVX0baiEXUsN8cLfspZyGwb14XiXLcIbaqd+EZjwnk2Nka9HceK8TS2/6/quEw668NqBRV4m8K+KLnFzkfLmHYPAf9ofiUP4KAL8rOOSGg4VzBtks3xBPaeyD/RFdSPVxA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=neunr9UrFpUkMxgv2kpg21BouF5jpO6xrpqZWUrnV/hlHnXKv6SwpC8dUV7rLJ2reACEfhwZ6nTySxsigs/1/CTyc2QnhH9FGCyx9LQ10z8qVjueHkotPHD2jWV1CwWCbTn4M51iWAioayz6ZvADj1sBO/c2LTqnPMhSJgcEy04ys+mWV2OWSMs2DHT0tVtO3KV1RMRw4mNRp0W2tDuZ1WaZRu3ees5KnPsMhVdgYVjvROCHyB9lh3emAyW2VotjNEYou4pn2TiuE1ae0opsMM2RyrhcTuFyHWHxdLUriv5aO9ptlbqMI74LY6XMksZ4eOgW0+DdH6Cp9L1oBuOZKQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, stefano.stabellini@xxxxxxx, julien@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx, bertrand.marquis@xxxxxxx, andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, wl@xxxxxxx, rahul.singh@xxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 21 Mar 2023 14:22:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.03.2023 15:03, Ayan Kumar Halder wrote:
> --- a/xen/arch/Kconfig
> +++ b/xen/arch/Kconfig
> @@ -1,6 +1,12 @@
>  config 64BIT
>       bool
>  
> +config PHYS_ADDR_T_32
> +     bool
> +
> +config PHYS_ADDR_T_64
> +     bool

Do we really need both? If so, what guards against both being selected
at the same time?

Them being put in common code I consider it an at least latent issue
that you add "select"s ...

> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -9,6 +9,7 @@ config ARM_64
>       select 64BIT
>       select ARM_EFI
>       select HAS_FAST_MULTIPLY
> +     select PHYS_ADDR_T_64
>  
>  config ARM
>       def_bool y
> @@ -19,13 +20,48 @@ config ARM
>       select HAS_PMAP
>       select IOMMU_FORCE_PT_SHARE
>  
> +menu "Architecture Features"
> +
> +choice
> +     prompt "Physical address space size" if ARM_32
> +     default ARM_PA_BITS_48 if ARM_64
> +     default ARM_PA_BITS_40 if ARM_32
> +     help
> +       User can choose to represent the width of physical address. This can
> +       sometimes help in optimizing the size of image when user chooses a
> +       smaller size to represent physical address.
> +
> +config ARM_PA_BITS_32
> +     bool "32-bit"
> +     help
> +       On platforms where any physical address can be represented within 32 
> bits
> +       , user should choose this option. This will help is reduced size of 
> the
> +       binary.
> +     select PHYS_ADDR_T_32
> +     depends on ARM_32
> +
> +config ARM_PA_BITS_40
> +     bool "40-bit"
> +     select PHYS_ADDR_T_64
> +     depends on ARM_32
> +
> +config ARM_PA_BITS_48
> +     bool "40-bit"
> +     select PHYS_ADDR_T_64
> +     depends on ARM_48
> +endchoice

... only for Arm. You get away with this only because ...

> --- a/xen/arch/arm/include/asm/types.h
> +++ b/xen/arch/arm/include/asm/types.h
> @@ -34,9 +34,15 @@ typedef signed long long s64;
>  typedef unsigned long long u64;
>  typedef u32 vaddr_t;
>  #define PRIvaddr PRIx32
> +#if defined(CONFIG_PHYS_ADDR_T_32)
> +typedef unsigned long paddr_t;
> +#define INVALID_PADDR (~0UL)
> +#define PRIpaddr "08lx"
> +#else
>  typedef u64 paddr_t;
>  #define INVALID_PADDR (~0ULL)
>  #define PRIpaddr "016llx"
> +#endif
>  typedef u32 register_t;
>  #define PRIregister "08x"
>  #elif defined (CONFIG_ARM_64)

... you tweak things here, when we're in the process of moving stuff
out of asm/types.h. (Using "unsigned long" for a 32-bit paddr_t is of
course suspicious as well - this ought to be uint32_t.)

Jan



 


Rackspace

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