Skip to content

Commit

Permalink
Merge branch 'linux-3.1.y' into android-tegra-nv-3.1
Browse files Browse the repository at this point in the history
Linux 3.1.10

Change-Id: I465d184c492e8041dd0cd90f2cb70fde17ba7118
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
  • Loading branch information
Varun Wadekar committed Jan 24, 2012
2 parents ac64f77 + 9bb1282 commit 058cf84
Show file tree
Hide file tree
Showing 58 changed files with 589 additions and 280 deletions.
7 changes: 7 additions & 0 deletions Documentation/virtual/kvm/api.txt
Expand Up @@ -1131,6 +1131,13 @@ following flags are specified:
/* Depends on KVM_CAP_IOMMU */
#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)

The KVM_DEV_ASSIGN_ENABLE_IOMMU flag is a mandatory option to ensure
isolation of the device. Usages not specifying this flag are deprecated.

Only PCI header type 0 devices with PCI BAR resources are supported by
device assignment. The user requesting this ioctl must have read/write
access to the PCI sysfs resource files associated with the device.

4.49 KVM_DEASSIGN_PCI_DEVICE

Capability: KVM_CAP_DEVICE_DEASSIGNMENT
Expand Down
2 changes: 1 addition & 1 deletion Makefile
@@ -1,6 +1,6 @@
VERSION = 3
PATCHLEVEL = 1
SUBLEVEL = 9
SUBLEVEL = 10
EXTRAVERSION =
NAME = "Divemaster Edition"

Expand Down
2 changes: 2 additions & 0 deletions arch/x86/include/asm/amd_nb.h
@@ -1,6 +1,7 @@
#ifndef _ASM_X86_AMD_NB_H
#define _ASM_X86_AMD_NB_H

#include <linux/ioport.h>
#include <linux/pci.h>

struct amd_nb_bus_dev_range {
Expand All @@ -13,6 +14,7 @@ extern const struct pci_device_id amd_nb_misc_ids[];
extern const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[];

extern bool early_is_amd_nb(u32 value);
extern struct resource *amd_get_mmconfig_range(struct resource *res);
extern int amd_cache_northbridges(void);
extern void amd_flush_garts(void);
extern int amd_numa_init(void);
Expand Down
31 changes: 31 additions & 0 deletions arch/x86/kernel/amd_nb.c
Expand Up @@ -119,6 +119,37 @@ bool __init early_is_amd_nb(u32 device)
return false;
}

struct resource *amd_get_mmconfig_range(struct resource *res)
{
u32 address;
u64 base, msr;
unsigned segn_busn_bits;

if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
return NULL;

/* assume all cpus from fam10h have mmconfig */
if (boot_cpu_data.x86 < 0x10)
return NULL;

address = MSR_FAM10H_MMIO_CONF_BASE;
rdmsrl(address, msr);

/* mmconfig is not enabled */
if (!(msr & FAM10H_MMIO_CONF_ENABLE))
return NULL;

base = msr & (FAM10H_MMIO_CONF_BASE_MASK<<FAM10H_MMIO_CONF_BASE_SHIFT);

segn_busn_bits = (msr >> FAM10H_MMIO_CONF_BUSRANGE_SHIFT) &
FAM10H_MMIO_CONF_BUSRANGE_MASK;

res->flags = IORESOURCE_MEM;
res->start = base;
res->end = base + (1ULL<<(segn_busn_bits + 20)) - 1;
return res;
}

int amd_get_subcaches(int cpu)
{
struct pci_dev *link = node_to_amd_nb(amd_get_nb_id(cpu))->link;
Expand Down
5 changes: 3 additions & 2 deletions arch/x86/kernel/kvmclock.c
Expand Up @@ -74,9 +74,10 @@ static cycle_t kvm_clock_read(void)
struct pvclock_vcpu_time_info *src;
cycle_t ret;

src = &get_cpu_var(hv_clock);
preempt_disable_notrace();
src = &__get_cpu_var(hv_clock);
ret = pvclock_clocksource_read(src);
put_cpu_var(hv_clock);
preempt_enable_notrace();
return ret;
}

Expand Down
10 changes: 7 additions & 3 deletions arch/x86/kvm/i8254.c
Expand Up @@ -338,11 +338,15 @@ static enum hrtimer_restart pit_timer_fn(struct hrtimer *data)
return HRTIMER_NORESTART;
}

static void create_pit_timer(struct kvm_kpit_state *ps, u32 val, int is_period)
static void create_pit_timer(struct kvm *kvm, u32 val, int is_period)
{
struct kvm_kpit_state *ps = &kvm->arch.vpit->pit_state;
struct kvm_timer *pt = &ps->pit_timer;
s64 interval;

if (!irqchip_in_kernel(kvm))
return;

interval = muldiv64(val, NSEC_PER_SEC, KVM_PIT_FREQ);

pr_debug("create pit timer, interval is %llu nsec\n", interval);
Expand Down Expand Up @@ -394,13 +398,13 @@ static void pit_load_count(struct kvm *kvm, int channel, u32 val)
/* FIXME: enhance mode 4 precision */
case 4:
if (!(ps->flags & KVM_PIT_FLAGS_HPET_LEGACY)) {
create_pit_timer(ps, val, 0);
create_pit_timer(kvm, val, 0);
}
break;
case 2:
case 3:
if (!(ps->flags & KVM_PIT_FLAGS_HPET_LEGACY)){
create_pit_timer(ps, val, 1);
create_pit_timer(kvm, val, 1);
}
break;
default:
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/mm/mmap.c
Expand Up @@ -87,9 +87,9 @@ static unsigned long mmap_rnd(void)
*/
if (current->flags & PF_RANDOMIZE) {
if (mmap_is_ia32())
rnd = (long)get_random_int() % (1<<8);
rnd = get_random_int() % (1<<8);
else
rnd = (long)(get_random_int() % (1<<28));
rnd = get_random_int() % (1<<28);
}
return rnd << PAGE_SHIFT;
}
Expand Down
3 changes: 2 additions & 1 deletion arch/x86/pci/Makefile
Expand Up @@ -18,8 +18,9 @@ obj-$(CONFIG_X86_NUMAQ) += numaq_32.o
obj-$(CONFIG_X86_MRST) += mrst.o

obj-y += common.o early.o
obj-y += amd_bus.o bus_numa.o
obj-y += bus_numa.o

obj-$(CONFIG_AMD_NB) += amd_bus.o
obj-$(CONFIG_PCI_CNB20LE_QUIRK) += broadcom_bus.o

ifeq ($(CONFIG_PCI_DEBUG),y)
Expand Down
18 changes: 16 additions & 2 deletions arch/x86/pci/acpi.c
Expand Up @@ -149,7 +149,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
struct acpi_resource_address64 addr;
acpi_status status;
unsigned long flags;
u64 start, end;
u64 start, orig_end, end;

status = resource_to_addr(acpi_res, &addr);
if (!ACPI_SUCCESS(status))
Expand All @@ -165,7 +165,21 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
return AE_OK;

start = addr.minimum + addr.translation_offset;
end = addr.maximum + addr.translation_offset;
orig_end = end = addr.maximum + addr.translation_offset;

/* Exclude non-addressable range or non-addressable portion of range */
end = min(end, (u64)iomem_resource.end);
if (end <= start) {
dev_info(&info->bridge->dev,
"host bridge window [%#llx-%#llx] "
"(ignored, not CPU addressable)\n", start, orig_end);
return AE_OK;
} else if (orig_end != end) {
dev_info(&info->bridge->dev,
"host bridge window [%#llx-%#llx] "
"([%#llx-%#llx] ignored, not CPU addressable)\n",
start, orig_end, end + 1, orig_end);
}

res = &info->res[info->res_num];
res->name = info->name;
Expand Down
42 changes: 11 additions & 31 deletions arch/x86/pci/amd_bus.c
Expand Up @@ -30,34 +30,6 @@ static struct pci_hostbridge_probe pci_probes[] __initdata = {
{ 0, 0x18, PCI_VENDOR_ID_AMD, 0x1300 },
};

static u64 __initdata fam10h_mmconf_start;
static u64 __initdata fam10h_mmconf_end;
static void __init get_pci_mmcfg_amd_fam10h_range(void)
{
u32 address;
u64 base, msr;
unsigned segn_busn_bits;

/* assume all cpus from fam10h have mmconf */
if (boot_cpu_data.x86 < 0x10)
return;

address = MSR_FAM10H_MMIO_CONF_BASE;
rdmsrl(address, msr);

/* mmconfig is not enable */
if (!(msr & FAM10H_MMIO_CONF_ENABLE))
return;

base = msr & (FAM10H_MMIO_CONF_BASE_MASK<<FAM10H_MMIO_CONF_BASE_SHIFT);

segn_busn_bits = (msr >> FAM10H_MMIO_CONF_BUSRANGE_SHIFT) &
FAM10H_MMIO_CONF_BUSRANGE_MASK;

fam10h_mmconf_start = base;
fam10h_mmconf_end = base + (1ULL<<(segn_busn_bits + 20)) - 1;
}

#define RANGE_NUM 16

/**
Expand Down Expand Up @@ -85,6 +57,9 @@ static int __init early_fill_mp_bus_info(void)
u64 val;
u32 address;
bool found;
struct resource fam10h_mmconf_res, *fam10h_mmconf;
u64 fam10h_mmconf_start;
u64 fam10h_mmconf_end;

if (!early_pci_allowed())
return -1;
Expand Down Expand Up @@ -211,12 +186,17 @@ static int __init early_fill_mp_bus_info(void)
subtract_range(range, RANGE_NUM, 0, end);

/* get mmconfig */
get_pci_mmcfg_amd_fam10h_range();
fam10h_mmconf = amd_get_mmconfig_range(&fam10h_mmconf_res);
/* need to take out mmconf range */
if (fam10h_mmconf_end) {
printk(KERN_DEBUG "Fam 10h mmconf [%llx, %llx]\n", fam10h_mmconf_start, fam10h_mmconf_end);
if (fam10h_mmconf) {
printk(KERN_DEBUG "Fam 10h mmconf %pR\n", fam10h_mmconf);
fam10h_mmconf_start = fam10h_mmconf->start;
fam10h_mmconf_end = fam10h_mmconf->end;
subtract_range(range, RANGE_NUM, fam10h_mmconf_start,
fam10h_mmconf_end + 1);
} else {
fam10h_mmconf_start = 0;
fam10h_mmconf_end = 0;
}

/* mmio resource */
Expand Down
5 changes: 3 additions & 2 deletions drivers/gpu/drm/radeon/r100.c
Expand Up @@ -2069,6 +2069,7 @@ bool r100_gpu_is_lockup(struct radeon_device *rdev)
void r100_bm_disable(struct radeon_device *rdev)
{
u32 tmp;
u16 tmp16;

/* disable bus mastering */
tmp = RREG32(R_000030_BUS_CNTL);
Expand All @@ -2079,8 +2080,8 @@ void r100_bm_disable(struct radeon_device *rdev)
WREG32(R_000030_BUS_CNTL, (tmp & 0xFFFFFFFF) | 0x00000040);
tmp = RREG32(RADEON_BUS_CNTL);
mdelay(1);
pci_read_config_word(rdev->pdev, 0x4, (u16*)&tmp);
pci_write_config_word(rdev->pdev, 0x4, tmp & 0xFFFB);
pci_read_config_word(rdev->pdev, 0x4, &tmp16);
pci_write_config_word(rdev->pdev, 0x4, tmp16 & 0xFFFB);
mdelay(1);
}

Expand Down
7 changes: 7 additions & 0 deletions drivers/gpu/drm/radeon/r600_hdmi.c
Expand Up @@ -196,6 +196,13 @@ static void r600_hdmi_videoinfoframe(
frame[0xD] = (right_bar >> 8);

r600_hdmi_infoframe_checksum(0x82, 0x02, 0x0D, frame);
/* Our header values (type, version, length) should be alright, Intel
* is using the same. Checksum function also seems to be OK, it works
* fine for audio infoframe. However calculated value is always lower
* by 2 in comparison to fglrx. It breaks displaying anything in case
* of TVs that strictly check the checksum. Hack it manually here to
* workaround this issue. */
frame[0x0] += 2;

WREG32(offset+R600_HDMI_VIDEOINFOFRAME_0,
frame[0x0] | (frame[0x1] << 8) | (frame[0x2] << 16) | (frame[0x3] << 24));
Expand Down
5 changes: 4 additions & 1 deletion drivers/gpu/drm/radeon/radeon_device.c
Expand Up @@ -224,8 +224,11 @@ int radeon_wb_init(struct radeon_device *rdev)
if (radeon_no_wb == 1)
rdev->wb.enabled = false;
else {
/* often unreliable on AGP */
if (rdev->flags & RADEON_IS_AGP) {
/* often unreliable on AGP */
rdev->wb.enabled = false;
} else if (rdev->family < CHIP_R300) {
/* often unreliable on pre-r300 */
rdev->wb.enabled = false;
} else {
rdev->wb.enabled = true;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/radeon/rs600.c
Expand Up @@ -324,10 +324,10 @@ void rs600_hpd_fini(struct radeon_device *rdev)

void rs600_bm_disable(struct radeon_device *rdev)
{
u32 tmp;
u16 tmp;

/* disable bus mastering */
pci_read_config_word(rdev->pdev, 0x4, (u16*)&tmp);
pci_read_config_word(rdev->pdev, 0x4, &tmp);
pci_write_config_word(rdev->pdev, 0x4, tmp & 0xFFFB);
mdelay(1);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/hid-core.c
Expand Up @@ -361,7 +361,7 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)

case HID_GLOBAL_ITEM_TAG_REPORT_SIZE:
parser->global.report_size = item_udata(item);
if (parser->global.report_size > 32) {
if (parser->global.report_size > 96) {
dbg_hid("invalid report_size %d\n",
parser->global.report_size);
return -1;
Expand Down
11 changes: 10 additions & 1 deletion drivers/md/raid1.c
Expand Up @@ -508,8 +508,17 @@ static int read_balance(conf_t *conf, r1bio_t *r1_bio, int *max_sectors)
if (test_bit(WriteMostly, &rdev->flags)) {
/* Don't balance among write-mostly, just
* use the first as a last resort */
if (best_disk < 0)
if (best_disk < 0) {
if (is_badblock(rdev, this_sector, sectors,
&first_bad, &bad_sectors)) {
if (first_bad < this_sector)
/* Cannot use this */
continue;
best_good_sectors = first_bad - this_sector;
} else
best_good_sectors = sectors;
best_disk = disk;
}
continue;
}
/* This is a reasonable device to use. It might
Expand Down
3 changes: 2 additions & 1 deletion drivers/mtd/mtd_blkdevs.c
Expand Up @@ -215,7 +215,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)

mutex_lock(&dev->lock);

if (dev->open++)
if (dev->open)
goto unlock;

kref_get(&dev->ref);
Expand All @@ -235,6 +235,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
goto error_release;

unlock:
dev->open++;
mutex_unlock(&dev->lock);
blktrans_dev_put(dev);
return ret;
Expand Down
5 changes: 4 additions & 1 deletion drivers/mtd/mtdoops.c
Expand Up @@ -253,6 +253,9 @@ static void find_next_position(struct mtdoops_context *cxt)
size_t retlen;

for (page = 0; page < cxt->oops_pages; page++) {
if (mtd->block_isbad &&
mtd->block_isbad(mtd, page * record_size))
continue;
/* Assume the page is used */
mark_page_used(cxt, page);
ret = mtd->read(mtd, page * record_size, MTDOOPS_HEADER_SIZE,
Expand Down Expand Up @@ -369,7 +372,7 @@ static void mtdoops_notify_add(struct mtd_info *mtd)

/* oops_page_used is a bit field */
cxt->oops_page_used = vmalloc(DIV_ROUND_UP(mtdoops_pages,
BITS_PER_LONG));
BITS_PER_LONG) * sizeof(unsigned long));
if (!cxt->oops_page_used) {
printk(KERN_ERR "mtdoops: could not allocate page array\n");
return;
Expand Down
7 changes: 7 additions & 0 deletions drivers/mtd/tests/mtd_stresstest.c
Expand Up @@ -277,6 +277,12 @@ static int __init mtd_stresstest_init(void)
(unsigned long long)mtd->size, mtd->erasesize,
pgsize, ebcnt, pgcnt, mtd->oobsize);

if (ebcnt < 2) {
printk(PRINT_PREF "error: need at least 2 eraseblocks\n");
err = -ENOSPC;
goto out_put_mtd;
}

/* Read or write up 2 eraseblocks at a time */
bufsize = mtd->erasesize * 2;

Expand Down Expand Up @@ -315,6 +321,7 @@ static int __init mtd_stresstest_init(void)
kfree(bbt);
vfree(writebuf);
vfree(readbuf);
out_put_mtd:
put_mtd_device(mtd);
if (err)
printk(PRINT_PREF "error %d occurred\n", err);
Expand Down

0 comments on commit 058cf84

Please sign in to comment.