[XEN v4 00/11] Add support for 32 bit physical address

Ayan Kumar Halder posted 11 patches 1 year ago
Test gitlab-ci passed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230321140357.24094-1-ayan.kumar.halder@amd.com
xen/arch/Kconfig                           |   6 ++
xen/arch/arm/Kconfig                       |  40 +++++++-
xen/arch/arm/bootfdt.c                     |  41 ++++++--
xen/arch/arm/domain_build.c                | 103 +++++++++++++--------
xen/arch/arm/gic-v2.c                      |  16 ++--
xen/arch/arm/gic-v3-its.c                  |   4 +-
xen/arch/arm/gic-v3.c                      |  10 +-
xen/arch/arm/guest_walk.c                  |   2 +
xen/arch/arm/include/asm/lpae.h            |   4 +
xen/arch/arm/include/asm/page-bits.h       |   6 +-
xen/arch/arm/include/asm/setup.h           |   4 +-
xen/arch/arm/include/asm/types.h           |   6 ++
xen/arch/arm/mm.c                          |  10 +-
xen/arch/arm/p2m.c                         |  29 +++---
xen/arch/arm/pci/pci-host-common.c         |   6 +-
xen/arch/arm/platforms/brcm-raspberry-pi.c |   2 +-
xen/arch/arm/platforms/brcm.c              |   4 +-
xen/arch/arm/platforms/exynos5.c           |  32 +++----
xen/arch/arm/platforms/sunxi.c             |   2 +-
xen/arch/arm/platforms/xgene-storm.c       |   2 +-
xen/arch/arm/setup.c                       |  14 +--
xen/arch/arm/smpboot.c                     |   2 +-
xen/common/device_tree.c                   |  40 +++++++-
xen/drivers/char/cadence-uart.c            |   4 +-
xen/drivers/char/exynos4210-uart.c         |   4 +-
xen/drivers/char/imx-lpuart.c              |   4 +-
xen/drivers/char/meson-uart.c              |   4 +-
xen/drivers/char/mvebu-uart.c              |   4 +-
xen/drivers/char/ns16550.c                 |  43 ++++++---
xen/drivers/char/omap-uart.c               |   4 +-
xen/drivers/char/pl011.c                   |   6 +-
xen/drivers/char/scif-uart.c               |   4 +-
xen/drivers/passthrough/arm/ipmmu-vmsa.c   |   8 +-
xen/drivers/passthrough/arm/smmu-v3.c      |   2 +-
xen/drivers/passthrough/arm/smmu.c         |  23 ++---
xen/include/xen/device_tree.h              |  27 +++++-
xen/include/xen/libfdt/libfdt-xen.h        |  52 +++++++++++
37 files changed, 397 insertions(+), 177 deletions(-)
create mode 100644 xen/include/xen/libfdt/libfdt-xen.h
[XEN v4 00/11] Add support for 32 bit physical address
Posted by Ayan Kumar Halder 1 year ago
Hi All,

Please have a look at https://lists.xenproject.org/archives/html/xen-devel/2022-11/msg01465.html
for the context.

The benefits of using 32 bit physical addresses are as follows :-

1. It helps to use Xen on platforms (for eg R52) which supports 32 bit
physical addresses and has no support for large physical address extension.
On 32 bit MPU systems which supports flat-mapping (for eg R52), it helps
to translate 32 bit VA into 32 bit PA.

2. It also helps in code optimization when the underlying platform does not
use large physical address extension.

The current patch serie depends on :-
"[XEN v5] xen/arm: Use the correct format specifier"
https://lists.xenproject.org/archives/html/xen-devel/2023-01/msg01896.html
I did not send out the patch again as it has already been reviewed and acked and
is waiting to be committed to staging.

The following points are to be noted :-
1. Device tree always use u64 for address and size. The caller needs to
translate between u64 and u32 (when 32 bit physical addressing is used).
2. Currently, we have enabled this option for Arm_32 as the MMU for Arm_64
uses 48 bit physical addressing.
3. https://lists.xenproject.org/archives/html/xen-devel/2022-12/msg00117.html
has been added to this series.

Changes from :

v1 - 1. Reordered the patches such that the first three patches fixes issues in
the existing codebase. These can be applied independent of the remaining patches
in this serie,

2. Dropped translate_dt_address_size() for the address/size translation between
paddr_t and u64 (as parsed from the device tree). Also, dropped the check for
truncation (while converting u64 to paddr_t).
Instead now we have modified device_tree_get_reg() and typecasted the return for
dt_read_number(), to obtain paddr_t. Also, introduced wrappers for
fdt_get_mem_rsv() and dt_device_get_address() for the same purpose. These can be
found in patch 4/11 and patch 6/11.

3. Split "Other adaptations required to support 32bit paddr" into the following
individual patches for each adaptation :
  xen/arm: smmu: Use writeq_relaxed_non_atomic() for writing to
    SMMU_CBn_TTBR0
  xen/arm: guest_walk: LPAE specific bits should be enclosed within
    "ifndef CONFIG_ARM_PA_32"

4. Introduced "xen/arm: p2m: Enable support for 32bit IPA".

v2 - 1. Dropped patches 1/11, 2/11 and 3/11 from the v2 as it has already been
committed (except 2/11 - "[XEN v5] xen/arm: Use the correct format specifier"
which is waiting to be committed).

2. Introduced a new patch "xen/drivers: ns16550: Use paddr_t for io_base/io_size".

v3 - 1. Combined the patches from https://lists.xenproject.org/archives/html/xen-devel/2023-02/msg00656.html in this series.

Ayan Kumar Halder (11):
  xen/arm: Use the correct format specifier
  xen/arm: domain_build: Track unallocated pages using the frame number
  xen/arm: Typecast the DT values into paddr_t
  xen/drivers: ns16550: Use paddr_t for io_base/io_size
  xen/arm: Introduce a wrapper for dt_device_get_address() to handle
    paddr_t
  xen/arm: smmu: Use writeq_relaxed_non_atomic() for writing to
    SMMU_CBn_TTBR0
  xen/arm: Introduce choice to enable 64/32 bit physical addressing
  xen/arm: guest_walk: LPAE specific bits should be enclosed within
    "ifndef CONFIG_PHYS_ADDR_T_32"
  xen/arm: Restrict zeroeth_table_offset for ARM_64
  xen/arm: p2m: Use the pa_range_info table to support Arm_32 and Arm_64
  xen/arm: p2m: Enable support for 32bit IPA for ARM_32

 xen/arch/Kconfig                           |   6 ++
 xen/arch/arm/Kconfig                       |  40 +++++++-
 xen/arch/arm/bootfdt.c                     |  41 ++++++--
 xen/arch/arm/domain_build.c                | 103 +++++++++++++--------
 xen/arch/arm/gic-v2.c                      |  16 ++--
 xen/arch/arm/gic-v3-its.c                  |   4 +-
 xen/arch/arm/gic-v3.c                      |  10 +-
 xen/arch/arm/guest_walk.c                  |   2 +
 xen/arch/arm/include/asm/lpae.h            |   4 +
 xen/arch/arm/include/asm/page-bits.h       |   6 +-
 xen/arch/arm/include/asm/setup.h           |   4 +-
 xen/arch/arm/include/asm/types.h           |   6 ++
 xen/arch/arm/mm.c                          |  10 +-
 xen/arch/arm/p2m.c                         |  29 +++---
 xen/arch/arm/pci/pci-host-common.c         |   6 +-
 xen/arch/arm/platforms/brcm-raspberry-pi.c |   2 +-
 xen/arch/arm/platforms/brcm.c              |   4 +-
 xen/arch/arm/platforms/exynos5.c           |  32 +++----
 xen/arch/arm/platforms/sunxi.c             |   2 +-
 xen/arch/arm/platforms/xgene-storm.c       |   2 +-
 xen/arch/arm/setup.c                       |  14 +--
 xen/arch/arm/smpboot.c                     |   2 +-
 xen/common/device_tree.c                   |  40 +++++++-
 xen/drivers/char/cadence-uart.c            |   4 +-
 xen/drivers/char/exynos4210-uart.c         |   4 +-
 xen/drivers/char/imx-lpuart.c              |   4 +-
 xen/drivers/char/meson-uart.c              |   4 +-
 xen/drivers/char/mvebu-uart.c              |   4 +-
 xen/drivers/char/ns16550.c                 |  43 ++++++---
 xen/drivers/char/omap-uart.c               |   4 +-
 xen/drivers/char/pl011.c                   |   6 +-
 xen/drivers/char/scif-uart.c               |   4 +-
 xen/drivers/passthrough/arm/ipmmu-vmsa.c   |   8 +-
 xen/drivers/passthrough/arm/smmu-v3.c      |   2 +-
 xen/drivers/passthrough/arm/smmu.c         |  23 ++---
 xen/include/xen/device_tree.h              |  27 +++++-
 xen/include/xen/libfdt/libfdt-xen.h        |  52 +++++++++++
 37 files changed, 397 insertions(+), 177 deletions(-)
 create mode 100644 xen/include/xen/libfdt/libfdt-xen.h

-- 
2.17.1