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/agp: Fix agp_amd64_init regression
  x86: Add quirk for Intel DG45FC board to avoid low memory corruption
  x86: Add Dell OptiPlex 760 reboot quirk
  x86, UV: Fix RTC latency bug by reading replicated cachelines
  oprofile/x86: add Xeon 7500 series support
  oprofile/x86: fix crash when profiling more than 28 events
  lib/dma-debug.c: mark file-local struct symbol static.
  x86/amd-iommu: Fix deassignment of a device from the pt_domain
  x86/amd-iommu: Fix IOMMU-API initialization for iommu=pt
  x86/amd-iommu: Fix NULL pointer dereference in __detach_device()
  x86/amd-iommu: Fix possible integer overflow
  • Loading branch information
Linus Torvalds committed Feb 1, 2010
2 parents ed23690 + 61684ce commit 4ca5ded
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 24 deletions.
1 change: 1 addition & 0 deletions arch/x86/include/asm/amd_iommu_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ 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);
extern void amd_iommu_init_api(void);
#ifndef CONFIG_AMD_IOMMU_STATS

static inline void amd_iommu_stats_init(void) { }
Expand Down
23 changes: 16 additions & 7 deletions arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom,
{
int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT;
struct amd_iommu *iommu;
int i;
unsigned long i;

#ifdef CONFIG_IOMMU_STRESS
populate = false;
Expand Down Expand Up @@ -1489,11 +1489,14 @@ static void __detach_device(struct device *dev)
{
struct iommu_dev_data *dev_data = get_dev_data(dev);
struct iommu_dev_data *alias_data;
struct protection_domain *domain;
unsigned long flags;

BUG_ON(!dev_data->domain);

spin_lock_irqsave(&dev_data->domain->lock, flags);
domain = dev_data->domain;

spin_lock_irqsave(&domain->lock, flags);

if (dev_data->alias != dev) {
alias_data = get_dev_data(dev_data->alias);
Expand All @@ -1504,13 +1507,15 @@ static void __detach_device(struct device *dev)
if (atomic_dec_and_test(&dev_data->bind))
do_detach(dev);

spin_unlock_irqrestore(&dev_data->domain->lock, flags);
spin_unlock_irqrestore(&domain->lock, flags);

/*
* If we run in passthrough mode the device must be assigned to the
* passthrough domain if it is detached from any other domain
* passthrough domain if it is detached from any other domain.
* Make sure we can deassign from the pt_domain itself.
*/
if (iommu_pass_through && dev_data->domain == NULL)
if (iommu_pass_through &&
(dev_data->domain == NULL && domain != pt_domain))
__attach_device(dev, pt_domain);
}

Expand Down Expand Up @@ -2218,6 +2223,12 @@ static struct dma_map_ops amd_iommu_dma_ops = {
/*
* The function which clues the AMD IOMMU driver into dma_ops.
*/

void __init amd_iommu_init_api(void)
{
register_iommu(&amd_iommu_ops);
}

int __init amd_iommu_init_dma_ops(void)
{
struct amd_iommu *iommu;
Expand Down Expand Up @@ -2253,8 +2264,6 @@ int __init amd_iommu_init_dma_ops(void)
/* Make the driver finally visible to the drivers */
dma_ops = &amd_iommu_dma_ops;

register_iommu(&amd_iommu_ops);

amd_iommu_stats_init();

return 0;
Expand Down
3 changes: 3 additions & 0 deletions arch/x86/kernel/amd_iommu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1292,9 +1292,12 @@ static int __init amd_iommu_init(void)
ret = amd_iommu_init_passthrough();
else
ret = amd_iommu_init_dma_ops();

if (ret)
goto free;

amd_iommu_init_api();

amd_iommu_init_notifier();

enable_iommus();
Expand Down
9 changes: 9 additions & 0 deletions arch/x86/kernel/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
DMI_MATCH(DMI_BOARD_NAME, "0T656F"),
},
},
{ /* Handle problems with rebooting on Dell OptiPlex 760 with 0G919G*/
.callback = set_bios_reboot,
.ident = "Dell OptiPlex 760",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 760"),
DMI_MATCH(DMI_BOARD_NAME, "0G919G"),
},
},
{ /* Handle problems with rebooting on Dell 2400's */
.callback = set_bios_reboot,
.ident = "Dell PowerEdge 2400",
Expand Down
14 changes: 11 additions & 3 deletions arch/x86/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,19 +642,27 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix/MSC"),
},
},
{
/*
* AMI BIOS with low memory corruption was found on Intel DG45ID board.
* It hase different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
* AMI BIOS with low memory corruption was found on Intel DG45ID and
* DG45FC boards.
* It has a different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
* match only DMI_BOARD_NAME and see if there is more bad products
* with this vendor.
*/
{
.callback = dmi_low_memory_corruption,
.ident = "AMI BIOS",
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "DG45ID"),
},
},
{
.callback = dmi_low_memory_corruption,
.ident = "AMI BIOS",
.matches = {
DMI_MATCH(DMI_BOARD_NAME, "DG45FC"),
},
},
#endif
{}
};
Expand Down
13 changes: 12 additions & 1 deletion arch/x86/kernel/uv_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,21 @@ static int uv_rtc_unset_timer(int cpu, int force)

/*
* Read the RTC.
*
* Starting with HUB rev 2.0, the UV RTC register is replicated across all
* cachelines of it's own page. This allows faster simultaneous reads
* from a given socket.
*/
static cycle_t uv_read_rtc(struct clocksource *cs)
{
return (cycle_t)uv_read_local_mmr(UVH_RTC);
unsigned long offset;

if (uv_get_min_hub_revision_id() == 1)
offset = 0;
else
offset = (uv_blade_processor_id() * L1_CACHE_BYTES) % PAGE_SIZE;

return (cycle_t)uv_read_local_mmr(UVH_RTC | offset);
}

/*
Expand Down
3 changes: 2 additions & 1 deletion arch/x86/oprofile/nmi_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static void nmi_cpu_switch(void *dummy)

/* move to next set */
si += model->num_counters;
if ((si > model->num_virt_counters) || (counter_config[si].count == 0))
if ((si >= model->num_virt_counters) || (counter_config[si].count == 0))
per_cpu(switch_index, cpu) = 0;
else
per_cpu(switch_index, cpu) = si;
Expand Down Expand Up @@ -598,6 +598,7 @@ static int __init ppro_init(char **cpu_type)
case 15: case 23:
*cpu_type = "i386/core_2";
break;
case 0x2e:
case 26:
spec = &op_arch_perfmon_spec;
*cpu_type = "i386/core_i7";
Expand Down
13 changes: 9 additions & 4 deletions drivers/char/agp/amd64-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,6 @@ int __init agp_amd64_init(void)
if (agp_off)
return -EINVAL;

if (gart_iommu_aperture)
return agp_bridges_found ? 0 : -ENODEV;

err = pci_register_driver(&agp_amd64_pci_driver);
if (err < 0)
return err;
Expand Down Expand Up @@ -768,6 +765,14 @@ int __init agp_amd64_init(void)
return err;
}

static int __init agp_amd64_mod_init(void)
{
if (gart_iommu_aperture)
return agp_bridges_found ? 0 : -ENODEV;

return agp_amd64_init();
}

static void __exit agp_amd64_cleanup(void)
{
if (gart_iommu_aperture)
Expand All @@ -777,7 +782,7 @@ static void __exit agp_amd64_cleanup(void)
pci_unregister_driver(&agp_amd64_pci_driver);
}

module_init(agp_amd64_init);
module_init(agp_amd64_mod_init);
module_exit(agp_amd64_cleanup);

MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen");
Expand Down
18 changes: 11 additions & 7 deletions drivers/char/uv_mmtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ static long uv_mmtimer_ioctl(struct file *file, unsigned int cmd,
switch (cmd) {
case MMTIMER_GETOFFSET: /* offset of the counter */
/*
* UV RTC register is on its own page
* Starting with HUB rev 2.0, the UV RTC register is
* replicated across all cachelines of it's own page.
* This allows faster simultaneous reads from a given socket.
*
* The offset returned is in 64 bit units.
*/
if (PAGE_SIZE <= (1 << 16))
ret = ((UV_LOCAL_MMR_BASE | UVH_RTC) & (PAGE_SIZE-1))
/ 8;
if (uv_get_min_hub_revision_id() == 1)
ret = 0;
else
ret = -ENOSYS;
ret = ((uv_blade_processor_id() * L1_CACHE_BYTES) %
PAGE_SIZE) / 8;
break;

case MMTIMER_GETRES: /* resolution of the clock in 10^-15 s */
Expand All @@ -115,8 +119,8 @@ static long uv_mmtimer_ioctl(struct file *file, unsigned int cmd,
ret = hweight64(UVH_RTC_REAL_TIME_CLOCK_MASK);
break;

case MMTIMER_MMAPAVAIL: /* can we mmap the clock into userspace? */
ret = (PAGE_SIZE <= (1 << 16)) ? 1 : 0;
case MMTIMER_MMAPAVAIL:
ret = 1;
break;

case MMTIMER_GETCOUNTER:
Expand Down
2 changes: 1 addition & 1 deletion lib/dma-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
return count;
}

const struct file_operations filter_fops = {
static const struct file_operations filter_fops = {
.read = filter_read,
.write = filter_write,
};
Expand Down

0 comments on commit 4ca5ded

Please sign in to comment.