]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'cpus4096-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 10 Jan 2009 14:12:18 +0000 (06:12 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 10 Jan 2009 14:12:18 +0000 (06:12 -0800)
* 'cpus4096-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  [IA64] fix typo in cpumask_of_pcibus()
  x86: fix x86_32 builds for summit and es7000 arch's
  cpumask: use work_on_cpu in acpi-cpufreq.c for read_measured_perf_ctrs
  cpumask: use work_on_cpu in acpi-cpufreq.c for drv_read and drv_write
  cpumask: use cpumask_var_t in acpi-cpufreq.c
  cpumask: use work_on_cpu in acpi/cstate.c
  cpumask: convert struct cpufreq_policy to cpumask_var_t
  cpumask: replace CPUMASK_ALLOC etc with cpumask_var_t
  x86: cleanup remaining cpumask_t ops in smpboot code
  cpumask: update pci_bus_show_cpuaffinity to use new cpumask API
  cpumask: update local_cpus_show to use new cpumask API
  ia64: cpumask fix for is_affinity_mask_valid()

1  2 
arch/x86/kernel/acpi/cstate.c
drivers/pci/pci-sysfs.c
drivers/pci/probe.c

index a4805b3b4095bd7e0b8cdb68bd73d617d423c136,cf5ec586f22069c5bdeb3a3dee49dc77536a228b..bbbe4bbb6f34b7ed8bf60cf849faa32963e93d90
@@@ -56,7 -56,6 +56,7 @@@ static struct cstate_entry *cpu_cstate_
  static short mwait_supported[ACPI_PROCESSOR_MAX_POWER];
  
  #define MWAIT_SUBSTATE_MASK   (0xf)
 +#define MWAIT_CSTATE_MASK     (0xf)
  #define MWAIT_SUBSTATE_SIZE   (4)
  
  #define CPUID_MWAIT_LEAF (5)
  
  #define NATIVE_CSTATE_BEYOND_HALT     (2)
  
- int acpi_processor_ffh_cstate_probe(unsigned int cpu,
-               struct acpi_processor_cx *cx, struct acpi_power_register *reg)
+ static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
  {
-       struct cstate_entry *percpu_entry;
-       struct cpuinfo_x86 *c = &cpu_data(cpu);
-       cpumask_t saved_mask;
-       int retval;
+       struct acpi_processor_cx *cx = _cx;
+       long retval;
        unsigned int eax, ebx, ecx, edx;
        unsigned int edx_part;
        unsigned int cstate_type; /* C-state type and not ACPI C-state type */
        unsigned int num_cstate_subtype;
  
-       if (!cpu_cstate_entry || c->cpuid_level < CPUID_MWAIT_LEAF )
-               return -1;
-       if (reg->bit_offset != NATIVE_CSTATE_BEYOND_HALT)
-               return -1;
-       percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu);
-       percpu_entry->states[cx->index].eax = 0;
-       percpu_entry->states[cx->index].ecx = 0;
-       /* Make sure we are running on right CPU */
-       saved_mask = current->cpus_allowed;
-       retval = set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
-       if (retval)
-               return -1;
        cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
  
        /* Check whether this particular cx_type (in CST) is supported or not */
 -      cstate_type = (cx->address >> MWAIT_SUBSTATE_SIZE) + 1;
 +      cstate_type = ((cx->address >> MWAIT_SUBSTATE_SIZE) &
 +                      MWAIT_CSTATE_MASK) + 1;
        edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE);
        num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK;
  
                retval = -1;
                goto out;
        }
-       percpu_entry->states[cx->index].ecx = MWAIT_ECX_INTERRUPT_BREAK;
-       /* Use the hint in CST */
-       percpu_entry->states[cx->index].eax = cx->address;
  
        if (!mwait_supported[cstate_type]) {
                mwait_supported[cstate_type] = 1;
-               printk(KERN_DEBUG "Monitor-Mwait will be used to enter C-%d "
-                      "state\n", cx->type);
+               printk(KERN_DEBUG
+                       "Monitor-Mwait will be used to enter C-%d "
+                       "state\n", cx->type);
        }
-       snprintf(cx->desc, ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
-                cx->address);
+       snprintf(cx->desc,
+                       ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
+                       cx->address);
  out:
-       set_cpus_allowed_ptr(current, &saved_mask);
+       return retval;
+ }
+ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
+               struct acpi_processor_cx *cx, struct acpi_power_register *reg)
+ {
+       struct cstate_entry *percpu_entry;
+       struct cpuinfo_x86 *c = &cpu_data(cpu);
+       long retval;
+       if (!cpu_cstate_entry || c->cpuid_level < CPUID_MWAIT_LEAF)
+               return -1;
+       if (reg->bit_offset != NATIVE_CSTATE_BEYOND_HALT)
+               return -1;
+       percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu);
+       percpu_entry->states[cx->index].eax = 0;
+       percpu_entry->states[cx->index].ecx = 0;
+       /* Make sure we are running on right CPU */
+       retval = work_on_cpu(cpu, acpi_processor_ffh_cstate_probe_cpu, cx);
+       if (retval == 0) {
+               /* Use the hint in CST */
+               percpu_entry->states[cx->index].eax = cx->address;
+               percpu_entry->states[cx->index].ecx = MWAIT_ECX_INTERRUPT_BREAK;
+       }
        return retval;
  }
  EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe);
diff --combined drivers/pci/pci-sysfs.c
index c23619fb6c4b1cc252a617dec6d7ac4cb779eed5,e4957e2c92c9ff5833b39608288e9db9eb307c17..db7ec14fa7191828d91f58eb903bfc94cd60ef8c
@@@ -58,24 -58,23 +58,24 @@@ static ssize_t broken_parity_status_sto
                                          const char *buf, size_t count)
  {
        struct pci_dev *pdev = to_pci_dev(dev);
 -      ssize_t consumed = -EINVAL;
 +      unsigned long val;
  
 -      if ((count > 0) && (*buf == '0' || *buf == '1')) {
 -              pdev->broken_parity_status = *buf == '1' ? 1 : 0;
 -              consumed = count;
 -      }
 -      return consumed;
 +      if (strict_strtoul(buf, 0, &val) < 0)
 +              return -EINVAL;
 +
 +      pdev->broken_parity_status = !!val;
 +
 +      return count;
  }
  
  static ssize_t local_cpus_show(struct device *dev,
                        struct device_attribute *attr, char *buf)
  {             
-       cpumask_t mask;
+       const struct cpumask *mask;
        int len;
  
-       mask = pcibus_to_cpumask(to_pci_dev(dev)->bus);
-       len = cpumask_scnprintf(buf, PAGE_SIZE-2, &mask);
+       mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
+       len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask);
        buf[len++] = '\n';
        buf[len] = '\0';
        return len;
  static ssize_t local_cpulist_show(struct device *dev,
                        struct device_attribute *attr, char *buf)
  {
-       cpumask_t mask;
+       const struct cpumask *mask;
        int len;
  
-       mask = pcibus_to_cpumask(to_pci_dev(dev)->bus);
-       len = cpulist_scnprintf(buf, PAGE_SIZE-2, &mask);
+       mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
+       len = cpulist_scnprintf(buf, PAGE_SIZE-2, mask);
        buf[len++] = '\n';
        buf[len] = '\0';
        return len;
@@@ -102,13 -101,11 +102,13 @@@ resource_show(struct device * dev, stru
        struct pci_dev * pci_dev = to_pci_dev(dev);
        char * str = buf;
        int i;
 -      int max = 7;
 +      int max;
        resource_size_t start, end;
  
        if (pci_dev->subordinate)
                max = DEVICE_COUNT_RESOURCE;
 +      else
 +              max = PCI_BRIDGE_RESOURCES;
  
        for (i = 0; i < max; i++) {
                struct resource *res =  &pci_dev->resource[i];
@@@ -136,23 -133,19 +136,23 @@@ static ssize_t is_enabled_store(struct 
                                struct device_attribute *attr, const char *buf,
                                size_t count)
  {
 -      ssize_t result = -EINVAL;
        struct pci_dev *pdev = to_pci_dev(dev);
 +      unsigned long val;
 +      ssize_t result = strict_strtoul(buf, 0, &val);
 +
 +      if (result < 0)
 +              return result;
  
        /* this can crash the machine when done on the "wrong" device */
        if (!capable(CAP_SYS_ADMIN))
 -              return count;
 +              return -EPERM;
  
 -      if (*buf == '0') {
 +      if (!val) {
                if (atomic_read(&pdev->enable_cnt) != 0)
                        pci_disable_device(pdev);
                else
                        result = -EIO;
 -      } else if (*buf == '1')
 +      } else
                result = pci_enable_device(pdev);
  
        return result < 0 ? result : count;
@@@ -192,28 -185,25 +192,28 @@@ msi_bus_store(struct device *dev, struc
              const char *buf, size_t count)
  {
        struct pci_dev *pdev = to_pci_dev(dev);
 +      unsigned long val;
 +
 +      if (strict_strtoul(buf, 0, &val) < 0)
 +              return -EINVAL;
  
        /* bad things may happen if the no_msi flag is changed
         * while some drivers are loaded */
        if (!capable(CAP_SYS_ADMIN))
 -              return count;
 +              return -EPERM;
  
 +      /* Maybe pci devices without subordinate busses shouldn't even have this
 +       * attribute in the first place?  */
        if (!pdev->subordinate)
                return count;
  
 -      if (*buf == '0') {
 -              pdev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
 -              dev_warn(&pdev->dev, "forced subordinate bus to not support MSI,"
 -                       " bad things could happen.\n");
 -      }
 +      /* Is the flag going to change, or keep the value it already had? */
 +      if (!(pdev->subordinate->bus_flags & PCI_BUS_FLAGS_NO_MSI) ^
 +          !!val) {
 +              pdev->subordinate->bus_flags ^= PCI_BUS_FLAGS_NO_MSI;
  
 -      if (*buf == '1') {
 -              pdev->subordinate->bus_flags &= ~PCI_BUS_FLAGS_NO_MSI;
 -              dev_warn(&pdev->dev, "forced subordinate bus to support MSI,"
 -                       " bad things could happen.\n");
 +              dev_warn(&pdev->dev, "forced subordinate bus to%s support MSI,"
 +                       " bad things could happen\n", val ? "" : " not");
        }
  
        return count;
@@@ -371,33 -361,55 +371,33 @@@ pci_write_config(struct kobject *kobj, 
  }
  
  static ssize_t
 -pci_read_vpd(struct kobject *kobj, struct bin_attribute *bin_attr,
 -           char *buf, loff_t off, size_t count)
 +read_vpd_attr(struct kobject *kobj, struct bin_attribute *bin_attr,
 +            char *buf, loff_t off, size_t count)
  {
        struct pci_dev *dev =
                to_pci_dev(container_of(kobj, struct device, kobj));
 -      int end;
 -      int ret;
  
        if (off > bin_attr->size)
                count = 0;
        else if (count > bin_attr->size - off)
                count = bin_attr->size - off;
 -      end = off + count;
 -
 -      while (off < end) {
 -              ret = dev->vpd->ops->read(dev, off, end - off, buf);
 -              if (ret < 0)
 -                      return ret;
 -              buf += ret;
 -              off += ret;
 -      }
  
 -      return count;
 +      return pci_read_vpd(dev, off, count, buf);
  }
  
  static ssize_t
 -pci_write_vpd(struct kobject *kobj, struct bin_attribute *bin_attr,
 -            char *buf, loff_t off, size_t count)
 +write_vpd_attr(struct kobject *kobj, struct bin_attribute *bin_attr,
 +             char *buf, loff_t off, size_t count)
  {
        struct pci_dev *dev =
                to_pci_dev(container_of(kobj, struct device, kobj));
 -      int end;
 -      int ret;
  
        if (off > bin_attr->size)
                count = 0;
        else if (count > bin_attr->size - off)
                count = bin_attr->size - off;
 -      end = off + count;
 -
 -      while (off < end) {
 -              ret = dev->vpd->ops->write(dev, off, end - off, buf);
 -              if (ret < 0)
 -                      return ret;
 -              buf += ret;
 -              off += ret;
 -      }
  
 -      return count;
 +      return pci_write_vpd(dev, off, count, buf);
  }
  
  #ifdef HAVE_PCI_LEGACY
@@@ -557,7 -569,7 +557,7 @@@ void pci_remove_legacy_files(struct pci
  
  #ifdef HAVE_PCI_MMAP
  
 -static int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma)
 +int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma)
  {
        unsigned long nr, start, size;
  
@@@ -608,9 -620,6 +608,9 @@@ pci_mmap_resource(struct kobject *kobj
        vma->vm_pgoff += start >> PAGE_SHIFT;
        mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io;
  
 +      if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(start))
 +              return -EINVAL;
 +
        return pci_mmap_page_range(pdev, vma, mmap_type, write_combine);
  }
  
@@@ -823,8 -832,8 +823,8 @@@ static int pci_create_capabilities_sysf
                attr->size = dev->vpd->len;
                attr->attr.name = "vpd";
                attr->attr.mode = S_IRUSR | S_IWUSR;
 -              attr->read = pci_read_vpd;
 -              attr->write = pci_write_vpd;
 +              attr->read = read_vpd_attr;
 +              attr->write = write_vpd_attr;
                retval = sysfs_create_bin_file(&dev->dev.kobj, attr);
                if (retval) {
                        kfree(dev->vpd->attr);
diff --combined drivers/pci/probe.c
index 303644614eea47010a924e221f775b3e7f030446,5a021b82bc049751c6a3f4eea827514d07a0312a..55ec44a27e89e65e8d01c750ebca0f76bcf4e152
@@@ -51,12 -51,12 +51,12 @@@ static ssize_t pci_bus_show_cpuaffinity
                                        char *buf)
  {
        int ret;
-       cpumask_t cpumask;
+       const struct cpumask *cpumask;
  
-       cpumask = pcibus_to_cpumask(to_pci_bus(dev));
+       cpumask = cpumask_of_pcibus(to_pci_bus(dev));
        ret = type?
-               cpulist_scnprintf(buf, PAGE_SIZE-2, &cpumask) :
-               cpumask_scnprintf(buf, PAGE_SIZE-2, &cpumask);
+               cpulist_scnprintf(buf, PAGE_SIZE-2, cpumask) :
+               cpumask_scnprintf(buf, PAGE_SIZE-2, cpumask);
        buf[ret++] = '\n';
        buf[ret] = '\0';
        return ret;
@@@ -135,6 -135,13 +135,6 @@@ static u64 pci_size(u64 base, u64 maxba
        return size;
  }
  
 -enum pci_bar_type {
 -      pci_bar_unknown,        /* Standard PCI BAR probe */
 -      pci_bar_io,             /* An io port BAR */
 -      pci_bar_mem32,          /* A 32-bit memory BAR */
 -      pci_bar_mem64,          /* A 64-bit memory BAR */
 -};
 -
  static inline enum pci_bar_type decode_bar(struct resource *res, u32 bar)
  {
        if ((bar & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) {
        return pci_bar_mem32;
  }
  
 -/*
 - * If the type is not unknown, we assume that the lowest bit is 'enable'.
 - * Returns 1 if the BAR was 64-bit and 0 if it was 32-bit.
 +/**
 + * pci_read_base - read a PCI BAR
 + * @dev: the PCI device
 + * @type: type of the BAR
 + * @res: resource buffer to be filled in
 + * @pos: BAR position in the config space
 + *
 + * Returns 1 if the BAR is 64-bit, or 0 if 32-bit.
   */
 -static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
 +int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
                        struct resource *res, unsigned int pos)
  {
        u32 l, sz, mask;
@@@ -398,17 -400,19 +398,17 @@@ static struct pci_bus *pci_alloc_child_
        if (!child)
                return NULL;
  
 -      child->self = bridge;
        child->parent = parent;
        child->ops = parent->ops;
        child->sysdata = parent->sysdata;
        child->bus_flags = parent->bus_flags;
 -      child->bridge = get_device(&bridge->dev);
  
        /* initialize some portions of the bus device, but don't register it
         * now as the parent is not properly set up yet.  This device will get
         * registered later in pci_bus_add_devices()
         */
        child->dev.class = &pcibus_class;
 -      sprintf(child->dev.bus_id, "%04x:%02x", pci_domain_nr(child), busnr);
 +      dev_set_name(&child->dev, "%04x:%02x", pci_domain_nr(child), busnr);
  
        /*
         * Set up the primary, secondary and subordinate
        child->primary = parent->secondary;
        child->subordinate = 0xff;
  
 +      if (!bridge)
 +              return child;
 +
 +      child->self = bridge;
 +      child->bridge = get_device(&bridge->dev);
 +
        /* Set up default resource pointers and names.. */
 -      for (i = 0; i < 4; i++) {
 +      for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) {
                child->resource[i] = &bridge->resource[PCI_BRIDGE_RESOURCES+i];
                child->resource[i]->name = child->name;
        }
@@@ -960,12 -958,8 +960,12 @@@ static void pci_init_capabilities(struc
        /* MSI/MSI-X list */
        pci_msi_init_pci_dev(dev);
  
 +      /* Buffers for saving PCIe and PCI-X capabilities */
 +      pci_allocate_cap_save_buffers(dev);
 +
        /* Power Management */
        pci_pm_init(dev);
 +      platform_pci_wakeup_init(dev);
  
        /* Vital Product Data */
        pci_vpd_pci22_init(dev);
@@@ -1136,7 -1130,7 +1136,7 @@@ struct pci_bus * pci_create_bus(struct 
        memset(dev, 0, sizeof(*dev));
        dev->parent = parent;
        dev->release = pci_release_bus_bridge_dev;
 -      sprintf(dev->bus_id, "pci%04x:%02x", pci_domain_nr(b), bus);
 +      dev_set_name(dev, "pci%04x:%02x", pci_domain_nr(b), bus);
        error = device_register(dev);
        if (error)
                goto dev_reg_err;
  
        b->dev.class = &pcibus_class;
        b->dev.parent = b->bridge;
 -      sprintf(b->dev.bus_id, "%04x:%02x", pci_domain_nr(b), bus);
 +      dev_set_name(&b->dev, "%04x:%02x", pci_domain_nr(b), bus);
        error = device_register(&b->dev);
        if (error)
                goto class_dev_reg_err;