Commit 2d893d8a authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] x86-64 merge for 2.5.73

Bring the x86-64 architecture code uptodate for 2.5.73.

One problem is that CONFIG_IDE_TASKFILE corrupts file systems on AMD 8111. It
may be worth to disable it in the configuration.

 - Disable 32bit vsyscalls for now until all bugs can be fixed
 - Fix warnings
 - Fix NULL pointer reference in 32bit ptrace
 - Timing fixes from John Stultz
 - Sync show_stack prototype
 - Sync nmi and floppy.h code (Mikael P.)
 - Set proper defines for AGP
 - Make Simics work again
 - Scale unit in 32bit sysinfo (originally from ppc64)
parent d6b444ca
......@@ -30,10 +30,12 @@
#define AT_SYSINFO 32
#define AT_SYSINFO_EHDR 33
#if 0 /* disabled for now because the code has still problems */
#define ARCH_DLINFO do { \
NEW_AUX_ENT(AT_SYSINFO, (u32)(u64)VSYSCALL32_VSYSCALL); \
NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL32_BASE); \
} while(0)
#endif
struct file;
struct elf_phdr;
......
......@@ -552,7 +552,7 @@ static int do_usbdevfs_reapurb(unsigned int fd, unsigned int cmd, unsigned long
set_fs(old_fs);
if (err >= 0 &&
put_user(((u32)(long)kptr), compat_ptr(arg)))
put_user((u32)(u64)kptr, (u32 *)arg))
err = -EFAULT;
return err;
......
......@@ -210,6 +210,7 @@ static struct task_struct *find_target(int request, int pid, int *err)
return child;
}
out:
if (child)
put_task_struct(child);
return NULL;
......
......@@ -946,10 +946,30 @@ sys32_sysinfo(struct sysinfo32 *info)
struct sysinfo s;
int ret;
mm_segment_t old_fs = get_fs ();
int bitcount = 0;
set_fs (KERNEL_DS);
ret = sys_sysinfo(&s);
set_fs (old_fs);
/* Check to see if any memory value is too large for 32-bit and scale
* down if needed
*/
if ((s.totalram >> 32) || (s.totalswap >> 32)) {
while (s.mem_unit < PAGE_SIZE) {
s.mem_unit <<= 1;
bitcount++;
}
s.totalram >>= bitcount;
s.freeram >>= bitcount;
s.sharedram >>= bitcount;
s.bufferram >>= bitcount;
s.totalswap >>= bitcount;
s.freeswap >>= bitcount;
s.totalhigh >>= bitcount;
s.freehigh >>= bitcount;
}
if (verify_area(VERIFY_WRITE, info, sizeof(struct sysinfo32)) ||
__put_user (s.uptime, &info->uptime) ||
__put_user (s.loads[0], &info->loads[0]) ||
......
......@@ -100,7 +100,7 @@ acpi_parse_madt (
if (madt->lapic_address)
acpi_lapic_addr = (u64) madt->lapic_address;
printk(KERN_INFO PREFIX "Local APIC address 0x%08x\n",
printk(KERN_INFO PREFIX "Local APIC address 0x%016x\n",
madt->lapic_address);
return 0;
......
......@@ -26,9 +26,6 @@
#include <linux/irq.h>
/* When we have things working, we can switch to always use
IOAPIC. --pavel */
/*
* Common place to define all x86 IRQ vectors
*
......
......@@ -31,9 +31,6 @@
#define DEBUGP(fmt...)
/* TODO this should be in vmlist, but we must fix get_vm_area first to
handle out of bounds entries properly.
Also need to fix /proc/kcore, /dev/kmem */
static struct vm_struct *mod_vmlist;
void module_free(struct module *mod, void *module_region)
......
......@@ -34,7 +34,7 @@
extern void default_do_nmi(struct pt_regs *);
unsigned int nmi_watchdog = NMI_LOCAL_APIC;
unsigned int nmi_watchdog = NMI_IO_APIC;
static unsigned int nmi_hz = HZ;
unsigned int nmi_perfctr_msr; /* the MSR to reset in NMI handler */
int nmi_watchdog_disabled;
......@@ -153,17 +153,19 @@ void enable_lapic_nmi_watchdog(void)
#include <linux/device.h>
static int nmi_pm_active; /* nmi_active before suspend */
static int lapic_nmi_suspend(struct sys_device *dev, u32 state)
{
nmi_pm_active = nmi_active;
disable_lapic_nmi_watchdog();
return 0;
}
static int lapic_nmi_resume(struct sys_device *dev)
{
#if 0
if (nmi_pm_active > 0)
enable_lapic_nmi_watchdog();
#endif
return 0;
}
......@@ -235,6 +237,8 @@ void setup_apic_nmi_watchdog (void)
case X86_VENDOR_AMD:
if (boot_cpu_data.x86 < 6)
return;
if (strstr(boot_cpu_data.x86_model_id, "Screwdriver"))
return;
setup_k7_watchdog();
break;
default:
......
......@@ -236,7 +236,7 @@ void dump_leak(void)
static int dump;
if (dump || !iommu_leak_tab) return;
dump = 1;
show_stack(NULL);
show_stack(NULL,NULL);
/* Very crude. dump some from the end of the table too */
printk("Dumping %d pages from end of IOMMU:\n", iommu_leak_pages);
for (i = 0; i < iommu_leak_pages; i+=2) {
......
......@@ -121,11 +121,12 @@ void fix_processor_context(void)
struct tss_struct * t = init_tss + cpu;
set_tss_desc(cpu,t); /* This just modifies memory; should not be neccessary. But... This is neccessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
((struct n_desc_struct *) &cpu_gdt_table[cpu][GDT_ENTRY_TSS])->b &= 0xfffffdff;
cpu_gdt_table[cpu][GDT_ENTRY_TSS].type = 9;
syscall_init(); /* This sets MSR_*STAR and related */
load_TR_desc(); /* This does ltr */
load_LDT(&current->mm->context); /* This does lldt */
load_LDT(&current->active_mm->context); /* This does lldt */
/*
* Now maybe reload the debug registers
......
......@@ -47,6 +47,7 @@ unsigned long hpet_period; /* fsecs / HPET clock */
unsigned long hpet_tick; /* HPET clocks / interrupt */
unsigned long vxtime_hz = 1193182;
int report_lost_ticks; /* command line option */
unsigned long long monotonic_base;
struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */
......@@ -137,6 +138,18 @@ int do_settimeofday(struct timespec *tv)
tv->tv_sec--;
}
wall_to_monotonic.tv_sec += xtime.tv_sec - tv->tv_sec;
wall_to_monotonic.tv_nsec += xtime.tv_nsec - tv->tv_nsec;
if (wall_to_monotonic.tv_nsec > NSEC_PER_SEC) {
wall_to_monotonic.tv_nsec -= NSEC_PER_SEC;
wall_to_monotonic.tv_sec++;
}
if (wall_to_monotonic.tv_nsec < 0) {
wall_to_monotonic.tv_nsec += NSEC_PER_SEC;
wall_to_monotonic.tv_sec--;
}
xtime.tv_sec = tv->tv_sec;
xtime.tv_nsec = tv->tv_nsec;
......@@ -219,6 +232,47 @@ static void set_rtc_mmss(unsigned long nowtime)
spin_unlock(&rtc_lock);
}
/* monotonic_clock(): returns # of nanoseconds passed since time_init()
* Note: This function is required to return accurate
* time even in the absence of multiple timer ticks.
*/
unsigned long long monotonic_clock(void)
{
unsigned long seq;
u32 last_offset, this_offset, offset;
unsigned long long base;
if (vxtime.mode == VXTIME_HPET) {
do {
seq = read_seqbegin(&xtime_lock);
last_offset = vxtime.last;
base = monotonic_base;
this_offset = hpet_readl(HPET_T0_CMP) - hpet_tick;
} while (read_seqretry(&xtime_lock, seq));
offset = (this_offset - last_offset);
offset *=(NSEC_PER_SEC/HZ)/hpet_tick;
return base + offset;
}else{
do {
seq = read_seqbegin(&xtime_lock);
last_offset = vxtime.last_tsc;
base = monotonic_base;
} while (read_seqretry(&xtime_lock, seq));
sync_core();
rdtscll(this_offset);
offset = (this_offset - last_offset)*1000/cpu_khz;
return base + offset;
}
}
EXPORT_SYMBOL(monotonic_clock);
static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
static unsigned long rtc_update = 0;
......@@ -253,6 +307,9 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
lost = (offset - vxtime.last) / hpet_tick - 1;
}
monotonic_base +=
(offset - vxtime.last)*(NSEC_PER_SEC/HZ) / hpet_tick;
vxtime.last = offset;
} else {
offset = (((tsc - vxtime.last_tsc) *
......@@ -266,6 +323,8 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
offset %= (USEC_PER_SEC / HZ);
}
monotonic_base += (tsc - vxtime.last_tsc)*1000000/cpu_khz ;
vxtime.last_tsc = tsc - vxtime.quot * delay / vxtime.tsc_quot;
if ((((tsc - vxtime.last_tsc) *
......@@ -544,6 +603,9 @@ void __init time_init(void)
xtime.tv_sec = get_cmos_time();
xtime.tv_nsec = 0;
wall_to_monotonic.tv_sec = -xtime.tv_sec;
wall_to_monotonic.tv_nsec = -xtime.tv_nsec;
if (!hpet_init()) {
vxtime_hz = (1000000000000000L + hpet_period / 2) /
hpet_period;
......
......@@ -27,6 +27,7 @@
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <asm/system.h>
#include <asm/uaccess.h>
......@@ -206,7 +207,7 @@ void show_trace_task(struct task_struct *tsk)
show_trace((unsigned long *)rsp);
}
void show_stack(unsigned long * rsp)
void show_stack(struct task_struct *tsk, unsigned long * rsp)
{
unsigned long *stack;
int i;
......@@ -214,7 +215,7 @@ void show_stack(unsigned long * rsp)
unsigned long *irqstack_end = (unsigned long *) (cpu_pda[cpu].irqstackptr);
unsigned long *irqstack = (unsigned long *) (cpu_pda[cpu].irqstackptr - IRQSTACKSIZE);
// debugging aid: "show_stack(NULL);" prints the
// debugging aid: "show_stack(NULL, NULL);" prints the
// back trace for this cpu.
if(rsp==NULL)
......@@ -269,7 +270,7 @@ void show_registers(struct pt_regs *regs)
if (in_kernel) {
printk("Stack: ");
show_stack((unsigned long*)rsp);
show_stack(NULL, (unsigned long*)rsp);
printk("\nCode: ");
if(regs->rip < PAGE_OFFSET)
......@@ -831,3 +832,4 @@ void __init trap_init(void)
*/
cpu_init();
}
......@@ -22,7 +22,7 @@
* floppy accesses go through the track buffer.
*/
#define _CROSS_64KB(a,s,vdma) \
(!vdma && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64))
(!(vdma) && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64))
#define CROSS_64KB(a,s) _CROSS_64KB(a,s,use_virtual_dma & 1)
......@@ -62,10 +62,8 @@ static irqreturn_t floppy_hardint(int irq, void *dev_id, struct pt_regs * regs)
static int bytes=0;
static int dma_wait=0;
#endif
if(!doing_pdma) {
floppy_interrupt(irq, dev_id, regs);
return IRQ_HANDLED;
}
if (!doing_pdma)
return floppy_interrupt(irq, dev_id, regs);
#ifdef TRACE_FLPY_INT
if(!calls)
......@@ -115,7 +113,6 @@ static irqreturn_t floppy_hardint(int irq, void *dev_id, struct pt_regs * regs)
if(!virtual_dma_count)
dma_wait++;
#endif
return IRQ_HANDLED;
}
......
......@@ -104,7 +104,7 @@ static __inline__ int mtrr_del_page (int reg, unsigned long base,
return -ENODEV;
}
static __inline__ void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi) {;}
static __inline__ void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi) {}
# endif
......
......@@ -401,6 +401,9 @@ extern int kern_addr_valid(unsigned long addr);
#define pgtable_cache_init() do { } while (0)
#define check_pgt_cache() do { } while (0)
#define PAGE_AGP PAGE_KERNEL_NOCACHE
#define HAVE_PAGE_AGP 1
/* fs/proc/kcore.c */
#define kc_vaddr_to_offset(v) ((v) & __VIRTUAL_MASK)
#define kc_offset_to_vaddr(o) \
......
......@@ -52,7 +52,6 @@ extern unsigned long end_pfn_map;
extern unsigned long cpu_initialized;
extern void show_stack(unsigned long * rsp);
extern void show_trace(unsigned long * rsp);
extern void show_registers(struct pt_regs *regs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment