[kvm-unit-tests PATCH 23/32] powerpc: Add MMU support

Andrew Jones andrew.jones at linux.dev
Wed Feb 28 23:01:17 AEDT 2024


On Mon, Feb 26, 2024 at 08:12:09PM +1000, Nicholas Piggin wrote:
> Add support for radix MMU, 4kB and 64kB pages.
> 
> This also adds MMU interrupt test cases, and runs the interrupts
> test entirely with MMU enabled if it is available (aside from
> machine check tests).
> 
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
>  configure                     |  39 +++--
>  lib/powerpc/asm/hcall.h       |   6 +
>  lib/powerpc/asm/processor.h   |   1 +
>  lib/powerpc/asm/reg.h         |   3 +
>  lib/powerpc/asm/smp.h         |   2 +
>  lib/powerpc/processor.c       |   9 ++
>  lib/powerpc/setup.c           |   4 +
>  lib/ppc64/asm/mmu.h           |  11 ++
>  lib/ppc64/asm/page.h          |  67 ++++++++-
>  lib/ppc64/asm/pgtable-hwdef.h |  67 +++++++++
>  lib/ppc64/asm/pgtable.h       | 126 ++++++++++++++++
>  lib/ppc64/mmu.c               | 273 ++++++++++++++++++++++++++++++++++
>  lib/ppc64/opal-calls.S        |   4 +-
>  powerpc/Makefile.common       |   2 +
>  powerpc/Makefile.ppc64        |   1 +
>  powerpc/interrupts.c          |  96 ++++++++++--
>  16 files changed, 684 insertions(+), 27 deletions(-)
>  create mode 100644 lib/ppc64/asm/mmu.h
>  create mode 100644 lib/ppc64/asm/pgtable-hwdef.h
>  create mode 100644 lib/ppc64/asm/pgtable.h
>  create mode 100644 lib/ppc64/mmu.c
> 
> diff --git a/configure b/configure
> index 05e6702ea..6907ccbbb 100755
> --- a/configure
> +++ b/configure
> @@ -222,29 +222,35 @@ fi
>  if [ -z "$page_size" ]; then
>      if [ "$efi" = 'y' ] && [ "$arch" = "arm64" ]; then
>          page_size="4096"
> -    elif [ "$arch" = "arm64" ]; then
> +    elif [ "$arch" = "arm64" ] || [ "$arch" = "ppc64" ]; then
>          page_size="65536"
>      elif [ "$arch" = "arm" ]; then
>          page_size="4096"
>      fi
>  else
> -    if [ "$arch" != "arm64" ]; then
> -        echo "--page-size is not supported for $arch"
> -        usage
> -    fi
> -
>      if [ "${page_size: -1}" = "K" ] || [ "${page_size: -1}" = "k" ]; then
>          page_size=$(( ${page_size%?} * 1024 ))
>      fi
> -    if [ "$page_size" != "4096" ] && [ "$page_size" != "16384" ] &&
> -           [ "$page_size" != "65536" ]; then
> -        echo "arm64 doesn't support page size of $page_size"
> +
> +    if [ "$arch" = "arm64" ]; then
> +        if [ "$page_size" != "4096" ] && [ "$page_size" != "16384" ] &&
> +               [ "$page_size" != "65536" ]; then
> +            echo "arm64 doesn't support page size of $page_size"
> +            usage
> +        fi
> +        if [ "$efi" = 'y' ] && [ "$page_size" != "4096" ]; then
> +            echo "efi must use 4K pages"
> +            exit 1
> +        fi
> +    elif [ "$arch" = "ppc64" ]; then
> +        if [ "$page_size" != "4096" ] && [ "$page_size" != "65536" ]; then
> +            echo "ppc64 doesn't support page size of $page_size"
> +            usage
> +        fi
> +    else
> +        echo "--page-size is not supported for $arch"
>          usage
>      fi
> -    if [ "$efi" = 'y' ] && [ "$page_size" != "4096" ]; then
> -        echo "efi must use 4K pages"
> -        exit 1
> -    fi
>  fi
>  
>  [ -z "$processor" ] && processor="$arch"
> @@ -444,6 +450,13 @@ cat <<EOF >> lib/config.h
>  
>  #define CONFIG_UART_EARLY_BASE ${arm_uart_early_addr}
>  #define CONFIG_ERRATA_FORCE ${errata_force}
> +
> +EOF
> +fi
> +
> +if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ] || [ "$arch" = "ppc64" ]; then
> +cat <<EOF >> lib/config.h
> +
>  #define CONFIG_PAGE_SIZE _AC(${page_size}, UL)
>  
>  EOF

Ack for the configure changes.

Thanks,
drew


More information about the Linuxppc-dev mailing list