Skip to content

Commit

Permalink
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86/amd-iommu: Fix PCI hotplug with passthrough mode
  x86/amd-iommu: Fix passthrough mode
  x86: mmio-mod.c: Use pr_fmt
  x86: kmmio.c: Add and use pr_fmt(fmt)
  x86: i8254.c: Add pr_fmt(fmt)
  x86: setup_percpu.c: Use pr_<level> and add pr_fmt(fmt)
  x86: es7000_32.c: Use pr_<level> and add pr_fmt(fmt)
  x86: Print DMI_BOARD_NAME as well as DMI_PRODUCT_NAME from __show_regs()
  x86: Factor duplicated code out of __show_regs() into show_regs_common()
  arch/x86/kernel/microcode*: Use pr_fmt() and remove duplicated KERN_ERR prefix
  x86, mce: fix confusion between bank attributes and mce attributes
  x86/mce: Set up timer unconditionally
  x86: Fix bogus warning in apic_noop.apic_write()
  x86: Fix typo in arch/x86/mm/kmmio.c
  x86: ASUS P4S800 reboot=bios quirk
  • Loading branch information
Linus Torvalds committed Dec 12, 2009
2 parents df7147b + 9cf7826 commit 7563009
Show file tree
Hide file tree
Showing 18 changed files with 221 additions and 168 deletions.
4 changes: 3 additions & 1 deletion arch/x86/include/asm/amd_iommu_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ extern void amd_iommu_flush_all_domains(void);
extern void amd_iommu_flush_all_devices(void);
extern void amd_iommu_apply_erratum_63(u16 devid);
extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu);

extern int amd_iommu_init_devices(void);
extern void amd_iommu_uninit_devices(void);
extern void amd_iommu_init_notifier(void);
#ifndef CONFIG_AMD_IOMMU_STATS

static inline void amd_iommu_stats_init(void) { }
Expand Down
1 change: 1 addition & 0 deletions arch/x86/include/asm/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
struct tss_struct;
void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
struct tss_struct *tss);
extern void show_regs_common(void);

#ifdef CONFIG_X86_32

Expand Down
46 changes: 42 additions & 4 deletions arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,43 @@ static void iommu_uninit_device(struct device *dev)
{
kfree(dev->archdata.iommu);
}

void __init amd_iommu_uninit_devices(void)
{
struct pci_dev *pdev = NULL;

for_each_pci_dev(pdev) {

if (!check_device(&pdev->dev))
continue;

iommu_uninit_device(&pdev->dev);
}
}

int __init amd_iommu_init_devices(void)
{
struct pci_dev *pdev = NULL;
int ret = 0;

for_each_pci_dev(pdev) {

if (!check_device(&pdev->dev))
continue;

ret = iommu_init_device(&pdev->dev);
if (ret)
goto out_free;
}

return 0;

out_free:

amd_iommu_uninit_devices();

return ret;
}
#ifdef CONFIG_AMD_IOMMU_STATS

/*
Expand Down Expand Up @@ -1587,6 +1624,11 @@ static struct notifier_block device_nb = {
.notifier_call = device_change_notifier,
};

void amd_iommu_init_notifier(void)
{
bus_register_notifier(&pci_bus_type, &device_nb);
}

/*****************************************************************************
*
* The next functions belong to the dma_ops mapping/unmapping code.
Expand Down Expand Up @@ -2145,8 +2187,6 @@ static void prealloc_protection_domains(void)
if (!check_device(&dev->dev))
continue;

iommu_init_device(&dev->dev);

/* Is there already any domain for it? */
if (domain_for_device(&dev->dev))
continue;
Expand Down Expand Up @@ -2215,8 +2255,6 @@ int __init amd_iommu_init_dma_ops(void)

register_iommu(&amd_iommu_ops);

bus_register_notifier(&pci_bus_type, &device_nb);

amd_iommu_stats_init();

return 0;
Expand Down
9 changes: 9 additions & 0 deletions arch/x86/kernel/amd_iommu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1274,13 +1274,19 @@ static int __init amd_iommu_init(void)
if (ret)
goto free;

ret = amd_iommu_init_devices();
if (ret)
goto free;

if (iommu_pass_through)
ret = amd_iommu_init_passthrough();
else
ret = amd_iommu_init_dma_ops();
if (ret)
goto free;

amd_iommu_init_notifier();

enable_iommus();

if (iommu_pass_through)
Expand All @@ -1296,6 +1302,9 @@ static int __init amd_iommu_init(void)
return ret;

free:

amd_iommu_uninit_devices();

free_pages((unsigned long)amd_iommu_pd_alloc_bitmap,
get_order(MAX_DOMAIN_ID/8));

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/apic/apic_noop.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ static u32 noop_apic_read(u32 reg)

static void noop_apic_write(u32 reg, u32 v)
{
WARN_ON_ONCE((cpu_has_apic || !disable_apic));
WARN_ON_ONCE(cpu_has_apic && !disable_apic);
}

struct apic apic_noop = {
Expand Down
12 changes: 7 additions & 5 deletions arch/x86/kernel/apic/es7000_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
*
* http://www.unisys.com
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/notifier.h>
#include <linux/spinlock.h>
#include <linux/cpumask.h>
Expand Down Expand Up @@ -223,9 +226,9 @@ static int parse_unisys_oem(char *oemptr)
mip_addr = val;
mip = (struct mip_reg *)val;
mip_reg = __va(mip);
pr_debug("es7000_mipcfg: host_reg = 0x%lx \n",
pr_debug("host_reg = 0x%lx\n",
(unsigned long)host_reg);
pr_debug("es7000_mipcfg: mip_reg = 0x%lx \n",
pr_debug("mip_reg = 0x%lx\n",
(unsigned long)mip_reg);
success++;
break;
Expand Down Expand Up @@ -401,7 +404,7 @@ static void es7000_enable_apic_mode(void)
if (!es7000_plat)
return;

printk(KERN_INFO "ES7000: Enabling APIC mode.\n");
pr_info("Enabling APIC mode.\n");
memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
es7000_mip_reg.off_0x00 = MIP_SW_APIC;
es7000_mip_reg.off_0x38 = MIP_VALID;
Expand Down Expand Up @@ -514,8 +517,7 @@ static void es7000_setup_apic_routing(void)
{
int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());

printk(KERN_INFO
"Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
pr_info("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
(apic_version[apic] == 0x14) ?
"Physical Cluster" : "Logical Cluster",
nr_ioapics, cpumask_bits(es7000_target_cpus())[0]);
Expand Down
5 changes: 3 additions & 2 deletions arch/x86/kernel/cpu/mcheck/mce.c
Original file line number Diff line number Diff line change
Expand Up @@ -1388,13 +1388,14 @@ static void __mcheck_cpu_init_timer(void)
struct timer_list *t = &__get_cpu_var(mce_timer);
int *n = &__get_cpu_var(mce_next_interval);

setup_timer(t, mce_start_timer, smp_processor_id());

if (mce_ignore_ce)
return;

*n = check_interval * HZ;
if (!*n)
return;
setup_timer(t, mce_start_timer, smp_processor_id());
t->expires = round_jiffies(jiffies + *n);
add_timer_on(t, smp_processor_id());
}
Expand Down Expand Up @@ -1928,7 +1929,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
sysdev_remove_file(&per_cpu(mce_dev, cpu), &mce_banks[j].attr);
error:
while (--i >= 0)
sysdev_remove_file(&per_cpu(mce_dev, cpu), &mce_banks[i].attr);
sysdev_remove_file(&per_cpu(mce_dev, cpu), mce_attrs[i]);

sysdev_unregister(&per_cpu(mce_dev, cpu));

Expand Down
40 changes: 19 additions & 21 deletions arch/x86/kernel/microcode_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
* Licensed under the terms of the GNU General Public
* License version 2. See file COPYING for details.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/firmware.h>
#include <linux/pci_ids.h>
#include <linux/uaccess.h>
Expand Down Expand Up @@ -81,7 +84,7 @@ static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)

memset(csig, 0, sizeof(*csig));
rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy);
pr_info("microcode: CPU%d: patch_level=0x%x\n", cpu, csig->rev);
pr_info("CPU%d: patch_level=0x%x\n", cpu, csig->rev);
return 0;
}

Expand Down Expand Up @@ -111,8 +114,8 @@ static int get_matching_microcode(int cpu, void *mc, int rev)

/* ucode might be chipset specific -- currently we don't support this */
if (mc_header->nb_dev_id || mc_header->sb_dev_id) {
pr_err(KERN_ERR "microcode: CPU%d: loading of chipset "
"specific code not yet supported\n", cpu);
pr_err("CPU%d: loading of chipset specific code not yet supported\n",
cpu);
return 0;
}

Expand Down Expand Up @@ -141,12 +144,12 @@ static int apply_microcode_amd(int cpu)

/* check current patch id and patch's id for match */
if (rev != mc_amd->hdr.patch_id) {
pr_err("microcode: CPU%d: update failed "
"(for patch_level=0x%x)\n", cpu, mc_amd->hdr.patch_id);
pr_err("CPU%d: update failed (for patch_level=0x%x)\n",
cpu, mc_amd->hdr.patch_id);
return -1;
}

pr_info("microcode: CPU%d: updated (new patch_level=0x%x)\n", cpu, rev);
pr_info("CPU%d: updated (new patch_level=0x%x)\n", cpu, rev);
uci->cpu_sig.rev = rev;

return 0;
Expand All @@ -169,15 +172,14 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
return NULL;

if (section_hdr[0] != UCODE_UCODE_TYPE) {
pr_err("microcode: error: invalid type field in "
"container file section header\n");
pr_err("error: invalid type field in container file section header\n");
return NULL;
}

total_size = (unsigned long) (section_hdr[4] + (section_hdr[5] << 8));

if (total_size > size || total_size > UCODE_MAX_SIZE) {
pr_err("microcode: error: size mismatch\n");
pr_err("error: size mismatch\n");
return NULL;
}

Expand Down Expand Up @@ -206,14 +208,13 @@ static int install_equiv_cpu_table(const u8 *buf)
size = buf_pos[2];

if (buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE || !size) {
pr_err("microcode: error: invalid type field in "
"container file section header\n");
pr_err("error: invalid type field in container file section header\n");
return 0;
}

equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size);
if (!equiv_cpu_table) {
pr_err("microcode: failed to allocate equivalent CPU table\n");
pr_err("failed to allocate equivalent CPU table\n");
return 0;
}

Expand Down Expand Up @@ -246,7 +247,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)

offset = install_equiv_cpu_table(ucode_ptr);
if (!offset) {
pr_err("microcode: failed to create equivalent cpu table\n");
pr_err("failed to create equivalent cpu table\n");
return UCODE_ERROR;
}

Expand Down Expand Up @@ -277,8 +278,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
if (!leftover) {
vfree(uci->mc);
uci->mc = new_mc;
pr_debug("microcode: CPU%d found a matching microcode "
"update with version 0x%x (current=0x%x)\n",
pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n",
cpu, new_rev, uci->cpu_sig.rev);
} else {
vfree(new_mc);
Expand All @@ -300,7 +300,7 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device)
return UCODE_NFOUND;

if (*(u32 *)firmware->data != UCODE_MAGIC) {
pr_err("microcode: invalid UCODE_MAGIC (0x%08x)\n",
pr_err("invalid UCODE_MAGIC (0x%08x)\n",
*(u32 *)firmware->data);
return UCODE_ERROR;
}
Expand All @@ -313,8 +313,7 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device)
static enum ucode_state
request_microcode_user(int cpu, const void __user *buf, size_t size)
{
pr_info("microcode: AMD microcode update via "
"/dev/cpu/microcode not supported\n");
pr_info("AMD microcode update via /dev/cpu/microcode not supported\n");
return UCODE_ERROR;
}

Expand All @@ -334,14 +333,13 @@ void init_microcode_amd(struct device *device)
WARN_ON(c->x86_vendor != X86_VENDOR_AMD);

if (c->x86 < 0x10) {
pr_warning("microcode: AMD CPU family 0x%x not supported\n",
c->x86);
pr_warning("AMD CPU family 0x%x not supported\n", c->x86);
return;
}
supported_cpu = 1;

if (request_firmware(&firmware, fw_name, device))
pr_err("microcode: failed to load file %s\n", fw_name);
pr_err("failed to load file %s\n", fw_name);
}

void fini_microcode_amd(void)
Expand Down
Loading

0 comments on commit 7563009

Please sign in to comment.