All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Andrew Jones <drjones@redhat.com>
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, thuth@redhat.com,
	dgibson@redhat.com, agraf@suse.de, lvivier@redhat.com,
	pbonzini@redhat.com, rkrcmar@redhat.com
Subject: Re: [kvm-unit-tests PATCH v5 09/18] powerpc/ppc64: start skeleton framework
Date: Fri, 19 Feb 2016 02:11:13 +0000	[thread overview]
Message-ID: <20160219021113.GS15224@voom.fritz.box> (raw)
In-Reply-To: <1455734459-31902-10-git-send-email-drjones@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 10504 bytes --]

On Wed, Feb 17, 2016 at 07:40:50PM +0100, Andrew Jones wrote:
> Use the arm/arm64 framework as a template to start a skeleton
> for powerpc/ppc64. Copy the arm makefiles and linker script
> verbatim. We'll modify them for powerpc with the next patch,
> making it clear what needs to be changed.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> Reviewed-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  configure                   |  2 ++
>  lib/powerpc/.gitignore      |  1 +
>  lib/powerpc/io.c            | 20 +++++++++++++
>  lib/ppc64/.gitignore        |  1 +
>  lib/ppc64/asm-offsets.c     | 12 ++++++++
>  lib/ppc64/asm/asm-offsets.h |  1 +
>  lib/ppc64/asm/io.h          |  5 ++++
>  lib/ppc64/asm/page.h        |  1 +
>  lib/ppc64/asm/spinlock.h    | 11 +++++++
>  lib/ppc64/spinlock.c        | 11 +++++++
>  powerpc/Makefile            |  1 +
>  powerpc/Makefile.common     | 73 +++++++++++++++++++++++++++++++++++++++++++++
>  powerpc/Makefile.ppc64      | 20 +++++++++++++
>  powerpc/cstart64.S          | 20 +++++++++++++
>  powerpc/flat.lds            | 27 +++++++++++++++++
>  powerpc/selftest.c          |  7 +++++
>  16 files changed, 213 insertions(+)
>  create mode 100644 lib/powerpc/.gitignore
>  create mode 100644 lib/powerpc/io.c
>  create mode 100644 lib/ppc64/.gitignore
>  create mode 100644 lib/ppc64/asm-offsets.c
>  create mode 100644 lib/ppc64/asm/asm-offsets.h
>  create mode 100644 lib/ppc64/asm/io.h
>  create mode 100644 lib/ppc64/asm/page.h
>  create mode 100644 lib/ppc64/asm/spinlock.h
>  create mode 100644 lib/ppc64/spinlock.c
>  create mode 100644 powerpc/Makefile
>  create mode 100644 powerpc/Makefile.common
>  create mode 100644 powerpc/Makefile.ppc64
>  create mode 100644 powerpc/cstart64.S
>  create mode 100644 powerpc/flat.lds
>  create mode 100644 powerpc/selftest.c
> 
> diff --git a/configure b/configure
> index 078b70ce096a6..b367224093369 100755
> --- a/configure
> +++ b/configure
> @@ -80,6 +80,8 @@ if [ "$arch" = "i386" ] || [ "$arch" = "x86_64" ]; then
>      testdir=x86
>  elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
>      testdir=arm
> +elif [ "$arch" = "ppc64" ]; then
> +    testdir=powerpc
>  else
>      testdir=$arch
>  fi
> diff --git a/lib/powerpc/.gitignore b/lib/powerpc/.gitignore
> new file mode 100644
> index 0000000000000..84872bf197c67
> --- /dev/null
> +++ b/lib/powerpc/.gitignore
> @@ -0,0 +1 @@
> +asm-offsets.[hs]
> diff --git a/lib/powerpc/io.c b/lib/powerpc/io.c
> new file mode 100644
> index 0000000000000..0af45742fc900
> --- /dev/null
> +++ b/lib/powerpc/io.c
> @@ -0,0 +1,20 @@
> +/*
> + * Each architecture must implement puts() and exit().
> + *
> + * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU LGPL, version 2.
> + */
> +#include <libcflat.h>
> +
> +void io_init(void)
> +{
> +}
> +
> +void puts(const char *s __unused)
> +{
> +}
> +
> +void exit(int code __unused)
> +{
> +}
> diff --git a/lib/ppc64/.gitignore b/lib/ppc64/.gitignore
> new file mode 100644
> index 0000000000000..84872bf197c67
> --- /dev/null
> +++ b/lib/ppc64/.gitignore
> @@ -0,0 +1 @@
> +asm-offsets.[hs]
> diff --git a/lib/ppc64/asm-offsets.c b/lib/ppc64/asm-offsets.c
> new file mode 100644
> index 0000000000000..2d38a716976f2
> --- /dev/null
> +++ b/lib/ppc64/asm-offsets.c
> @@ -0,0 +1,12 @@
> +/*
> + * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU LGPL, version 2.
> + */
> +#include <libcflat.h>
> +#include <kbuild.h>
> +
> +int main(void)
> +{
> +	return 0;
> +}
> diff --git a/lib/ppc64/asm/asm-offsets.h b/lib/ppc64/asm/asm-offsets.h
> new file mode 100644
> index 0000000000000..d370ee36a182b
> --- /dev/null
> +++ b/lib/ppc64/asm/asm-offsets.h
> @@ -0,0 +1 @@
> +#include <generated/asm-offsets.h>
> diff --git a/lib/ppc64/asm/io.h b/lib/ppc64/asm/io.h
> new file mode 100644
> index 0000000000000..c0801d4762ba6
> --- /dev/null
> +++ b/lib/ppc64/asm/io.h
> @@ -0,0 +1,5 @@
> +#ifndef _ASMPPC64_IO_H_
> +#define _ASMPPC64_IO_H_
> +#define __cpu_is_be() (1)
> +#include <asm-generic/io.h>
> +#endif
> diff --git a/lib/ppc64/asm/page.h b/lib/ppc64/asm/page.h
> new file mode 100644
> index 0000000000000..1a8b62711f288
> --- /dev/null
> +++ b/lib/ppc64/asm/page.h
> @@ -0,0 +1 @@
> +#include <asm-generic/page.h>
> diff --git a/lib/ppc64/asm/spinlock.h b/lib/ppc64/asm/spinlock.h
> new file mode 100644
> index 0000000000000..002cdb194b1db
> --- /dev/null
> +++ b/lib/ppc64/asm/spinlock.h
> @@ -0,0 +1,11 @@
> +#ifndef _ASMPPC64_SPINLOCK_H_
> +#define _ASMPPC64_SPINLOCK_H_
> +
> +struct spinlock {
> +	int v;
> +};
> +
> +extern void spin_lock(struct spinlock *lock);
> +extern void spin_unlock(struct spinlock *lock);
> +
> +#endif /* _ASMPPC64_SPINLOCK_H_ */
> diff --git a/lib/ppc64/spinlock.c b/lib/ppc64/spinlock.c
> new file mode 100644
> index 0000000000000..522f8d047c970
> --- /dev/null
> +++ b/lib/ppc64/spinlock.c
> @@ -0,0 +1,11 @@
> +#include <asm/spinlock.h>
> +
> +void spin_lock(struct spinlock *lock)
> +{
> +        lock->v = 1;
> +}
> +
> +void spin_unlock(struct spinlock *lock)
> +{
> +        lock->v = 0;
> +}
> diff --git a/powerpc/Makefile b/powerpc/Makefile
> new file mode 100644
> index 0000000000000..369a38b2d1703
> --- /dev/null
> +++ b/powerpc/Makefile
> @@ -0,0 +1 @@
> +include $(TEST_DIR)/Makefile.$(ARCH)
> diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common
> new file mode 100644
> index 0000000000000..dd3a0ca327d06
> --- /dev/null
> +++ b/powerpc/Makefile.common
> @@ -0,0 +1,73 @@
> +#
> +# arm common makefile
> +#
> +# Authors: Andrew Jones <drjones@redhat.com>
> +#
> +
> +ifeq ($(LOADADDR),)
> +	# qemu mach-virt default load address
> +	LOADADDR = 0x40000000
> +endif
> +
> +tests-common = \
> +	$(TEST_DIR)/selftest.flat \
> +	$(TEST_DIR)/spinlock-test.flat
> +
> +all: test_cases
> +
> +##################################################################
> +phys_base = $(LOADADDR)
> +
> +CFLAGS += -std=gnu99
> +CFLAGS += -ffreestanding
> +CFLAGS += -Wextra
> +CFLAGS += -O2
> +CFLAGS += -I lib -I lib/libfdt
> +
> +asm-offsets = lib/$(ARCH)/asm-offsets.h
> +include scripts/asm-offsets.mak
> +
> +cflatobjs += lib/util.o
> +cflatobjs += lib/alloc.o
> +cflatobjs += lib/devicetree.o
> +cflatobjs += lib/virtio.o
> +cflatobjs += lib/virtio-mmio.o
> +cflatobjs += lib/chr-testdev.o
> +cflatobjs += lib/arm/io.o
> +cflatobjs += lib/arm/setup.o
> +cflatobjs += lib/arm/mmu.o
> +cflatobjs += lib/arm/bitops.o
> +cflatobjs += lib/arm/psci.o
> +cflatobjs += lib/arm/smp.o
> +
> +libeabi = lib/arm/libeabi.a
> +eabiobjs = lib/arm/eabi_compat.o
> +
> +libgcc := $(shell $(CC) $(machine) --print-libgcc-file-name)
> +start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) )))
> +
> +FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)
> +%.elf: LDFLAGS = $(CFLAGS) -nostdlib
> +%.elf: %.o $(FLATLIBS) arm/flat.lds
> +	$(CC) $(LDFLAGS) -o $@ \
> +		-Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
> +		$(filter %.o, $^) $(FLATLIBS)
> +
> +%.flat: %.elf
> +	$(OBJCOPY) -O binary $^ $@
> +
> +$(libeabi): $(eabiobjs)
> +	$(AR) rcs $@ $^
> +
> +arm_clean: libfdt_clean asm_offsets_clean
> +	$(RM) $(TEST_DIR)/*.{o,flat,elf} $(libeabi) $(eabiobjs) \
> +	      $(TEST_DIR)/.*.d lib/arm/.*.d
> +
> +##################################################################
> +
> +generated_files = $(asm-offsets)
> +
> +test_cases: $(generated_files) $(tests-common) $(tests)
> +
> +$(TEST_DIR)/selftest.elf: $(cstart.o) $(TEST_DIR)/selftest.o
> +$(TEST_DIR)/spinlock-test.elf: $(cstart.o) $(TEST_DIR)/spinlock-test.o
> diff --git a/powerpc/Makefile.ppc64 b/powerpc/Makefile.ppc64
> new file mode 100644
> index 0000000000000..0b0761c729c7c
> --- /dev/null
> +++ b/powerpc/Makefile.ppc64
> @@ -0,0 +1,20 @@
> +#
> +# arm64 makefile
> +#
> +# Authors: Andrew Jones <drjones@redhat.com>
> +#
> +bits = 64
> +ldarch = elf64-littleaarch64
> +kernel_offset = 0x80000
> +
> +cstart.o = $(TEST_DIR)/cstart64.o
> +cflatobjs += lib/arm64/processor.o
> +cflatobjs += lib/arm64/spinlock.o
> +
> +# arm64 specific tests
> +tests =
> +
> +include $(TEST_DIR)/Makefile.common
> +
> +arch_clean: arm_clean
> +	$(RM) lib/arm64/.*.d
> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
> new file mode 100644
> index 0000000000000..f90828dee1c19
> --- /dev/null
> +++ b/powerpc/cstart64.S
> @@ -0,0 +1,20 @@
> +/*
> + * Entry point and assembler functions for ppc64 tests.
> + *
> + * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU LGPL, version 2.
> + */
> +#define __ASSEMBLY__
> +
> +.section .init
> +
> +.globl start
> +start:
> +	b	halt
> +
> +.text
> +
> +.globl halt
> +halt:
> +1:	b	1b
> diff --git a/powerpc/flat.lds b/powerpc/flat.lds
> new file mode 100644
> index 0000000000000..efdf5d7109ffb
> --- /dev/null
> +++ b/powerpc/flat.lds
> @@ -0,0 +1,27 @@
> +
> +SECTIONS
> +{
> +    .text : { *(.init) *(.text) *(.text.*) }
> +    . = ALIGN(64K);
> +    etext = .;
> +    .data : {
> +        *(.data)
> +    }
> +    . = ALIGN(16);
> +    .rodata : { *(.rodata) }
> +    . = ALIGN(16);
> +    .bss : { *(.bss) }
> +    . = ALIGN(64K);
> +    edata = .;
> +    . += 64K;
> +    . = ALIGN(64K);
> +    /*
> +     * stack depth is 16K for arm and PAGE_SIZE for arm64, see THREAD_SIZE
> +     * sp must be 16 byte aligned for arm64, and 8 byte aligned for arm
> +     * sp must always be strictly less than the true stacktop
> +     */
> +    stackptr = . - 16;
> +    stacktop = .;
> +}
> +
> +ENTRY(start)
> diff --git a/powerpc/selftest.c b/powerpc/selftest.c
> new file mode 100644
> index 0000000000000..2f2a5215dd55c
> --- /dev/null
> +++ b/powerpc/selftest.c
> @@ -0,0 +1,7 @@
> +#include <libcflat.h>
> +
> +int main(void)
> +{
> +	printf("hello world\n");
> +	return 0;
> +}

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: David Gibson <david@gibson.dropbear.id.au>
To: Andrew Jones <drjones@redhat.com>
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, thuth@redhat.com,
	dgibson@redhat.com, agraf@suse.de, lvivier@redhat.com,
	pbonzini@redhat.com, rkrcmar@redhat.com
Subject: Re: [kvm-unit-tests PATCH v5 09/18] powerpc/ppc64: start skeleton framework
Date: Fri, 19 Feb 2016 13:11:13 +1100	[thread overview]
Message-ID: <20160219021113.GS15224@voom.fritz.box> (raw)
In-Reply-To: <1455734459-31902-10-git-send-email-drjones@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 10504 bytes --]

On Wed, Feb 17, 2016 at 07:40:50PM +0100, Andrew Jones wrote:
> Use the arm/arm64 framework as a template to start a skeleton
> for powerpc/ppc64. Copy the arm makefiles and linker script
> verbatim. We'll modify them for powerpc with the next patch,
> making it clear what needs to be changed.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> Reviewed-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  configure                   |  2 ++
>  lib/powerpc/.gitignore      |  1 +
>  lib/powerpc/io.c            | 20 +++++++++++++
>  lib/ppc64/.gitignore        |  1 +
>  lib/ppc64/asm-offsets.c     | 12 ++++++++
>  lib/ppc64/asm/asm-offsets.h |  1 +
>  lib/ppc64/asm/io.h          |  5 ++++
>  lib/ppc64/asm/page.h        |  1 +
>  lib/ppc64/asm/spinlock.h    | 11 +++++++
>  lib/ppc64/spinlock.c        | 11 +++++++
>  powerpc/Makefile            |  1 +
>  powerpc/Makefile.common     | 73 +++++++++++++++++++++++++++++++++++++++++++++
>  powerpc/Makefile.ppc64      | 20 +++++++++++++
>  powerpc/cstart64.S          | 20 +++++++++++++
>  powerpc/flat.lds            | 27 +++++++++++++++++
>  powerpc/selftest.c          |  7 +++++
>  16 files changed, 213 insertions(+)
>  create mode 100644 lib/powerpc/.gitignore
>  create mode 100644 lib/powerpc/io.c
>  create mode 100644 lib/ppc64/.gitignore
>  create mode 100644 lib/ppc64/asm-offsets.c
>  create mode 100644 lib/ppc64/asm/asm-offsets.h
>  create mode 100644 lib/ppc64/asm/io.h
>  create mode 100644 lib/ppc64/asm/page.h
>  create mode 100644 lib/ppc64/asm/spinlock.h
>  create mode 100644 lib/ppc64/spinlock.c
>  create mode 100644 powerpc/Makefile
>  create mode 100644 powerpc/Makefile.common
>  create mode 100644 powerpc/Makefile.ppc64
>  create mode 100644 powerpc/cstart64.S
>  create mode 100644 powerpc/flat.lds
>  create mode 100644 powerpc/selftest.c
> 
> diff --git a/configure b/configure
> index 078b70ce096a6..b367224093369 100755
> --- a/configure
> +++ b/configure
> @@ -80,6 +80,8 @@ if [ "$arch" = "i386" ] || [ "$arch" = "x86_64" ]; then
>      testdir=x86
>  elif [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
>      testdir=arm
> +elif [ "$arch" = "ppc64" ]; then
> +    testdir=powerpc
>  else
>      testdir=$arch
>  fi
> diff --git a/lib/powerpc/.gitignore b/lib/powerpc/.gitignore
> new file mode 100644
> index 0000000000000..84872bf197c67
> --- /dev/null
> +++ b/lib/powerpc/.gitignore
> @@ -0,0 +1 @@
> +asm-offsets.[hs]
> diff --git a/lib/powerpc/io.c b/lib/powerpc/io.c
> new file mode 100644
> index 0000000000000..0af45742fc900
> --- /dev/null
> +++ b/lib/powerpc/io.c
> @@ -0,0 +1,20 @@
> +/*
> + * Each architecture must implement puts() and exit().
> + *
> + * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU LGPL, version 2.
> + */
> +#include <libcflat.h>
> +
> +void io_init(void)
> +{
> +}
> +
> +void puts(const char *s __unused)
> +{
> +}
> +
> +void exit(int code __unused)
> +{
> +}
> diff --git a/lib/ppc64/.gitignore b/lib/ppc64/.gitignore
> new file mode 100644
> index 0000000000000..84872bf197c67
> --- /dev/null
> +++ b/lib/ppc64/.gitignore
> @@ -0,0 +1 @@
> +asm-offsets.[hs]
> diff --git a/lib/ppc64/asm-offsets.c b/lib/ppc64/asm-offsets.c
> new file mode 100644
> index 0000000000000..2d38a716976f2
> --- /dev/null
> +++ b/lib/ppc64/asm-offsets.c
> @@ -0,0 +1,12 @@
> +/*
> + * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU LGPL, version 2.
> + */
> +#include <libcflat.h>
> +#include <kbuild.h>
> +
> +int main(void)
> +{
> +	return 0;
> +}
> diff --git a/lib/ppc64/asm/asm-offsets.h b/lib/ppc64/asm/asm-offsets.h
> new file mode 100644
> index 0000000000000..d370ee36a182b
> --- /dev/null
> +++ b/lib/ppc64/asm/asm-offsets.h
> @@ -0,0 +1 @@
> +#include <generated/asm-offsets.h>
> diff --git a/lib/ppc64/asm/io.h b/lib/ppc64/asm/io.h
> new file mode 100644
> index 0000000000000..c0801d4762ba6
> --- /dev/null
> +++ b/lib/ppc64/asm/io.h
> @@ -0,0 +1,5 @@
> +#ifndef _ASMPPC64_IO_H_
> +#define _ASMPPC64_IO_H_
> +#define __cpu_is_be() (1)
> +#include <asm-generic/io.h>
> +#endif
> diff --git a/lib/ppc64/asm/page.h b/lib/ppc64/asm/page.h
> new file mode 100644
> index 0000000000000..1a8b62711f288
> --- /dev/null
> +++ b/lib/ppc64/asm/page.h
> @@ -0,0 +1 @@
> +#include <asm-generic/page.h>
> diff --git a/lib/ppc64/asm/spinlock.h b/lib/ppc64/asm/spinlock.h
> new file mode 100644
> index 0000000000000..002cdb194b1db
> --- /dev/null
> +++ b/lib/ppc64/asm/spinlock.h
> @@ -0,0 +1,11 @@
> +#ifndef _ASMPPC64_SPINLOCK_H_
> +#define _ASMPPC64_SPINLOCK_H_
> +
> +struct spinlock {
> +	int v;
> +};
> +
> +extern void spin_lock(struct spinlock *lock);
> +extern void spin_unlock(struct spinlock *lock);
> +
> +#endif /* _ASMPPC64_SPINLOCK_H_ */
> diff --git a/lib/ppc64/spinlock.c b/lib/ppc64/spinlock.c
> new file mode 100644
> index 0000000000000..522f8d047c970
> --- /dev/null
> +++ b/lib/ppc64/spinlock.c
> @@ -0,0 +1,11 @@
> +#include <asm/spinlock.h>
> +
> +void spin_lock(struct spinlock *lock)
> +{
> +        lock->v = 1;
> +}
> +
> +void spin_unlock(struct spinlock *lock)
> +{
> +        lock->v = 0;
> +}
> diff --git a/powerpc/Makefile b/powerpc/Makefile
> new file mode 100644
> index 0000000000000..369a38b2d1703
> --- /dev/null
> +++ b/powerpc/Makefile
> @@ -0,0 +1 @@
> +include $(TEST_DIR)/Makefile.$(ARCH)
> diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common
> new file mode 100644
> index 0000000000000..dd3a0ca327d06
> --- /dev/null
> +++ b/powerpc/Makefile.common
> @@ -0,0 +1,73 @@
> +#
> +# arm common makefile
> +#
> +# Authors: Andrew Jones <drjones@redhat.com>
> +#
> +
> +ifeq ($(LOADADDR),)
> +	# qemu mach-virt default load address
> +	LOADADDR = 0x40000000
> +endif
> +
> +tests-common = \
> +	$(TEST_DIR)/selftest.flat \
> +	$(TEST_DIR)/spinlock-test.flat
> +
> +all: test_cases
> +
> +##################################################################
> +phys_base = $(LOADADDR)
> +
> +CFLAGS += -std=gnu99
> +CFLAGS += -ffreestanding
> +CFLAGS += -Wextra
> +CFLAGS += -O2
> +CFLAGS += -I lib -I lib/libfdt
> +
> +asm-offsets = lib/$(ARCH)/asm-offsets.h
> +include scripts/asm-offsets.mak
> +
> +cflatobjs += lib/util.o
> +cflatobjs += lib/alloc.o
> +cflatobjs += lib/devicetree.o
> +cflatobjs += lib/virtio.o
> +cflatobjs += lib/virtio-mmio.o
> +cflatobjs += lib/chr-testdev.o
> +cflatobjs += lib/arm/io.o
> +cflatobjs += lib/arm/setup.o
> +cflatobjs += lib/arm/mmu.o
> +cflatobjs += lib/arm/bitops.o
> +cflatobjs += lib/arm/psci.o
> +cflatobjs += lib/arm/smp.o
> +
> +libeabi = lib/arm/libeabi.a
> +eabiobjs = lib/arm/eabi_compat.o
> +
> +libgcc := $(shell $(CC) $(machine) --print-libgcc-file-name)
> +start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) )))
> +
> +FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)
> +%.elf: LDFLAGS = $(CFLAGS) -nostdlib
> +%.elf: %.o $(FLATLIBS) arm/flat.lds
> +	$(CC) $(LDFLAGS) -o $@ \
> +		-Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
> +		$(filter %.o, $^) $(FLATLIBS)
> +
> +%.flat: %.elf
> +	$(OBJCOPY) -O binary $^ $@
> +
> +$(libeabi): $(eabiobjs)
> +	$(AR) rcs $@ $^
> +
> +arm_clean: libfdt_clean asm_offsets_clean
> +	$(RM) $(TEST_DIR)/*.{o,flat,elf} $(libeabi) $(eabiobjs) \
> +	      $(TEST_DIR)/.*.d lib/arm/.*.d
> +
> +##################################################################
> +
> +generated_files = $(asm-offsets)
> +
> +test_cases: $(generated_files) $(tests-common) $(tests)
> +
> +$(TEST_DIR)/selftest.elf: $(cstart.o) $(TEST_DIR)/selftest.o
> +$(TEST_DIR)/spinlock-test.elf: $(cstart.o) $(TEST_DIR)/spinlock-test.o
> diff --git a/powerpc/Makefile.ppc64 b/powerpc/Makefile.ppc64
> new file mode 100644
> index 0000000000000..0b0761c729c7c
> --- /dev/null
> +++ b/powerpc/Makefile.ppc64
> @@ -0,0 +1,20 @@
> +#
> +# arm64 makefile
> +#
> +# Authors: Andrew Jones <drjones@redhat.com>
> +#
> +bits = 64
> +ldarch = elf64-littleaarch64
> +kernel_offset = 0x80000
> +
> +cstart.o = $(TEST_DIR)/cstart64.o
> +cflatobjs += lib/arm64/processor.o
> +cflatobjs += lib/arm64/spinlock.o
> +
> +# arm64 specific tests
> +tests =
> +
> +include $(TEST_DIR)/Makefile.common
> +
> +arch_clean: arm_clean
> +	$(RM) lib/arm64/.*.d
> diff --git a/powerpc/cstart64.S b/powerpc/cstart64.S
> new file mode 100644
> index 0000000000000..f90828dee1c19
> --- /dev/null
> +++ b/powerpc/cstart64.S
> @@ -0,0 +1,20 @@
> +/*
> + * Entry point and assembler functions for ppc64 tests.
> + *
> + * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU LGPL, version 2.
> + */
> +#define __ASSEMBLY__
> +
> +.section .init
> +
> +.globl start
> +start:
> +	b	halt
> +
> +.text
> +
> +.globl halt
> +halt:
> +1:	b	1b
> diff --git a/powerpc/flat.lds b/powerpc/flat.lds
> new file mode 100644
> index 0000000000000..efdf5d7109ffb
> --- /dev/null
> +++ b/powerpc/flat.lds
> @@ -0,0 +1,27 @@
> +
> +SECTIONS
> +{
> +    .text : { *(.init) *(.text) *(.text.*) }
> +    . = ALIGN(64K);
> +    etext = .;
> +    .data : {
> +        *(.data)
> +    }
> +    . = ALIGN(16);
> +    .rodata : { *(.rodata) }
> +    . = ALIGN(16);
> +    .bss : { *(.bss) }
> +    . = ALIGN(64K);
> +    edata = .;
> +    . += 64K;
> +    . = ALIGN(64K);
> +    /*
> +     * stack depth is 16K for arm and PAGE_SIZE for arm64, see THREAD_SIZE
> +     * sp must be 16 byte aligned for arm64, and 8 byte aligned for arm
> +     * sp must always be strictly less than the true stacktop
> +     */
> +    stackptr = . - 16;
> +    stacktop = .;
> +}
> +
> +ENTRY(start)
> diff --git a/powerpc/selftest.c b/powerpc/selftest.c
> new file mode 100644
> index 0000000000000..2f2a5215dd55c
> --- /dev/null
> +++ b/powerpc/selftest.c
> @@ -0,0 +1,7 @@
> +#include <libcflat.h>
> +
> +int main(void)
> +{
> +	printf("hello world\n");
> +	return 0;
> +}

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-02-19  2:11 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17 18:40 [kvm-unit-tests PATCH v5 00/18] ppc64: initial drop Andrew Jones
2016-02-17 18:40 ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 01/18] arm/arm64: trivial: another assert fix Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 02/18] Makefile: cscope: also look in arch shared asm Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-18  2:36   ` David Gibson
2016-02-18  2:36     ` David Gibson
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 03/18] lib: asm-generic: add missing casts Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 04/18] devicetree: fix dt_get_memory_params Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 05/18] arm/arm64: setup improvements Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 06/18] lib: add vprintf Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-18  2:44   ` David Gibson
2016-02-18  2:44     ` David Gibson
2016-02-18  6:34   ` Thomas Huth
2016-02-18  6:34     ` Thomas Huth
2016-02-18 10:21     ` Andrew Jones
2016-02-18 10:21       ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 07/18] lib: share arm-selftest utility functions Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 08/18] config: no need to mix arch makefiles Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 09/18] powerpc/ppc64: start skeleton framework Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-19  2:11   ` David Gibson [this message]
2016-02-19  2:11     ` David Gibson
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 10/18] powerpc/ppc64: ppc-ify makefiles and linker script Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 11/18] powerpc/ppc64: add a boot rom Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 12/18] powerpc/ppc64: add hcall support and putchar Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-19  3:10   ` David Gibson
2016-02-19  3:10     ` David Gibson
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 13/18] powerpc/ppc64: adapt arm's setup Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-19  3:40   ` David Gibson
2016-02-19  3:40     ` David Gibson
2016-02-19  7:49     ` Andrew Jones
2016-02-19  7:49       ` Andrew Jones
2016-02-22  1:00       ` David Gibson
2016-02-22  1:00         ` David Gibson
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 14/18] powerpc/ppc64: relocate linker VMAs Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 15/18] powerpc/ppc64: add run script and unittests.cfg Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-19  3:43   ` David Gibson
2016-02-19  3:43     ` David Gibson
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 16/18] mkstandalone: add support for powerpc Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-18 14:51   ` Radim Krčmář
2016-02-18 14:51     ` Radim Krčmář
2016-02-19  3:53   ` David Gibson
2016-02-19  3:53     ` David Gibson
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 17/18] powerpc/ppc64: add RTAS support Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-19  4:08   ` David Gibson
2016-02-19  4:08     ` David Gibson
2016-02-19  7:52     ` Andrew Jones
2016-02-19  7:52       ` Andrew Jones
2016-02-17 18:40 ` [kvm-unit-tests PATCH v5 18/18] powerpc/ppc64: make a fake debug-exit Andrew Jones
2016-02-17 18:40   ` Andrew Jones
2016-02-19  4:12   ` David Gibson
2016-02-19  4:12     ` David Gibson

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=20160219021113.GS15224@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=dgibson@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=thuth@redhat.com \
    /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.