ia64/linux-2.6.18-xen.hg

changeset 533:d62d60eaba6e

Handle dom0_max_vcpus < nr_pcpu cases, e.g. UP dom0.

Just try to pass info about all acpi processors to xen even in such cases.

Signed-off-by: Tian Kevin <kevin.tian@intel.com>
Signed-off-by: Wei Gang <gang.wei@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 01 10:53:37 2008 +0100 (2008-05-01)
parents e97855b90cc2
children a947207da4e4
files arch/i386/kernel/acpi/processor.c drivers/acpi/processor_core.c include/acpi/processor.h
line diff
     1.1 --- a/arch/i386/kernel/acpi/processor.c	Thu May 01 10:53:07 2008 +0100
     1.2 +++ b/arch/i386/kernel/acpi/processor.c	Thu May 01 10:53:37 2008 +0100
     1.3 @@ -59,10 +59,16 @@ static void init_intel_pdc(struct acpi_p
     1.4  	return;
     1.5  }
     1.6  
     1.7 -/* Initialize _PDC data based on the CPU vendor */
     1.8 +/* 
     1.9 + * Initialize _PDC data based on the CPU vendor. As a work-around, just
    1.10 + * use cpu0's cpuinfo for all processors. Further work is required 
    1.11 + * to expose xen hypervisor interface of getting physical cpuinfo to dom0
    1.12 + * kerneland then arch_acpi_processor_init_pdc can set _PDC parameters 
    1.13 + * according to Xen's phys information.
    1.14 + */
    1.15  void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
    1.16  {
    1.17 -	unsigned int cpu = pr->id;
    1.18 +	unsigned int cpu = 0;
    1.19  	struct cpuinfo_x86 *c = cpu_data + cpu;
    1.20  
    1.21  	pr->pdc = NULL;
     2.1 --- a/drivers/acpi/processor_core.c	Thu May 01 10:53:07 2008 +0100
     2.2 +++ b/drivers/acpi/processor_core.c	Thu May 01 10:53:37 2008 +0100
     2.3 @@ -475,7 +475,8 @@ static int acpi_processor_get_info(struc
     2.4  	 */
     2.5  	if (cpu_index == -1) {
     2.6  		if (ACPI_FAILURE
     2.7 -		    (acpi_processor_hotadd_init(pr->handle, &pr->id))) {
     2.8 +		    (acpi_processor_hotadd_init(pr->handle, &pr->id)) &&
     2.9 +		    !processor_cntl_external()) {
    2.10  			printk(KERN_ERR PREFIX
    2.11  				    "Getting cpuindex for acpiid 0x%x\n",
    2.12  				    pr->acpi_id);
    2.13 @@ -517,7 +518,7 @@ static int acpi_processor_get_info(struc
    2.14  	return 0;
    2.15  }
    2.16  
    2.17 -static void *processor_device_array[NR_CPUS];
    2.18 +static void *processor_device_array[NR_ACPI_CPUS];
    2.19  
    2.20  static int acpi_processor_start(struct acpi_device *device)
    2.21  {
    2.22 @@ -529,27 +530,29 @@ static int acpi_processor_start(struct a
    2.23  	pr = acpi_driver_data(device);
    2.24  
    2.25  	result = acpi_processor_get_info(pr);
    2.26 -	if (result) {
    2.27 +	if (result || 
    2.28 +	    ((pr->id == -1) && !processor_cntl_external())) {
    2.29  		/* Processor is physically not present */
    2.30  		return 0;
    2.31  	}
    2.32  
    2.33 -	BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0));
    2.34 +	BUG_ON(!processor_cntl_external() &&
    2.35 +	       ((pr->id >= NR_CPUS) || (pr->id < 0)));
    2.36  
    2.37  	/*
    2.38  	 * Buggy BIOS check
    2.39  	 * ACPI id of processors can be reported wrongly by the BIOS.
    2.40  	 * Don't trust it blindly
    2.41  	 */
    2.42 -	if (processor_device_array[pr->id] != NULL &&
    2.43 -	    processor_device_array[pr->id] != (void *)device) {
    2.44 +	if (processor_device_array[pr->acpi_id] != NULL &&
    2.45 +	    processor_device_array[pr->acpi_id] != (void *)device) {
    2.46  		printk(KERN_WARNING "BIOS reported wrong ACPI id"
    2.47  			"for the processor\n");
    2.48  		return -ENODEV;
    2.49  	}
    2.50 -	processor_device_array[pr->id] = (void *)device;
    2.51 -
    2.52 -	processors[pr->id] = pr;
    2.53 +	processor_device_array[pr->acpi_id] = (void *)device;
    2.54 +	if (pr->id != -1)
    2.55 +		processors[pr->id] = pr;
    2.56  
    2.57  	result = acpi_processor_add_fs(device);
    2.58  	if (result)
    2.59 @@ -660,7 +663,8 @@ static int acpi_processor_remove(struct 
    2.60  
    2.61  	acpi_processor_remove_fs(device);
    2.62  
    2.63 -	processors[pr->id] = NULL;
    2.64 +	if (pr->id != -1)
    2.65 +		processors[pr->id] = NULL;
    2.66  
    2.67  	kfree(pr);
    2.68  
    2.69 @@ -789,7 +793,8 @@ acpi_processor_hotplug_notify(acpi_handl
    2.70  			return;
    2.71  		}
    2.72  
    2.73 -		if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
    2.74 +		if ((pr->id >= 0) && (pr->id < NR_CPUS)
    2.75 +		    && (cpu_present(pr->id)))
    2.76  			kobject_uevent(&device->kobj, KOBJ_OFFLINE);
    2.77  
    2.78  		if (processor_cntl_external())
    2.79 @@ -860,6 +865,9 @@ static acpi_status acpi_processor_hotadd
    2.80  
    2.81  static int acpi_processor_handle_eject(struct acpi_processor *pr)
    2.82  {
    2.83 +	if (pr->id == -1)
    2.84 +		return (0);
    2.85 +
    2.86  	if (cpu_online(pr->id)) {
    2.87  		return (-EINVAL);
    2.88  	}
     3.1 --- a/include/acpi/processor.h	Thu May 01 10:53:07 2008 +0100
     3.2 +++ b/include/acpi/processor.h	Thu May 01 10:53:37 2008 +0100
     3.3 @@ -21,6 +21,8 @@
     3.4  #define ACPI_PSD_REV0_REVISION		0 /* Support for _PSD as in ACPI 3.0 */
     3.5  #define ACPI_PSD_REV0_ENTRIES		5
     3.6  
     3.7 +#define NR_ACPI_CPUS			256
     3.8 +
     3.9  /*
    3.10   * Types of coordination defined in ACPI 3.0. Same macros can be used across
    3.11   * P, C and T states