Commit 2a814baa authored by Andrew Jones's avatar Andrew Jones Committed by Paolo Bonzini
Browse files

remove unused files



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's avatarAndrew Jones <drjones@redhat.com>
Acked-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 313f4efe
......@@ -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 \
lib/report.o
......@@ -40,11 +39,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 $@ $^
......@@ -58,4 +52,4 @@ install:
install $(tests_and_config) $(DESTDIR)
clean: arch_clean
$(RM) kvmtrace *.o *.a .*.d $(libcflat) $(cflatobjs)
$(RM) *.o *.a .*.d $(libcflat) $(cflatobjs)
bits = 64
CFLAGS += -m64
CFLAGS += -D__ia64__
CFLAGS += -I../include/ia64
all:
# 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
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))
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 ]
/*
* 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;
}
/*
* 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);
/*
* 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;