[PATCH 01/17] remove unused files

Andrew Jones
2014-01-21T16:22:42Z

There are several unused files, primarily because powerpc is an unused
arch. The exceptions are config-ia64.mak, which is also an unused arch
file, lib/fwcfg.c, lib/panic.c, x86/print.h and x86/run-kvm-unit-tests,
which are just unused. Remove them all in order to tidy things up.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
Makefile | 8 +-
config-ia64.mak | 7 -
config-powerpc-440.mak | 15 -
config-powerpc.mak | 39 ---
formats | 31 --
iotable.c | 53 ----
iotable.h | 40 ---
kvmtrace.c | 706 ---------------------------------------------
kvmtrace_format | 532 ----------------------------------
lib/fwcfg.c | 58 ----
lib/libcflat.h | 1 -
lib/panic.c | 13 -
lib/powerpc/44x/map.c | 51 ----
lib/powerpc/44x/timebase.S | 28 --
lib/powerpc/44x/timebase.h | 25 --
lib/powerpc/44x/tlbwe.S | 29 --
lib/powerpc/io.c | 35 ---
main-ppc.c | 383 ------------------------
powerpc/44x/tlbsx.S | 33 ---
powerpc/44x/tlbwe.S | 27 --
powerpc/44x/tlbwe_16KB.S | 35 ---
powerpc/44x/tlbwe_hole.S | 27 --
powerpc/cstart.S | 38 ---
powerpc/exit.c | 23 --
powerpc/helloworld.c | 27 --
powerpc/io.S | 32 --
powerpc/spin.S | 4 -
powerpc/sprg.S | 7 -
x86/print.h | 19 --
x86/run-kvm-unit-tests | 6 -
30 files changed, 1 insertion(+), 2331 deletions(-)
delete mode 100644 config-ia64.mak
delete mode 100644 config-powerpc-440.mak
delete mode 100644 config-powerpc.mak
delete mode 100644 formats
delete mode 100644 iotable.c
delete mode 100644 iotable.h
delete mode 100644 kvmtrace.c
delete mode 100755 kvmtrace_format
delete mode 100644 lib/fwcfg.c
delete mode 100644 lib/panic.c
delete mode 100644 lib/powerpc/44x/map.c
delete mode 100644 lib/powerpc/44x/timebase.S
delete mode 100644 lib/powerpc/44x/timebase.h
delete mode 100644 lib/powerpc/44x/tlbwe.S
delete mode 100644 lib/powerpc/io.c
delete mode 100644 main-ppc.c
delete mode 100644 powerpc/44x/tlbsx.S
delete mode 100644 powerpc/44x/tlbwe.S
delete mode 100644 powerpc/44x/tlbwe_16KB.S
delete mode 100644 powerpc/44x/tlbwe_hole.S
delete mode 100644 powerpc/cstart.S
delete mode 100644 powerpc/exit.c
delete mode 100644 powerpc/helloworld.c
delete mode 100644 powerpc/io.S
delete mode 100644 powerpc/spin.S
delete mode 100644 powerpc/sprg.S
delete mode 100644 x86/print.h
delete mode 100644 x86/run-kvm-unit-tests

diff --git a/Makefile b/Makefile
index b6e87598721a6..278791dbbef23 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,6 @@ libgcc := $(shell $(CC) --print-libgcc-file-name)

libcflat := lib/libcflat.a
cflatobjs := \
- lib/panic.o \
lib/printf.o \
lib/string.o
cflatobjs += lib/argv.o
@@ -39,11 +38,6 @@ autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d
LDFLAGS += $(CFLAGS)
LDFLAGS += -pthread -lrt

-kvmtrace_objs= kvmtrace.o
-
-kvmtrace: $(kvmtrace_objs)
- $(CC) $(LDFLAGS) $^ -o $@
-
$(libcflat): $(cflatobjs)
$(AR) rcs $@ $^

@@ -57,4 +51,4 @@ install:
install $(tests_and_config) $(DESTDIR)

clean: arch_clean
- $(RM) kvmtrace *.o *.a .*.d $(libcflat) $(cflatobjs)
+ $(RM) *.o *.a .*.d $(libcflat) $(cflatobjs)
diff --git a/config-ia64.mak b/config-ia64.mak
deleted file mode 100644
index d9350fcc5a9ec..0000000000000
--- a/config-ia64.mak
+++ /dev/null
@@ -1,7 +0,0 @@
-bits = 64
-CFLAGS += -m64
-CFLAGS += -D__ia64__
-CFLAGS += -I../include/ia64
-
-all:
-
diff --git a/config-powerpc-440.mak b/config-powerpc-440.mak
deleted file mode 100644
index bb8597153b30e..0000000000000
--- a/config-powerpc-440.mak
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-# for some reason binutils hates tlbsx unless we say we're 405 :(
-CFLAGS += -Wa,-m405 -I lib/powerpc/44x
-
-cflatobjs += \
- lib/powerpc/44x/map.o \
- lib/powerpc/44x/tlbwe.o \
- lib/powerpc/44x/timebase.o
-
-simpletests += \
- powerpc/44x/tlbsx.bin \
- powerpc/44x/tlbwe_16KB.bin \
- powerpc/44x/tlbwe_hole.bin \
- powerpc/44x/tlbwe.bin
diff --git a/config-powerpc.mak b/config-powerpc.mak
deleted file mode 100644
index d053569b8aa3c..0000000000000
--- a/config-powerpc.mak
+++ /dev/null
@@ -1,39 +0,0 @@
-CFLAGS += -I../include/powerpc
-CFLAGS += -Wa,-mregnames -I lib
-CFLAGS += -ffreestanding
-
-cstart := powerpc/cstart.o
-
-cflatobjs += \
- lib/powerpc/io.o
-
-$(libcflat): LDFLAGS += -nostdlib
-
-# these tests do not use libcflat
-simpletests := \
- powerpc/spin.bin \
- powerpc/io.bin \
- powerpc/sprg.bin
-
-# theses tests use cstart.o, libcflat, and libgcc
-tests := \
- powerpc/exit.bin \
- powerpc/helloworld.bin
-
-include config-powerpc-$(PROCESSOR).mak
-
-
-all: kvmtrace kvmctl $(libcflat) $(simpletests) $(tests)
-
-$(simpletests): %.bin: %.o
- $(CC) -nostdlib $^ -Wl,-T,flat.lds -o $@
-
-$(tests): %.bin: $(cstart) %.o $(libcflat)
- $(CC) -nostdlib $^ $(libgcc) -Wl,-T,flat.lds -o $@
-
-kvmctl_objs = main-ppc.o iotable.o ../libkvm/libkvm.a
-
-arch_clean:
- $(RM) $(simpletests) $(tests) $(cstart)
- $(RM) $(patsubst %.bin, %.elf, $(simpletests) $(tests))
- $(RM) $(patsubst %.bin, %.o, $(simpletests) $(tests))
diff --git a/formats b/formats
deleted file mode 100644
index 7f4ebdbcedaa2..0000000000000
--- a/formats
+++ /dev/null
@@ -1,31 +0,0 @@
-0x00000000 %(ts)d (+%(relts)12d) unknown (0x%(event)016x) vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ 0x%(1)08x 0x%(2)08x 0x%(3)08x 0x%(4)08x 0x%(5)08x ]
-
-0x00010001 %(ts)d (+%(relts)12d) VMENTRY vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x
-0x00010002 %(ts)d (+%(relts)12d) VMEXIT vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ exitcode = 0x%(1)08x, rip = 0x%(3)08x %(2)08x ]
-0x00020001 %(ts)d (+%(relts)12d) PAGE_FAULT vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ errorcode = 0x%(1)08x, virt = 0x%(3)08x %(2)08x ]
-0x00020002 %(ts)d (+%(relts)12d) INJ_VIRQ vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ vector = 0x%(1)02x ]
-0x00020003 %(ts)d (+%(relts)12d) REDELIVER_EVT vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ vector = 0x%(1)02x ]
-0x00020004 %(ts)d (+%(relts)12d) PEND_INTR vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ vector = 0x%(1)02x ]
-0x00020005 %(ts)d (+%(relts)12d) IO_READ vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ port = 0x%(1)04x, size = %(2)d ]
-0x00020006 %(ts)d (+%(relts)12d) IO_WRITE vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ port = 0x%(1)04x, size = %(2)d ]
-0x00020007 %(ts)d (+%(relts)12d) CR_READ vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ CR# = %(1)d, value = 0x%(3)08x %(2)08x ]
-0x00020008 %(ts)d (+%(relts)12d) CR_WRITE vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ CR# = %(1)d, value = 0x%(3)08x %(2)08x ]
-0x00020009 %(ts)d (+%(relts)12d) DR_READ vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ DR# = %(1)d, value = 0x%(2)08x ]
-0x0002000A %(ts)d (+%(relts)12d) DR_WRITE vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ DR# = %(1)d, value = 0x%(2)08x ]
-0x0002000B %(ts)d (+%(relts)12d) MSR_READ vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ MSR# = 0x%(1)08x, data = 0x%(3)08x %(2)08x ]
-0x0002000C %(ts)d (+%(relts)12d) MSR_WRITE vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ MSR# = 0x%(1)08x, data = 0x%(3)08x %(2)08x ]
-0x0002000D %(ts)d (+%(relts)12d) CPUID vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ func = 0x%(1)08x, eax = 0x%(2)08x, ebx = 0x%(3)08x, ecx = 0x%(4)08x edx = 0x%(5)08x]
-0x0002000E %(ts)d (+%(relts)12d) INTR vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ vector = 0x%(1)02x ]
-0x0002000F %(ts)d (+%(relts)12d) NMI vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x
-0x00020010 %(ts)d (+%(relts)12d) VMMCALL vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ func = 0x%(1)08x ]
-0x00020011 %(ts)d (+%(relts)12d) HLT vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x
-0x00020012 %(ts)d (+%(relts)12d) CLTS vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x
-0x00020013 %(ts)d (+%(relts)12d) LMSW vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ value = 0x%(1)08x ]
-0x00020014 %(ts)d (+%(relts)12d) APIC_ACCESS vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ offset = 0x%(1)08x ]
-0x00020015 %(ts)d (+%(relts)12d) TDP_FAULT vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ errorcode = 0x%(1)08x, virt = 0x%(3)08x %(2)08x ]
-# ppc: tlb traces
-0x00020016 GTLB_WRITE vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ index = 0x%(1)08x, tid = 0x%(2)08x, word1=0x%(3)08x, word2=0x%(4)08x, word3=0x%(5)08x ]
-0x00020017 STLB_WRITE vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ index = 0x%(1)08x, tid = 0x%(2)08x, word1=0x%(3)08x, word2=0x%(4)08x, word3=0x%(5)08x ]
-0x00020018 STLB_INVAL vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ index = 0x%(1)08x, tid = 0x%(2)08x, word1=0x%(3)08x, word2=0x%(4)08x, word3=0x%(5)08x ]
-# ppc: instruction emulation - this type is handled more complex in kvmtrace_format, but listed to show the eventid and transported data
-#0x00020019 %(ts)d (+%(relts)12d) PPC_INSTR vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ instr = 0x%(1)08x, pc = 0x%(2)08x, emul = 0x%(3)08x, nsec = %(4)08d ]
diff --git a/iotable.c b/iotable.c
deleted file mode 100644
index 91a5016c42005..0000000000000
--- a/iotable.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Kernel-based Virtual Machine test driver
- *
- * This test driver provides a simple way of testing kvm, without a full
- * device model.
- *
- * Copyright (C) 2006 Qumranet
- *
- * Authors:
- *
- * Avi Kivity <avi@qumranet.com>
- * Yaniv Kamay <yaniv@qumranet.com>
- *
- * This work is licensed under the GNU LGPL license, version 2.
- */
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <errno.h>
-
-#include "iotable.h"
-
-struct io_table_entry *io_table_lookup(struct io_table *io_table, uint64_t addr)
-{
- int i;
-
- for (i = 0; i < io_table->nr_entries; i++) {
- if (io_table->entries[i].start <= addr &&
- addr < io_table->entries[i].end)
- return &io_table->entries[i];
- }
-
- return NULL;
-}
-
-int io_table_register(struct io_table *io_table, uint64_t start, uint64_t size,
- io_table_handler_t *handler, void *opaque)
-{
- struct io_table_entry *entry;
-
- if (io_table->nr_entries == MAX_IO_TABLE)
- return -ENOSPC;
-
- entry = &io_table->entries[io_table->nr_entries];
- io_table->nr_entries++;
-
- entry->start = start;
- entry->end = start + size;
- entry->handler = handler;
- entry->opaque = opaque;
-
- return 0;
-}
diff --git a/iotable.h b/iotable.h
deleted file mode 100644
index cb18f23789be1..0000000000000
--- a/iotable.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Kernel-based Virtual Machine test driver
- *
- * This test driver provides a simple way of testing kvm, without a full
- * device model.
- *
- * Copyright (C) 2006 Qumranet
- *
- * Authors:
- *
- * Avi Kivity <avi@qumranet.com>
- * Yaniv Kamay <yaniv@qumranet.com>
- *
- * This work is licensed under the GNU LGPL license, version 2.
- */
-
-#include <stdint.h>
-
-#define MAX_IO_TABLE 50
-
-typedef int (io_table_handler_t)(void *, int, int, uint64_t, uint64_t *);
-
-struct io_table_entry
-{
- uint64_t start;
- uint64_t end;
- io_table_handler_t *handler;
- void *opaque;
-};
-
-struct io_table
-{
- int nr_entries;
- struct io_table_entry entries[MAX_IO_TABLE];
-};
-
-struct io_table_entry *io_table_lookup(struct io_table *io_table,
- uint64_t addr);
-int io_table_register(struct io_table *io_table, uint64_t start, uint64_t size,
- io_table_handler_t *handler, void *opaque);
diff --git a/kvmtrace.c b/kvmtrace.c
deleted file mode 100644
index de3c1897f4660..0000000000000
--- a/kvmtrace.c
+++ /dev/null
@@ -1,706 +0,0 @@
-/*
- * kvm tracing application
- *
- * This tool is used for collecting trace buffer data
- * for kvm trace.
- *
- * Based on blktrace 0.99.3
- *
- * Copyright (C) 2005 Jens Axboe <axboe@suse.de>
- * Copyright (C) 2006 Jens Axboe <axboe@kernel.dk>
- * Copyright (C) 2008 Eric Liu <eric.e.liu@intel.com>
- *
- * This work is licensed under the GNU LGPL license, version 2.
- */
-
-#define _GNU_SOURCE
-
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/param.h>
-#include <sys/statfs.h>
-#include <sys/poll.h>
-#include <sys/mman.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <getopt.h>
-#include <errno.h>
-#include <sched.h>
-
-#ifndef __user
-#define __user
-#endif
-#include <linux/kvm.h>
-
-static char kvmtrace_version[] = "0.1";
-
-/*
- * You may want to increase this even more, if you are logging at a high
- * rate and see skipped/missed events
- */
-#define BUF_SIZE (512 * 1024)
-#define BUF_NR (8)
-
-#define OFILE_BUF (128 * 1024)
-
-#define DEBUGFS_TYPE 0x64626720
-
-#define max(a, b) ((a) > (b) ? (a) : (b))
-
-#define S_OPTS "r:o:w:?Vb:n:D:"
-static struct option l_opts[] = {
- {
- .name = "relay",
- .has_arg = required_argument,
- .flag = NULL,
- .val = 'r'
- },
- {
- .name = "output",
- .has_arg = required_argument,
- .flag = NULL,
- .val = 'o'
- },
- {
- .name = "stopwatch",
- .has_arg = required_argument,
- .flag = NULL,
- .val = 'w'
- },
- {
- .name = "version",
- .has_arg = no_argument,
- .flag = NULL,
- .val = 'V'
- },
- {
- .name = "buffer-size",
- .has_arg = required_argument,
- .flag = NULL,
- .val = 'b'
- },
- {
- .name = "num-sub-buffers",
- .has_arg = required_argument,
- .flag = NULL,
- .val = 'n'
- },
- {
- .name = "output-dir",
- .has_arg = required_argument,
- .flag = NULL,
- .val = 'D'
- },
- {
- .name = NULL,
- }
-};
-
-struct thread_information {
- int cpu;
- pthread_t thread;
-
- int fd;
- char fn[MAXPATHLEN + 64];
-
- FILE *ofile;
- char *ofile_buffer;
-
- int (*get_subbuf)(struct thread_information *, unsigned int);
- int (*read_data)(struct thread_information *, void *, unsigned int);
-
- unsigned long long data_read;
-
- struct kvm_trace_information *trace_info;
-
- int exited;
-
- /*
- * mmap controlled output files
- */
- unsigned long long fs_size;
- unsigned long long fs_max_size;
- unsigned long fs_off;
- void *fs_buf;
- unsigned long fs_buf_len;
-
-};
-
-struct kvm_trace_information {
- int fd;
- volatile int trace_started;
- unsigned long lost_records;
- struct thread_information *threads;
- unsigned long buf_size;
- unsigned long buf_nr;
-};
-
-static struct kvm_trace_information trace_information;
-
-static int ncpus;
-static char default_debugfs_path[] = "/sys/kernel/debug";
-
-/* command line option globals */
-static char *debugfs_path;
-static char *output_name;
-static char *output_dir;
-static int stop_watch;
-static unsigned long buf_size = BUF_SIZE;
-static unsigned long buf_nr = BUF_NR;
-static unsigned int page_size;
-
-#define for_each_cpu_online(cpu) \
- for (cpu = 0; cpu < ncpus; cpu++)
-#define for_each_tip(tip, i) \
- for (i = 0, tip = trace_information.threads; i < ncpus; i++, tip++)
-
-#define is_done() (*(volatile int *)(&done))
-static volatile int done;
-
-#define is_trace_stopped() (*(volatile int *)(&trace_stopped))
-static volatile int trace_stopped;
-
-static void exit_trace(int status);
-
-static void handle_sigint(__attribute__((__unused__)) int sig)
-{
- ioctl(trace_information.fd, KVM_TRACE_PAUSE);
- done = 1;
-}
-
-static int get_lost_records()
-{
- int fd;
- char tmp[MAXPATHLEN + 64];
-
- snprintf(tmp, sizeof(tmp), "%s/kvm/lost_records", debugfs_path);
- fd = open(tmp, O_RDONLY);
- if (fd < 0) {
- /*
- * this may be ok, if the kernel doesn't support dropped counts
- */
- if (errno == ENOENT)
- return 0;
-
- fprintf(stderr, "Couldn't open dropped file %s\n", tmp);
- return -1;
- }
-
- if (read(fd, tmp, sizeof(tmp)) < 0) {
- perror(tmp);
- close(fd);
- return -1;
- }
- close(fd);
-
- return atoi(tmp);
-}
-
-static void wait_for_data(struct thread_information *tip, int timeout)
-{
- struct pollfd pfd = { .fd = tip->fd, .events = POLLIN };
-
- while (!is_done()) {
- if (poll(&pfd, 1, timeout) < 0) {
- perror("poll");
- break;
- }
- if (pfd.revents & POLLIN)
- break;
- }
-}
-
-static int read_data(struct thread_information *tip, void *buf,
- unsigned int len)
-{
- int ret = 0;
-
- do {
- wait_for_data(tip, 100);
-
- ret = read(tip->fd, buf, len);
-
- if (!ret)
- continue;
- else if (ret > 0)
- return ret;
- else {
- if (errno != EAGAIN) {
- perror(tip->fn);
- fprintf(stderr, "Thread %d failed read of %s\n",
- tip->cpu, tip->fn);
- break;
- }
- continue;
- }
- } while (!is_done());
-
- return ret;
-
-}
-
-/*
- * For file output, truncate and mmap the file appropriately
- */
-static int mmap_subbuf(struct thread_information *tip, unsigned int maxlen)
-{
- int ofd = fileno(tip->ofile);
- int ret;
- unsigned long nr;
- unsigned long size;
-
- /*
- * extend file, if we have to. use chunks of 16 subbuffers.
- */
- if (tip->fs_off + maxlen > tip->fs_buf_len) {
- if (tip->fs_buf) {
- munlock(tip->fs_buf, tip->fs_buf_len);
- munmap(tip->fs_buf, tip->fs_buf_len);
- tip->fs_buf = NULL;
- }
-
- tip->fs_off = tip->fs_size & (page_size - 1);
- nr = max(16, tip->trace_info->buf_nr);
- size = tip->trace_info->buf_size;
- tip->fs_buf_len = (nr * size) - tip->fs_off;
- tip->fs_max_size += tip->fs_buf_len;
-
- if (ftruncate(ofd, tip->fs_max_size) < 0) {
- perror("ftruncate");
- return -1;
- }
-
- tip->fs_buf = mmap(NULL, tip->fs_buf_len, PROT_WRITE,
- MAP_SHARED, ofd, tip->fs_size - tip->fs_off);
- if (tip->fs_buf == MAP_FAILED) {
- perror("mmap");
- return -1;
- }
- mlock(tip->fs_buf, tip->fs_buf_len);
- }
-
- ret = tip->read_data(tip, tip->fs_buf + tip->fs_off, maxlen);
- if (ret >= 0) {
- tip->data_read += ret;
- tip->fs_size += ret;
- tip->fs_off += ret;
- return 0;
- }
-
- return -1;
-}
-
-static void tip_ftrunc_final(struct thread_information *tip)
-{
- /*
- * truncate to right size and cleanup mmap
- */
- if (tip->ofile) {
- int ofd = fileno(tip->ofile);
-
- if (tip->fs_buf)
- munmap(tip->fs_buf, tip->fs_buf_len);
-
- ftruncate(ofd, tip->fs_size);
- }
-}
-
-static void *thread_main(void *arg)
-{
- struct thread_information *tip = arg;
- pid_t pid = getpid();
- cpu_set_t cpu_mask;
-
- CPU_ZERO(&cpu_mask);
- CPU_SET((tip->cpu), &cpu_mask);
-
- if (sched_setaffinity(pid, sizeof(cpu_mask), &cpu_mask) == -1) {
- perror("sched_setaffinity");
- exit_trace(1);
- }
-
- snprintf(tip->fn, sizeof(tip->fn), "%s/kvm/trace%d",
- debugfs_path, tip->cpu);
- tip->fd = open(tip->fn, O_RDONLY);
- if (tip->fd < 0) {
- perror(tip->fn);
- fprintf(stderr, "Thread %d failed open of %s\n", tip->cpu,
- tip->fn);
- exit_trace(1);
- }
- while (!is_done()) {
- if (tip->get_subbuf(tip, tip->trace_info->buf_size) < 0)
- break;
- }
-
- /*
- * trace is stopped, pull data until we get a short read
- */
- while (tip->get_subbuf(tip, tip->trace_info->buf_size) > 0)
- ;
-
- tip_ftrunc_final(tip);
- tip->exited = 1;
- return NULL;
-}
-
-static int fill_ofname(struct thread_information *tip, char *dst)
-{
- struct stat sb;
- int len = 0;
-
- if (output_dir)
- len = sprintf(dst, "%s/", output_dir);
- else
- len = sprintf(dst, "./");
-
- if (stat(dst, &sb) < 0) {
- if (errno != ENOENT) {
- perror("stat");
- return 1;
- }
- if (mkdir(dst, 0755) < 0) {
- perror(dst);
- fprintf(stderr, "Can't make output dir\n");
- return 1;
- }
- }
-
- sprintf(dst + len, "%s.kvmtrace.%d", output_name, tip->cpu);
-
- return 0;
-}
-
-static void fill_ops(struct thread_information *tip)
-{
- tip->get_subbuf = mmap_subbuf;
- tip->read_data = read_data;
-}
-
-static void close_thread(struct thread_information *tip)
-{
- if (tip->fd != -1)
- close(tip->fd);
- if (tip->ofile)
- fclose(tip->ofile);
- if (tip->ofile_buffer)
- free(tip->ofile_buffer);
-
- tip->fd = -1;
- tip->ofile = NULL;
- tip->ofile_buffer = NULL;
-}
-
-static int tip_open_output(struct thread_information *tip)
-{
- int mode, vbuf_size;
- char op[NAME_MAX];
-
- if (fill_ofname(tip, op))
- return 1;
-
- tip->ofile = fopen(op, "w+");
- mode = _IOFBF;
- vbuf_size = OFILE_BUF;
-
- if (tip->ofile == NULL) {
- perror(op);
- return 1;
- }
-
- tip->ofile_buffer = malloc(vbuf_size);
- if (setvbuf(tip->ofile, tip->ofile_buffer, mode, vbuf_size)) {
- perror("setvbuf");
- close_thread(tip);
- return 1;
- }
-
- fill_ops(tip);
- return 0;
-}
-
-static int start_threads(int cpu)
-{
- struct thread_information *tip;
-
- tip = trace_information.threads + cpu;
- tip->cpu = cpu;
- tip->trace_info = &trace_information;
- tip->fd = -1;
-
- if (tip_open_output(tip))
- return 1;
-
- if (pthread_create(&tip->thread, NULL, thread_main, tip)) {
- perror("pthread_create");
- close_thread(tip);
- return 1;
- }
-
- return 0;
-}
-
-static void stop_threads()
-{
- struct thread_information *tip;
- unsigned long ret;
- int i;
-
- for_each_tip(tip, i) {
- if (tip->thread)
- (void) pthread_join(tip->thread, (void *) &ret);
- close_thread(tip);
- }
-}
-
-static int start_trace(void)
-{
- int fd;
- struct kvm_user_trace_setup kuts;
-
- fd = trace_information.fd = open("/dev/kvm", O_RDWR);
- if (fd == -1) {
- perror("/dev/kvm");
- return 1;
- }
-
- memset(&kuts, 0, sizeof(kuts));
- kuts.buf_size = trace_information.buf_size = buf_size;
- kuts.buf_nr = trace_information.buf_nr = buf_nr;
-
- if (ioctl(trace_information.fd , KVM_TRACE_ENABLE, &kuts) < 0) {
- perror("KVM_TRACE_ENABLE");
- close(fd);
- return 1;
- }
- trace_information.trace_started = 1;
-
- return 0;
-}
-
-static void cleanup_trace(void)
-{
- if (trace_information.fd == -1)
- return;
-
- trace_information.lost_records = get_lost_records();
-
- if (trace_information.trace_started) {
- trace_information.trace_started = 0;
- if (ioctl(trace_information.fd, KVM_TRACE_DISABLE) < 0)
- perror("KVM_TRACE_DISABLE");
- }
-
- close(trace_information.fd);
- trace_information.fd = -1;
-}
-
-static void stop_all_traces(void)
-{
- if (!is_trace_stopped()) {
- trace_stopped = 1;
- stop_threads();
- cleanup_trace();
- }
-}
-
-static void exit_trace(int status)
-{
- stop_all_traces();
- exit(status);
-}
-
-static int start_kvm_trace(void)
-{
- int i, size;
- struct thread_information *tip;
-
- size = ncpus * sizeof(struct thread_information);
- tip = malloc(size);
- if (!tip) {
- fprintf(stderr, "Out of memory, threads (%d)\n", size);
- return 1;
- }
- memset(tip, 0, size);
- trace_information.threads = tip;
-
- if (start_trace())
- return 1;
-
- for_each_cpu_online(i) {
- if (start_threads(i)) {
- fprintf(stderr, "Failed to start worker threads\n");
- break;
- }
- }
-
- if (i != ncpus) {
- stop_threads();
- cleanup_trace();
- return 1;
- }
-
- return 0;
-}
-
-static void wait_for_threads(void)
-{
- struct thread_information *tip;
- int i, tips_running;
-
- do {
- tips_running = 0;
- usleep(100000);
-
- for_each_tip(tip, i)
- tips_running += !tip->exited;
-
- } while (tips_running);
-}
-
-static void show_stats(void)
-{
- struct thread_information *tip;
- unsigned long long data_read;
- int i;
-
- data_read = 0;
- for_each_tip(tip, i) {
- printf(" CPU%3d: %8llu KiB data\n",
- tip->cpu, (tip->data_read + 1023) >> 10);
- data_read += tip->data_read;
- }
-
- printf(" Total: lost %lu, %8llu KiB data\n",
- trace_information.lost_records, (data_read + 1023) >> 10);
-
- if (trace_information.lost_records)
- fprintf(stderr, "You have lost records, "
- "consider using a larger buffer size (-b)\n");
-}
-
-static char usage_str[] = \
- "[ -r debugfs path ] [ -D output dir ] [ -b buffer size ]\n" \
- "[ -n number of buffers] [ -o ] [ -w time ] [ -V ]\n\n" \
- "\t-r Path to mounted debugfs, defaults to /sys/kernel/debug\n" \
- "\t-o File(s) to send output to\n" \
- "\t-D Directory to prepend to output file names\n" \
- "\t-w Stop after defined time, in seconds\n" \
- "\t-b Sub buffer size in KiB\n" \
- "\t-n Number of sub buffers\n" \
- "\t-V Print program version info\n\n";
-
-static void show_usage(char *prog)
-{
- fprintf(stderr, "Usage: %s %s %s", prog, kvmtrace_version, usage_str);
- exit(EXIT_FAILURE);
-}
-
-void parse_args(int argc, char **argv)
-{
- int c;
-
- while ((c = getopt_long(argc, argv, S_OPTS, l_opts, NULL)) >= 0) {
- switch (c) {
- case 'r':
- debugfs_path = optarg;
- break;
- case 'o':
- output_name = optarg;
- break;
- case 'w':
- stop_watch = atoi(optarg);
- if (stop_watch <= 0) {
- fprintf(stderr,
- "Invalid stopwatch value (%d secs)\n",
- stop_watch);
- exit(EXIT_FAILURE);
- }
- break;
- case 'V':
- printf("%s version %s\n", argv[0], kvmtrace_version);
- exit(EXIT_SUCCESS);
- case 'b':
- buf_size = strtoul(optarg, NULL, 10);
- if (buf_size <= 0 || buf_size > 16*1024) {
- fprintf(stderr,
- "Invalid buffer size (%lu)\n",
- buf_size);
- exit(EXIT_FAILURE);
- }
- buf_size <<= 10;
- break;
- case 'n':
- buf_nr = strtoul(optarg, NULL, 10);
- if (buf_nr <= 0) {
- fprintf(stderr,
- "Invalid buffer nr (%lu)\n", buf_nr);
- exit(EXIT_FAILURE);
- }
- break;
- case 'D':
- output_dir = optarg;
- break;
- default:
- show_usage(argv[0]);
- }
- }
-
- if (optind < argc || output_name == NULL)
- show_usage(argv[0]);
-}
-
-int main(int argc, char *argv[])
-{
- struct statfs st;
-
- parse_args(argc, argv);
-
- if (!debugfs_path)
- debugfs_path = default_debugfs_path;
-
- if (statfs(debugfs_path, &st) < 0) {
- perror("statfs");
- fprintf(stderr, "%s does not appear to be a valid path\n",
- debugfs_path);
- return 1;
- } else if (st.f_type != (long) DEBUGFS_TYPE) {
- fprintf(stderr, "%s does not appear to be a debug filesystem,"
- " please mount debugfs.\n",
- debugfs_path);
- return 1;
- }
-
- page_size = getpagesize();
-
- ncpus = sysconf(_SC_NPROCESSORS_ONLN);
- if (ncpus < 0) {
- fprintf(stderr, "sysconf(_SC_NPROCESSORS_ONLN) failed\n");
- return 1;
- }
-
- signal(SIGINT, handle_sigint);
- signal(SIGHUP, handle_sigint);
- signal(SIGTERM, handle_sigint);
- signal(SIGALRM, handle_sigint);
- signal(SIGPIPE, SIG_IGN);
-
- if (start_kvm_trace() != 0)
- return 1;
-
- if (stop_watch)
- alarm(stop_watch);
-
- wait_for_threads();
- stop_all_traces();
- show_stats();
-
- return 0;
-}
diff --git a/kvmtrace_format b/kvmtrace_format
deleted file mode 100755
index 6556475f726c4..0000000000000
--- a/kvmtrace_format
+++ /dev/null
@@ -1,532 +0,0 @@
-#!/usr/bin/env python
-
-# by Mark Williamson, (C) 2004 Intel Research Cambridge
-
-# Program for reformatting trace buffer output according to user-supplied rules
-
-import re, sys, string, signal, struct, os, getopt, operator
-
-PREFIX = '/usr'
-DATADIR = os.path.join(PREFIX, 'share')
-KVMDIR = os.path.join(DATADIR, 'kvm')
-FORMATS_FILE = os.path.join(KVMDIR, 'formats')
-
-def usage():
- print >> sys.stderr, \
- "Usage: " + sys.argv[0] + """ defs-file
- Parses trace data in binary format, as output by kvmtrace and
- reformats it according to the rules in a file of definitions. The
- rules in this file should have the format ({ and } show grouping
- and are not part of the syntax):
-
- {event_id}{whitespace}{text format string}
-
- The textual format string may include format specifiers, such as:
- %(ts)d, %(event)d, %(pid)d %(vcpu)d %(1)d, %(2)d,
- %(3)d, %(4)d, %(5)d
- [ the 'd' format specifier outputs in decimal, alternatively 'x'
- will output in hexadecimal and 'o' will output in octal ]
-
- Which correspond to the event ID, timestamp counter, pid
- , vcpu and the 5 data fields from the trace record. There should be
- one such rule for each type of event.
- Depending on your system and the volume of trace buffer data,
- this script may not be able to keep up with the output of kvmtrace
- if it is piped directly. In these circumstances you should have
- kvmtrace output to a file for processing off-line.
-
- kvmtrace_format has the following additional switches
- -s - if this switch is set additional trace statistics are
- created and printed at the end of the output
- """
- sys.exit(1)
-
-def read_defs(defs_file):
- defs = {}
-
- fd = open(defs_file)
-
- reg = re.compile('(\S+)\s+(\S.*)')
-
- while True:
- line = fd.readline()
- if not line:
- break
-
- if line[0] == '#' or line[0] == '\n':
- continue
-
- m = reg.match(line)
-
- if not m: print >> sys.stderr, "Bad format file" ; sys.exit(1)
-
- defs[str(eval(m.group(1)))] = m.group(2)
-
- return defs
-
-def sighand(x,y):
- global interrupted
- interrupted = 1
-
-# ppc instruction decoding for event type 0x00020019 (PPC_INSTR)
-# some globals for statistic summaries
-stat_ppc_instr_mnemonic = {};
-stat_ppc_instr_spr = {};
-stat_ppc_instr_dcr = {};
-stat_ppc_instr_tlb = {};
-
-def ppc_instr_print_summary(sortedlist, colname):
- print "\n\n%14s + %10s" % (colname, "count")
- print "%s" % (15*"-"+"+"+11*"-")
- sum = 0
- for value, key in sortedlist:
- sum += key
- print "%14s | %10d" % (value, key)
- print "%14s = %10d" % ("sum", sum)
-
-
-def ppc_instr_summary():
- # don't print empty statistics
- if stat_ppc_instr_mnemonic:
- ppc_instr_print_summary(sorted(stat_ppc_instr_mnemonic.iteritems(), key=operator.itemgetter(1), reverse=True), "mnemonic")
- if stat_ppc_instr_spr:
- ppc_instr_print_summary(sorted(stat_ppc_instr_spr.iteritems(), key=operator.itemgetter(1), reverse=True), "mnemonic-spr")
- if stat_ppc_instr_dcr:
- ppc_instr_print_summary(sorted(stat_ppc_instr_dcr.iteritems(), key=operator.itemgetter(1), reverse=True), "mnemonic-dcr")
- if stat_ppc_instr_tlb:
- ppc_instr_print_summary(sorted(stat_ppc_instr_tlb.iteritems(), key=operator.itemgetter(1), reverse=True), "mnemonic-tlb")
-
-def get_op(instr):
- return (instr >> 26);
-
-def get_xop(instr):
- return (instr >> 1) & 0x3ff;
-
-def get_sprn(instr):
- return ((instr >> 16) & 0x1f) | ((instr >> 6) & 0x3e0)
-
-def get_dcrn(instr):
- return ((instr >> 16) & 0x1f) | ((instr >> 6) & 0x3e0);
-
-def get_tlbwe_type(instr):
- ws = (instr >> 11) & 0x1f;
- if ws == 0:
- return "PAGEID"
- elif ws == 1:
- return "XLAT"
- elif ws == 2:
- return "ATTRIB"
- else:
- return "UNKNOWN"
-
-def get_name(instr):
- if get_op(instr)==3:
- return "trap"
- elif get_op(instr)==19:
- if get_xop(instr) == 50:
- return "rfi"
- else:
- return "unknown"
- elif get_op(instr)==31:
- if get_xop(instr) == 83:
- return "mfmsr"
-
- elif get_xop(instr) == 87:
- return "lbzx"
-
- elif get_xop(instr) == 131:
- return "wrtee"
-
- elif get_xop(instr) == 146:
- return "mtmsr"
-
- elif get_xop(instr) == 163:
- return "wrteei"
-
- elif get_xop(instr) == 215:
- return "stbx"
-
- elif get_xop(instr) == 247:
- return "stbux"
-
- elif get_xop(instr) == 279:
- return "lhzx"
-
- elif get_xop(instr) == 311:
- return "lhzux"
-
- elif get_xop(instr) == 323:
- return "mfdcr"
-
- elif get_xop(instr) == 339:
- return "mfspr"
-
- elif get_xop(instr) == 407:
- return "sthx"
-
- elif get_xop(instr) == 439:
- return "sthux"
-
- elif get_xop(instr) == 451:
- return "mtdcr"
-
- elif get_xop(instr) == 467:
- return "mtspr"
-
- elif get_xop(instr) == 470:
- return "dcbi"
-
- elif get_xop(instr) == 534:
- return "lwbrx"
-
- elif get_xop(instr) == 566:
- return "tlbsync"
-
- elif get_xop(instr) == 662:
- return "stwbrx"
-
- elif get_xop(instr) == 978:
- return "tlbwe"
-
- elif get_xop(instr) == 914:
- return "tlbsx"
-
- elif get_xop(instr) == 790:
- return "lhbrx"
-
- elif get_xop(instr) == 918:
- return "sthbrx"
-
- elif get_xop(instr) == 966:
- return "iccci"
-
- else:
- return "unknown"
-
- elif get_op(instr) == 32:
- return "lwz"
-
- elif get_op(instr) == 33:
- return "lwzu"
-
- elif get_op(instr) == 34:
- return "lbz"
-
- elif get_op(instr) == 35:
- return "lbzu"
-
- elif get_op(instr) == 36:
- return "stw"
-
- elif get_op(instr) == 37:
- return "stwu"
-
- elif get_op(instr) == 38:
- return "stb"
-
- elif get_op(instr) == 39:
- return "stbu"
-
- elif get_op(instr) == 40:
- return "lhz"
-
- elif get_op(instr) == 41:
- return "lhzu"
-
- elif get_op(instr) == 44:
- return "sth"
-
- elif get_op(instr) == 45:
- return "sthu"
-
- else:
- return "unknown"
-
-def get_sprn_name(sprn):
- if sprn == 0x01a:
- return "SRR0"
- elif sprn == 0x01b:
- return "SRR1"
- elif sprn == 0x3b2:
- return "MMUCR"
- elif sprn == 0x030:
- return "PID"
- elif sprn == 0x03f:
- return "IVPR"
- elif sprn == 0x3b3:
- return "CCR0"
- elif sprn == 0x378:
- return "CCR1"
- elif sprn == 0x11f:
- return "PVR"
- elif sprn == 0x03d:
- return "DEAR"
- elif sprn == 0x03e:
- return "ESR"
- elif sprn == 0x134:
- return "DBCR0"
- elif sprn == 0x135:
- return "DBCR1"
- elif sprn == 0x11c:
- return "TBWL"
- elif sprn == 0x11d:
- return "TBWU"
- elif sprn == 0x016:
- return "DEC"
- elif sprn == 0x150:
- return "TSR"
- elif sprn == 0x154:
- return "TCR"
- elif sprn == 0x110:
- return "SPRG0"
- elif sprn == 0x111:
- return "SPRG1"
- elif sprn == 0x112:
- return "SPRG2"
- elif sprn == 0x113:
- return "SPRG3"
- elif sprn == 0x114:
- return "SPRG4"
- elif sprn == 0x115:
- return "SPRG5"
- elif sprn == 0x116:
- return "SPRG6"
- elif sprn == 0x117:
- return "SPRG7"
- elif sprn == 0x190:
- return "IVOR0"
- elif sprn == 0x191:
- return "IVOR1"
- elif sprn == 0x192:
- return "IVOR2"
- elif sprn == 0x193:
- return "IVOR3"
- elif sprn == 0x194:
- return "IVOR4"
- elif sprn == 0x195:
- return "IVOR5"
- elif sprn == 0x196:
- return "IVOR6"
- elif sprn == 0x197:
- return "IVOR7"
- elif sprn == 0x198:
- return "IVOR8"
- elif sprn == 0x199:
- return "IVOR9"
- elif sprn == 0x19a:
- return "IVOR10"
- elif sprn == 0x19b:
- return "IVOR11"
- elif sprn == 0x19c:
- return "IVOR12"
- elif sprn == 0x19d:
- return "IVOR13"
- elif sprn == 0x19e:
- return "IVOR14"
- elif sprn == 0x19f:
- return "IVOR15"
- else:
- return "UNKNOWN"
-
-def get_special(instr):
- name = get_name(instr);
- if stat_ppc_instr_mnemonic.has_key(name):
- stat_ppc_instr_mnemonic[name] += 1
- else:
- stat_ppc_instr_mnemonic[name] = 1
-
- if get_op(instr) == 31:
- if (get_xop(instr) == 339) or (get_xop(instr) == 467):
- sprn = get_sprn(instr);
- sprn_name = get_sprn_name(sprn);
- stat_idx = name+"-"+sprn_name
- if stat_ppc_instr_spr.has_key(stat_idx):
- stat_ppc_instr_spr[stat_idx] += 1
- else:
- stat_ppc_instr_spr[stat_idx] = 1
- return ("- sprn 0x%03x %8s" % (sprn, sprn_name))
- elif (get_xop(instr) == 323 ) or (get_xop(instr) == 451):
- dcrn = get_dcrn(instr);
- stat_idx = name+"-"+("%04X"%dcrn)
- if stat_ppc_instr_dcr.has_key(stat_idx):
- stat_ppc_instr_dcr[stat_idx] += 1
- else:
- stat_ppc_instr_dcr[stat_idx] = 1
- return ("- dcrn 0x%03x" % dcrn)
- elif (get_xop(instr) == 978 ) or (get_xop(instr) == 451):
- tlbwe_type = get_tlbwe_type(instr)
- stat_idx = name+"-"+tlbwe_type
- if stat_ppc_instr_tlb.has_key(stat_idx):
- stat_ppc_instr_tlb[stat_idx] += 1
- else:
- stat_ppc_instr_tlb[stat_idx] = 1
- return ("- ws -> %8s" % tlbwe_type)
- return ""
-
-##### Main code
-
-summary = False
-
-try:
- opts, arg = getopt.getopt(sys.argv[1:], "sc:" )
- for opt in opts:
- if opt[0] == '-s' : summary = True
-
-except getopt.GetoptError:
- usage()
-
-signal.signal(signal.SIGTERM, sighand)
-signal.signal(signal.SIGHUP, sighand)
-signal.signal(signal.SIGINT, sighand)
-
-interrupted = 0
-
-if len(arg) > 0:
- defs = read_defs(arg[0])
-else:
- defs = read_defs(FORMATS_FILE)
-
-# structure of trace record (as output by kvmtrace):
-# HDR(I) {TSC(Q)} D1(I) D2(I) D3(I) D4(I) D5(I)
-#
-# HDR consists of EVENT:28:, n_data:3:, ts_in:1:
-# pid:32, vcpu_id:32
-# EVENT means Event ID
-# n_data means number of data (like D1, D2, ...)
-# ts_in means Timestamp data exists(1) or not(0).
-# if ts_in == 0, TSC(Q) does not exists.
-#
-HDRREC = "<III"
-TSCREC = "<Q"
-D1REC = "<I"
-D2REC = "<II"
-D3REC = "<III"
-D4REC = "<IIII"
-D5REC = "<IIIII"
-KMAGIC = "<I"
-
-last_ts = 0
-
-i=0
-
-while not interrupted:
- try:
- i=i+1
-
- if i == 1:
- line = sys.stdin.read(struct.calcsize(KMAGIC))
- if not line:
- break
- kmgc = struct.unpack(KMAGIC, line)[0]
-
- #firstly try to parse data file as little endian
- # if "kvmtrace-metadata".kmagic != kmagic
- # then data file must be big endian"
- if kmgc != 0x12345678:
- if kmgc != 0x78563412:
- print >> sys.stderr, "Bad data file: magic number error."
- break;
- else:
- HDRREC = ">III"
- TSCREC = ">Q"
- D1REC = ">I"
- D2REC = ">II"
- D3REC = ">III"
- D4REC = ">IIII"
- D5REC = ">IIIII"
- continue
-
- line = sys.stdin.read(struct.calcsize(HDRREC))
- if not line:
- break
- (event, pid, vcpu_id) = struct.unpack(HDRREC, line)
-
- n_data = event >> 28 & 0x7
- ts_in = event >> 31
-
- d1 = 0
- d2 = 0
- d3 = 0
- d4 = 0
- d5 = 0
-
- ts = 0
-
- if ts_in == 1:
- line = sys.stdin.read(struct.calcsize(TSCREC))
- if not line:
- break
- ts = struct.unpack(TSCREC, line)[0]
- if n_data == 1:
- line = sys.stdin.read(struct.calcsize(D1REC))
- if not line:
- break
- d1 = struct.unpack(D1REC, line)[0]
- if n_data == 2:
- line = sys.stdin.read(struct.calcsize(D2REC))
- if not line:
- break
- (d1, d2) = struct.unpack(D2REC, line)
- if n_data == 3:
- line = sys.stdin.read(struct.calcsize(D3REC))
- if not line:
- break
- (d1, d2, d3) = struct.unpack(D3REC, line)
- if n_data == 4:
- line = sys.stdin.read(struct.calcsize(D4REC))
- if not line:
- break
- (d1, d2, d3, d4) = struct.unpack(D4REC, line)
- if n_data == 5:
- line = sys.stdin.read(struct.calcsize(D5REC))
- if not line:
- break
- (d1, d2, d3, d4, d5) = struct.unpack(D5REC, line)
-
- event &= 0x0fffffff
-
- # provide relative TSC
-
- if last_ts > 0 and ts_in == 1:
- relts = ts - last_ts
- else:
- relts = 0
-
- if ts_in == 1:
- last_ts = ts
-
- args = {'ts' : ts,
- 'event' : event,
- 'relts': relts,
- 'pid' : pid,
- 'vcpu' : vcpu_id,
- '1' : d1,
- '2' : d2,
- '3' : d3,
- '4' : d4,
- '5' : d5 }
-
- # some event types need more than just formats mapping they are if/elif
- # chained here and the last default else is the mapping via formats
- if event == 0x00020019:
- pdata = (ts, relts, vcpu_id, pid, d1, d2, d3, get_name(d1), get_special(d1))
- print "%d (+%12d) PPC_INSTR vcpu = 0x%08x pid = 0x%08x [ instr = 0x%08x, pc = 0x%08x, emul = %01d, mnemonic = %8s %s" % pdata
- else:
- try:
- if defs.has_key(str(event)):
- print defs[str(event)] % args
- else:
- if defs.has_key(str(0)): print defs[str(0)] % args
- except TypeError:
- if defs.has_key(str(event)):
- print defs[str(event)]
- print args
- else:
- if defs.has_key(str(0)):
- print defs[str(0)]
- print args
-
- except IOError, struct.error: sys.exit()
-
-if summary:
- ppc_instr_summary()
diff --git a/lib/fwcfg.c b/lib/fwcfg.c
deleted file mode 100644
index dc34d299df766..0000000000000
--- a/lib/fwcfg.c
+++ /dev/null
@@ -1,58 +0,0 @@
-
-void qemu_cfg_select(int f)
-{
- outw(QEMU_CFG_CTL_PORT, f);
-}
-
-int qemu_cfg_port_probe()
-{
- char *sig = "QEMU";
- int i;
-
- qemu_cfg_select(QEMU_CFG_SIGNATURE);
-
- for (i = 0; i < 4; i++)
- if (inb(QEMU_CFG_DATA_PORT) != sig[i])
- return 0;
-
- return 1;
-}
-
-void qemu_cfg_read(uint8_t *buf, int len)
-{
- while (len--)
- *(buf++) = inb(QEMU_CFG_DATA_PORT);
-}
-
-uint8_t qemu_cfg_get8(void)
-{
- uint8_t ret;
-
- qemu_cfg_read(&ret, 1);
- return ret;
-}
-
-uint16_t qemu_cfg_get16(void)
-{
- uint16_t ret;
-
- qemu_cfg_read((uint8_t*)&ret, 2);
- return le16_to_cpu(ret);
-}
-
-uint64_t qemu_cfg_get32(void)
-{
- uint32_t ret;
-
- qemu_cfg_read((uint8_t*)&ret, 4);
- return le32_to_cpu(ret);
-}
-
-uint64_t qemu_cfg_get64(void)
-{
- uint64_t ret;
-
- qemu_cfg_read((uint8_t*)&ret, 8);
- return le64_to_cpu(ret);
-}
-
diff --git a/lib/libcflat.h b/lib/libcflat.h
index fadc33d30f85b..140c172e77d54 100644
--- a/lib/libcflat.h
+++ b/lib/libcflat.h
@@ -38,7 +38,6 @@ typedef _Bool bool;
#define false 0

extern void exit(int code);
-extern void panic(char *fmt, ...);

extern unsigned long strlen(const char *buf);
extern char *strcat(char *dest, const char *src);
diff --git a/lib/panic.c b/lib/panic.c
deleted file mode 100644
index 6e0b29ebed503..0000000000000
--- a/lib/panic.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "libcflat.h"
-
-void panic(char *fmt, ...)
-{
- va_list va;
- char buf[2000];
-
- va_start(va, fmt);
- vsnprintf(buf, sizeof(buf), fmt, va);
- va_end(va);
- puts(buf);
- exit(-1);
-}
diff --git a/lib/powerpc/44x/map.c b/lib/powerpc/44x/map.c
deleted file mode 100644
index 113434d2f1b4d..0000000000000
--- a/lib/powerpc/44x/map.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Copyright IBM Corp. 2008
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#include "libcflat.h"
-
-#define TLB_SIZE 64
-
-extern void tlbwe(unsigned int index,
- unsigned char tid,
- unsigned int word0,
- unsigned int word1,
- unsigned int word2);
-
-unsigned int next_free_index;
-
-#define PAGE_SHIFT 12
-#define PAGE_MASK (~((1<<PAGE_SHIFT)-1))
-
-#define V (1<<9)
-
-void map(unsigned long vaddr, unsigned long paddr)
-{
- unsigned int w0, w1, w2;
-
- /* We don't install exception handlers, so we can't handle TLB misses,
- * so we can't loop around and overwrite entry 0. */
- if (next_free_index++ >= TLB_SIZE)
- panic("TLB overflow");
-
- w0 = (vaddr & PAGE_MASK) | V;
- w1 = paddr & PAGE_MASK;
- w2 = 0x3;
-
- tlbwe(next_free_index, 0, w0, w1, w2);
-}
diff --git a/lib/powerpc/44x/timebase.S b/lib/powerpc/44x/timebase.S
deleted file mode 100644
index 385904da3c161..0000000000000
--- a/lib/powerpc/44x/timebase.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Copyright IBM Corp. 2008
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-/* unsigned long long mftb(void); */
-.global mftb
-mftb:
- mftbu r5
- mftbl r4
- mftbu r3
- cmpw r3, r5
- bne mftb
- blr
diff --git a/lib/powerpc/44x/timebase.h b/lib/powerpc/44x/timebase.h
deleted file mode 100644
index ce85347bd17c5..0000000000000
--- a/lib/powerpc/44x/timebase.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Copyright IBM Corp. 2008
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#ifndef __TIMEBASE_H__
-#define __TIMEBASE_H__
-
-unsigned long long mftb(void);
-
-#endif /* __TIMEBASE_H__ */
diff --git a/lib/powerpc/44x/tlbwe.S b/lib/powerpc/44x/tlbwe.S
deleted file mode 100644
index 3790374eb5c61..0000000000000
--- a/lib/powerpc/44x/tlbwe.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Copyright IBM Corp. 2008
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#define SPRN_MMUCR 0x3b2
-
-/* tlbwe(uint index, uint8_t tid, uint word0, uint word1, uint word2) */
-.global tlbwe
-tlbwe:
- mtspr SPRN_MMUCR, r4
- tlbwe r5, r3, 0
- tlbwe r6, r3, 1
- tlbwe r7, r3, 2
- blr
diff --git a/lib/powerpc/io.c b/lib/powerpc/io.c
deleted file mode 100644
index 8bd239521f25f..0000000000000
--- a/lib/powerpc/io.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Copyright IBM Corp. 2008
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#include "libcflat.h"
-
-#define BASE 0xf0000000
-#define _putc ((volatile char *)(BASE))
-#define _exit ((volatile char *)(BASE+1))
-
-void puts(const char *s)
-{
- while (*s != '\0')
- *_putc = *s++;
-}
-
-void exit(int code)
-{
- *_exit = code;
-}
diff --git a/main-ppc.c b/main-ppc.c
deleted file mode 100644
index 5af59f846ef07..0000000000000
--- a/main-ppc.c
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Kernel-based Virtual Machine test driver
- *
- * This test driver provides a simple way of testing kvm, without a full
- * device model.
- *
- * Copyright (C) 2006 Qumranet
- * Copyright IBM Corp. 2008
- *
- * Authors:
- *
- * Avi Kivity <avi@qumranet.com>
- * Yaniv Kamay <yaniv@qumranet.com>
- * Hollis Blanchard <hollisb@us.ibm.com>
- *
- * This work is licensed under the GNU LGPL license, version 2.
- */
-
-#define _GNU_SOURCE
-
-#include <libkvm.h>
-
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <semaphore.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <pthread.h>
-#include <signal.h>
-#include <pthread.h>
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-#include <getopt.h>
-#include <stdbool.h>
-#include <inttypes.h>
-
-#include "iotable.h"
-
-static int gettid(void)
-{
- return syscall(__NR_gettid);
-}
-
-kvm_context_t kvm;
-
-#define IPI_SIGNAL (SIGRTMIN + 4)
-
-struct io_table mmio_table;
-
-static int ncpus = 1;
-static sem_t exited_sem;
-static __thread int vcpu;
-static sigset_t kernel_sigmask;
-static sigset_t ipi_sigmask;
-static uint64_t memory_size = 128 * 1024 * 1024;
-
-struct vcpu_info {
- pid_t tid;
-};
-
-struct vcpu_info *vcpus;
-
-/* Must match flat.lds linker script */
-#define VM_TEST_LOAD_ADDRESS 0x100000
-
-static int test_debug(void *opaque, void *vcpu)
-{
- printf("test_debug\n");
- return 0;
-}
-
-static int test_halt(void *opaque, int vcpu)
-{
- int n;
-
- sigwait(&ipi_sigmask, &n);
- return 0;
-}
-
-static int test_io_window(void *opaque)
-{
- return 0;
-}
-
-static int test_try_push_interrupts(void *opaque)
-{
- return 0;
-}
-
-static void test_post_kvm_run(void *opaque, void *vcpu)
-{
-}
-
-static int test_pre_kvm_run(void *opaque, void *vcpu)
-{
- return 0;
-}
-
-static int mmio_handler(void *opaque, int len, int is_write, uint64_t offset,
- uint64_t *data)
-{
- int r = 0;
-
- switch (offset) {
- case 0: /* putc */
- putc(*(char *)data, stdout);
- fflush(stdout);
- break;
- case 1: /* exit */
- r = *(char *)data;
- break;
- default:
- printf("%s: offset %"PRIx64" len %d data %"PRIx64"\n",
- __func__, offset, len, *(uint64_t *)data);
- r = -EINVAL;
- }
-
- return r;
-}
-
-static int test_mem_read(void *opaque, uint64_t addr, uint8_t *data, int len)
-{
- struct io_table_entry *iodev;
-
-#if 0
- printf("%s: addr %"PRIx64" len %d\n", __func__, addr, len);
-#endif
-
- iodev = io_table_lookup(&mmio_table, addr);
- if (!iodev) {
- printf("couldn't find device\n");
- return -ENODEV;
- }
-
- return iodev->handler(iodev->opaque, len, 0, addr - iodev->start,
- (uint64_t *)data);
-}
-
-static int test_mem_write(void *opaque, uint64_t addr, uint8_t *data, int len)
-{
- struct io_table_entry *iodev;
-
-#if 0
- printf("%s: addr %"PRIx64" len %d data %"PRIx64"\n",
- __func__, addr, len, *(uint64_t *)data);
-#endif
-
- iodev = io_table_lookup(&mmio_table, addr);
- if (!iodev) {
- printf("couldn't find device\n");
- return -ENODEV;
- }
-
- return iodev->handler(iodev->opaque, len, 1, addr - iodev->start,
- (uint64_t *)data);
-}
-
-static int test_dcr_read(int vcpu, uint32_t dcrn, uint32_t *data)
-{
- printf("%s: dcrn %04X\n", __func__, dcrn);
- *data = 0;
- return 0;
-}
-
-static int test_dcr_write(int vcpu, uint32_t dcrn, uint32_t data)
-{
- printf("%s: dcrn %04X data %04X\n", __func__, dcrn, data);
- return 0;
-}
-
-static struct kvm_callbacks test_callbacks = {
- .mmio_read = test_mem_read,
- .mmio_write = test_mem_write,
- .debug = test_debug,
- .halt = test_halt,
- .io_window = test_io_window,
- .try_push_interrupts = test_try_push_interrupts,
- .post_kvm_run = test_post_kvm_run,
- .pre_kvm_run = test_pre_kvm_run,
- .powerpc_dcr_read = test_dcr_read,
- .powerpc_dcr_write = test_dcr_write,
-};
-
-static unsigned long load_file(void *mem, const char *fname, int inval_icache)
-{
- ssize_t r;
- int fd;
- unsigned long bytes = 0;
-
- fd = open(fname, O_RDONLY);
- if (fd == -1) {
- perror("open");
- exit(1);
- }
-
- while ((r = read(fd, mem, 4096)) != -1 && r != 0) {
- mem += r;
- bytes += r;
- }
-
- if (r == -1) {
- perror("read");
- printf("read %d bytes\n", bytes);
- exit(1);
- }
-
- return bytes;
-}
-
-#define ICACHE_LINE_SIZE 32
-
-void sync_caches(void *mem, unsigned long len)
-{
- unsigned long i;
-
- for (i = 0; i < len; i += ICACHE_LINE_SIZE)
- asm volatile ("dcbst %0, %1" : : "g"(mem), "r"(i));
- asm volatile ("sync");
- for (i = 0; i < len; i += ICACHE_LINE_SIZE)
- asm volatile ("icbi %0, %1" : : "g"(mem), "r"(i));
- asm volatile ("sync; isync");
-}
-
-static void init_vcpu(int n)
-{
- sigemptyset(&ipi_sigmask);
- sigaddset(&ipi_sigmask, IPI_SIGNAL);
- sigprocmask(SIG_UNBLOCK, &ipi_sigmask, NULL);
- sigprocmask(SIG_BLOCK, &ipi_sigmask, &kernel_sigmask);
- vcpus[n].tid = gettid();
- vcpu = n;
- kvm_set_signal_mask(kvm, n, &kernel_sigmask);
-}
-
-static void *do_create_vcpu(void *_n)
-{
- struct kvm_regs regs;
- int n = (long)_n;
-
- kvm_create_vcpu(kvm, n);
- init_vcpu(n);
-
- kvm_get_regs(kvm, n, &regs);
- regs.pc = VM_TEST_LOAD_ADDRESS;
- kvm_set_regs(kvm, n, &regs);
-
- kvm_run(kvm, n, &vcpus[n]);
- sem_post(&exited_sem);
- return NULL;
-}
-
-static void start_vcpu(int n)
-{
- pthread_t thread;
-
- pthread_create(&thread, NULL, do_create_vcpu, (void *)(long)n);
-}
-
-static void usage(const char *progname)
-{
- fprintf(stderr,
-"Usage: %s [OPTIONS] [bootstrap] flatfile\n"
-"KVM test harness.\n"
-"\n"
-" -s, --smp=NUM create a VM with NUM virtual CPUs\n"
-" -m, --memory=NUM[GMKB] allocate NUM memory for virtual machine. A suffix\n"
-" can be used to change the unit (default: `M')\n"
-" -h, --help display this help screen and exit\n"
-"\n"
-"Report bugs to <kvm-ppc@vger.kernel.org>.\n"
- , progname);
-}
-
-static void sig_ignore(int sig)
-{
- write(1, "boo\n", 4);
-}
-
-int main(int argc, char **argv)
-{
- void *vm_mem;
- unsigned long len;
- int i;
- const char *sopts = "s:phm:";
- struct option lopts[] = {
- { "smp", 1, 0, 's' },
- { "memory", 1, 0, 'm' },
- { "help", 0, 0, 'h' },
- { 0 },
- };
- int opt_ind, ch;
- int nb_args;
- char *endptr;
-
- while ((ch = getopt_long(argc, argv, sopts, lopts, &opt_ind)) != -1) {
- switch (ch) {
- case 's':
- ncpus = atoi(optarg);
- break;
- case 'm':
- memory_size = strtoull(optarg, &endptr, 0);
- switch (*endptr) {
- case 'G': case 'g':
- memory_size <<= 30;
- break;
- case '\0':
- case 'M': case 'm':
- memory_size <<= 20;
- break;
- case 'K': case 'k':
- memory_size <<= 10;
- break;
- default:
- fprintf(stderr,
- "Unrecongized memory suffix: %c\n",
- *endptr);
- exit(1);
- }
- if (memory_size == 0) {
- fprintf(stderr,
- "Invalid memory size: 0\n");
- exit(1);
- }
- break;
- case 'h':
- usage(argv[0]);
- exit(0);
- case '?':
- default:
- fprintf(stderr,
- "Try `%s --help' for more information.\n",
- argv[0]);
- exit(1);
- }
- }
-
- nb_args = argc - optind;
- if (nb_args < 1 || nb_args > 2) {
- fprintf(stderr,
- "Incorrect number of arguments.\n"
- "Try `%s --help' for more information.\n",
- argv[0]);
- exit(1);
- }
-
- signal(IPI_SIGNAL, sig_ignore);
-
- vcpus = calloc(ncpus, sizeof *vcpus);
- if (!vcpus) {
- fprintf(stderr, "calloc failed\n");
- return 1;
- }
-
- kvm = kvm_init(&test_callbacks, 0);
- if (!kvm) {
- fprintf(stderr, "kvm_init failed\n");
- return 1;
- }
- if (kvm_create(kvm, memory_size, &vm_mem) < 0) {
- kvm_finalize(kvm);
- fprintf(stderr, "kvm_create failed\n");
- return 1;
- }
-
- vm_mem = kvm_create_phys_mem(kvm, 0, memory_size, 0, 1);
-
- len = load_file(vm_mem + VM_TEST_LOAD_ADDRESS, argv[optind], 1);
- sync_caches(vm_mem + VM_TEST_LOAD_ADDRESS, len);
-
- io_table_register(&mmio_table, 0xf0000000, 64, mmio_handler, NULL);
-
- sem_init(&exited_sem, 0, 0);
- for (i = 0; i < ncpus; ++i)
- start_vcpu(i);
- /* Wait for all vcpus to exit. */
- for (i = 0; i < ncpus; ++i)
- sem_wait(&exited_sem);
-
- return 0;
-}
diff --git a/powerpc/44x/tlbsx.S b/powerpc/44x/tlbsx.S
deleted file mode 100644
index b15874b18b74c..0000000000000
--- a/powerpc/44x/tlbsx.S
+++ /dev/null
@@ -1,33 +0,0 @@
-#define SPRN_MMUCR 0x3b2
-
-#define TLBWORD0 0x10000210
-#define TLBWORD1 0x10000000
-#define TLBWORD2 0x00000003
-
-.global _start
-_start:
- li r4, 0
- mtspr SPRN_MMUCR, r4
-
- li r3, 23
-
- lis r4, TLBWORD0@h
- ori r4, r4, TLBWORD0@l
- tlbwe r4, r3, 0
-
- lis r4, TLBWORD1@h
- ori r4, r4, TLBWORD1@l
- tlbwe r4, r3, 1
-
- lis r4, TLBWORD2@h
- ori r4, r4, TLBWORD2@l
- tlbwe r4, r3, 2
-
- lis r4, 0x1000
- tlbsx r5, r4, r0
- cmpwi r5, 23
- beq good
- trap
-
-good:
- b .
diff --git a/powerpc/44x/tlbwe.S b/powerpc/44x/tlbwe.S
deleted file mode 100644
index ec6ef5c57fc47..0000000000000
--- a/powerpc/44x/tlbwe.S
+++ /dev/null
@@ -1,27 +0,0 @@
-#define SPRN_MMUCR 0x3b2
-
-/* Create a mapping at 4MB */
-#define TLBWORD0 0x00400210
-#define TLBWORD1 0x00400000
-#define TLBWORD2 0x00000003
-
-.global _start
-_start:
- li r4, 0
- mtspr SPRN_MMUCR, r4
-
- li r3, 23
-
- lis r4, TLBWORD0@h
- ori r4, r4, TLBWORD0@l
- tlbwe r4, r3, 0
-
- lis r4, TLBWORD1@h
- ori r4, r4, TLBWORD1@l
- tlbwe r4, r3, 1
-
- lis r4, TLBWORD2@h
- ori r4, r4, TLBWORD2@l
- tlbwe r4, r3, 2
-
- b .
diff --git a/powerpc/44x/tlbwe_16KB.S b/powerpc/44x/tlbwe_16KB.S
deleted file mode 100644
index 1bd10bf17a187..0000000000000
--- a/powerpc/44x/tlbwe_16KB.S
+++ /dev/null
@@ -1,35 +0,0 @@
-#define SPRN_MMUCR 0x3b2
-
-/* 16KB mapping at 4MB */
-#define TLBWORD0 0x00400220
-#define TLBWORD1 0x00400000
-#define TLBWORD2 0x00000003
-
-.global _start
-_start:
- li r4, 0
- mtspr SPRN_MMUCR, r4
-
- li r3, 5
-
- lis r4, TLBWORD0@h
- ori r4, r4, TLBWORD0@l
- tlbwe r4, r3, 0
-
- lis r4, TLBWORD1@h
- ori r4, r4, TLBWORD1@l
- tlbwe r4, r3, 1
-
- lis r4, TLBWORD2@h
- ori r4, r4, TLBWORD2@l
- tlbwe r4, r3, 2
-
- /* load from 4MB */
- lis r3, 0x0040
- lwz r4, 0(r3)
-
- /* load from 4MB+8KB */
- ori r3, r3, 0x2000
- lwz r4, 0(r3)
-
- b .
diff --git a/powerpc/44x/tlbwe_hole.S b/powerpc/44x/tlbwe_hole.S
deleted file mode 100644
index 5efd30357daa9..0000000000000
--- a/powerpc/44x/tlbwe_hole.S
+++ /dev/null
@@ -1,27 +0,0 @@
-#define SPRN_MMUCR 0x3b2
-
-/* Try to map real address 1GB. */
-#define TLBWORD0 0x40000210
-#define TLBWORD1 0x40000000
-#define TLBWORD2 0x00000003
-
-.global _start
-_start:
- li r4, 0
- mtspr SPRN_MMUCR, r4
-
- li r3, 23
-
- lis r4, TLBWORD0@h
- ori r4, r4, TLBWORD0@l
- tlbwe r4, r3, 0
-
- lis r4, TLBWORD1@h
- ori r4, r4, TLBWORD1@l
- tlbwe r4, r3, 1
-
- lis r4, TLBWORD2@h
- ori r4, r4, TLBWORD2@l
- tlbwe r4, r3, 2
-
- b .
diff --git a/powerpc/cstart.S b/powerpc/cstart.S
deleted file mode 100644
index 70a0e9fcd47c9..0000000000000
--- a/powerpc/cstart.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Copyright IBM Corp. 2008
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-#define OUTPUT_VADDR 0xf0000000
-#define OUTPUT_PADDR 0xf0000000
-
-.globl _start
-_start:
- /* In the future we might need to assign a stack and zero BSS here. */
-
- /* Map the debug page 1:1. */
- lis r3, OUTPUT_VADDR@h
- ori r3, r3, OUTPUT_VADDR@l
- lis r4, OUTPUT_PADDR@h
- ori r4, r4, OUTPUT_PADDR@l
- bl map
-
- /* Call main() and pass return code to exit(). */
- bl main
- bl exit
-
- b .
diff --git a/powerpc/exit.c b/powerpc/exit.c
deleted file mode 100644
index 804ee04d9f88e..0000000000000
--- a/powerpc/exit.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Copyright IBM Corp. 2008
- *
- * Authors: Hollis Blanchard <hollisb@us.ibm.com>
- */
-
-int main(void)
-{
- return 1;
-}
diff --git a/powerpc/helloworld.c b/powerpc/helloworld.c
deleted file mode 100644
index f8630f7c5381f..0000000000000
--- a/powerpc/helloworld.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Copyright IBM Corp. 2008
- *
- * Authors: Deepa Srinivasan <deepas@us.ibm.com>
- */
-
-#include "libcflat.h"
-
-int main()
-{
- printf("Hello World\n");
-
- return 1;
-}
diff --git a/powerpc/io.S b/powerpc/io.S
deleted file mode 100644
index 97567cb6c73f2..0000000000000
--- a/powerpc/io.S
+++ /dev/null
@@ -1,32 +0,0 @@
-#define SPRN_MMUCR 0x3b2
-
-#define TLBWORD0 0xf0000210
-#define TLBWORD1 0xf0000000
-#define TLBWORD2 0x00000003
-
-.global _start
-_start:
- li r4, 0
- mtspr SPRN_MMUCR, r4
-
- li r3, 2
-
- lis r4, TLBWORD0@h
- ori r4, r4, TLBWORD0@l
- tlbwe r4, r3, 0
-
- lis r4, TLBWORD1@h
- ori r4, r4, TLBWORD1@l
- tlbwe r4, r3, 1
-
- lis r4, TLBWORD2@h
- ori r4, r4, TLBWORD2@l
- tlbwe r4, r3, 2
-
- lis r3, 0xf000
- lis r4, 0x1234
- ori r4, r4, 0x5678
- stb r4, 0(r3)
- lbz r5, 0(r3)
-
- b .
diff --git a/powerpc/spin.S b/powerpc/spin.S
deleted file mode 100644
index 4406641c2711c..0000000000000
--- a/powerpc/spin.S
+++ /dev/null
@@ -1,4 +0,0 @@
-
-.global _start
-_start:
- b .
diff --git a/powerpc/sprg.S b/powerpc/sprg.S
deleted file mode 100644
index d0414a480342a..0000000000000
--- a/powerpc/sprg.S
+++ /dev/null
@@ -1,7 +0,0 @@
-
-.global _start
-_start:
- li r3, 42
- mtsprg 0, r3
- mfsprg r4, 0
- b .
diff --git a/x86/print.h b/x86/print.h
deleted file mode 100644
index d5bd2f9978dc4..0000000000000
--- a/x86/print.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef PRINT_H
-#define PRINT_H
-
-.macro PRINT text
-
-.data
-
-333: .asciz "\text\n"
-
-.previous
-
- push %rdi
- lea 333b, %rdi
- call print
- pop %rdi
-
-.endm
-
-#endif
diff --git a/x86/run-kvm-unit-tests b/x86/run-kvm-unit-tests
deleted file mode 100644
index fed925a3d70fe..0000000000000
--- a/x86/run-kvm-unit-tests
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/python
-
-import sys, os, os.path
-
-prog = sys.argv[0]
-dir = os.path.dirname(prog)
--
1.8.1.4