ia64/linux-2.6.18-xen.hg

changeset 550:2d858799d109

merge with linux-2.6.18-xen.hg
author Isaku Yamahata <yamahata@valinux.co.jp>
date Thu May 15 16:26:16 2008 +0900 (2008-05-15)
parents e5933404dada d59a4aaf8615
children 6b0a85eb5155
files
line diff
     1.1 --- a/arch/i386/kernel/acpi/processor_extcntl_xen.c	Tue May 13 10:42:09 2008 +0900
     1.2 +++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c	Thu May 15 16:26:16 2008 +0900
     1.3 @@ -28,6 +28,7 @@
     1.4  #include <linux/pm.h>
     1.5  #include <linux/cpu.h>
     1.6  
     1.7 +#include <linux/cpufreq.h>
     1.8  #include <acpi/processor.h>
     1.9  #include <asm/hypercall.h>
    1.10  
    1.11 @@ -110,9 +111,101 @@ static int xen_cx_notifier(struct acpi_p
    1.12  	return ret;
    1.13  }
    1.14  
    1.15 +static void convert_pct_reg(struct xen_pct_register *xpct,
    1.16 +	struct acpi_pct_register *apct)
    1.17 +{
    1.18 +	xpct->descriptor = apct->descriptor;
    1.19 +	xpct->length     = apct->length;
    1.20 +	xpct->space_id   = apct->space_id;
    1.21 +	xpct->bit_width  = apct->bit_width;
    1.22 +	xpct->bit_offset = apct->bit_offset;
    1.23 +	xpct->reserved   = apct->reserved;
    1.24 +	xpct->address    = apct->address;
    1.25 +}
    1.26 +
    1.27 +static void convert_pss_states(struct xen_processor_px *xpss, 
    1.28 +	struct acpi_processor_px *apss, int state_count)
    1.29 +{
    1.30 +	int i;
    1.31 +	for(i=0; i<state_count; i++) {
    1.32 +		xpss->core_frequency     = apss->core_frequency;
    1.33 +		xpss->power              = apss->power;
    1.34 +		xpss->transition_latency = apss->transition_latency;
    1.35 +		xpss->bus_master_latency = apss->bus_master_latency;
    1.36 +		xpss->control            = apss->control;
    1.37 +		xpss->status             = apss->status;
    1.38 +		xpss++;
    1.39 +		apss++;
    1.40 +	}
    1.41 +}
    1.42 +
    1.43 +static void convert_psd_pack(struct xen_psd_package *xpsd,
    1.44 +	struct acpi_psd_package *apsd)
    1.45 +{
    1.46 +	xpsd->num_entries    = apsd->num_entries;
    1.47 +	xpsd->revision       = apsd->revision;
    1.48 +	xpsd->domain         = apsd->domain;
    1.49 +	xpsd->coord_type     = apsd->coord_type;
    1.50 +	xpsd->num_processors = apsd->num_processors;
    1.51 +}
    1.52 +
    1.53  static int xen_px_notifier(struct acpi_processor *pr, int action)
    1.54  {
    1.55 -	return -EINVAL;
    1.56 +	int ret;
    1.57 +	xen_platform_op_t op = {
    1.58 +		.cmd			= XENPF_set_processor_pminfo,
    1.59 +		.interface_version	= XENPF_INTERFACE_VERSION,
    1.60 +		.u.set_pminfo.id	= pr->acpi_id,
    1.61 +		.u.set_pminfo.type	= XEN_PM_PX,
    1.62 +	};
    1.63 +	struct xen_processor_performance *perf;
    1.64 +	struct xen_processor_px *states = NULL;
    1.65 +	struct acpi_processor_performance *px;
    1.66 +	struct acpi_psd_package *pdomain;
    1.67 +
    1.68 +	/* leave dynamic ppc handle in the future */
    1.69 +	if (action == PROCESSOR_PM_CHANGE)
    1.70 +		return 0;
    1.71 +
    1.72 +	perf = &op.u.set_pminfo.perf;
    1.73 +	px = pr->performance;
    1.74 +
    1.75 +	perf->flags = XEN_PX_PPC | 
    1.76 +		      XEN_PX_PCT | 
    1.77 +		      XEN_PX_PSS | 
    1.78 +		      XEN_PX_PSD;
    1.79 +
    1.80 +	/* ppc */
    1.81 +	perf->ppc = pr->performance_platform_limit;
    1.82 +
    1.83 +	/* pct */
    1.84 +	convert_pct_reg(&perf->control_register, &px->control_register);
    1.85 +	convert_pct_reg(&perf->status_register, &px->status_register);
    1.86 +
    1.87 +	/* pss */
    1.88 +	perf->state_count = px->state_count;
    1.89 +	states = kzalloc(px->state_count*sizeof(xen_processor_px_t),GFP_KERNEL);
    1.90 +	if (!states)
    1.91 +		return -ENOMEM;
    1.92 +	convert_pss_states(states, px->states, px->state_count);
    1.93 +	set_xen_guest_handle(perf->states, states);
    1.94 +
    1.95 +	/* psd */
    1.96 +	pdomain = &px->domain_info;
    1.97 +	convert_psd_pack(&perf->domain_info, pdomain);
    1.98 +	if (perf->domain_info.num_processors) {
    1.99 +		if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL)
   1.100 +			perf->shared_type = CPUFREQ_SHARED_TYPE_ALL;
   1.101 +		else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY)
   1.102 +			perf->shared_type = CPUFREQ_SHARED_TYPE_ANY;
   1.103 +		else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL)
   1.104 +			perf->shared_type = CPUFREQ_SHARED_TYPE_HW;
   1.105 +	} else
   1.106 +		perf->shared_type = CPUFREQ_SHARED_TYPE_NONE;
   1.107 +
   1.108 +	ret = HYPERVISOR_platform_op(&op);
   1.109 +	kfree(states);
   1.110 +	return ret;
   1.111  }
   1.112  
   1.113  static int xen_tx_notifier(struct acpi_processor *pr, int action)
     2.1 --- a/drivers/acpi/dispatcher/dsobject.c	Tue May 13 10:42:09 2008 +0900
     2.2 +++ b/drivers/acpi/dispatcher/dsobject.c	Thu May 15 16:26:16 2008 +0900
     2.3 @@ -137,6 +137,71 @@ acpi_ds_build_internal_object(struct acp
     2.4  				return_ACPI_STATUS(status);
     2.5  			}
     2.6  		}
     2.7 +
     2.8 +		/* Special object resolution for elements of a package */
     2.9 +
    2.10 +		if ((op->common.parent->common.aml_opcode == AML_PACKAGE_OP) ||
    2.11 +		    (op->common.parent->common.aml_opcode ==
    2.12 +		     AML_VAR_PACKAGE_OP)) {
    2.13 +			/*
    2.14 +			 * Attempt to resolve the node to a value before we insert it into
    2.15 +			 * the package. If this is a reference to a common data type,
    2.16 +			 * resolve it immediately. According to the ACPI spec, package
    2.17 +			 * elements can only be "data objects" or method references.
    2.18 +			 * Attempt to resolve to an Integer, Buffer, String or Package.
    2.19 +			 * If cannot, return the named reference (for things like Devices,
    2.20 +			 * Methods, etc.) Buffer Fields and Fields will resolve to simple
    2.21 +			 * objects (int/buf/str/pkg).
    2.22 +			 *
    2.23 +			 * NOTE: References to things like Devices, Methods, Mutexes, etc.
    2.24 +			 * will remain as named references. This behavior is not described
    2.25 +			 * in the ACPI spec, but it appears to be an oversight.
    2.26 +			 */
    2.27 +			obj_desc = (union acpi_operand_object *)op->common.node;
    2.28 +
    2.29 +			status =
    2.30 +			    acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
    2.31 +							  (struct
    2.32 +							   acpi_namespace_node,
    2.33 +							   &obj_desc),
    2.34 +							  walk_state);
    2.35 +			if (ACPI_FAILURE(status)) {
    2.36 +				return_ACPI_STATUS(status);
    2.37 +			}
    2.38 +
    2.39 +			switch (op->common.node->type) {
    2.40 +				/*
    2.41 +				 * For these types, we need the actual node, not the subobject.
    2.42 +				 * However, the subobject got an extra reference count above.
    2.43 +				 */
    2.44 +			case ACPI_TYPE_MUTEX:
    2.45 +			case ACPI_TYPE_METHOD:
    2.46 +			case ACPI_TYPE_POWER:
    2.47 +			case ACPI_TYPE_PROCESSOR:
    2.48 +			case ACPI_TYPE_EVENT:
    2.49 +			case ACPI_TYPE_REGION:
    2.50 +			case ACPI_TYPE_DEVICE:
    2.51 +			case ACPI_TYPE_THERMAL:
    2.52 +
    2.53 +				obj_desc =
    2.54 +				    (union acpi_operand_object *)op->common.
    2.55 +				    node;
    2.56 +				break;
    2.57 +
    2.58 +			default:
    2.59 +				break;
    2.60 +			}
    2.61 +
    2.62 +			/*
    2.63 +			 * If above resolved to an operand object, we are done. Otherwise,
    2.64 +			 * we have a NS node, we must create the package entry as a named
    2.65 +			 * reference.
    2.66 +			 */
    2.67 +			if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) !=
    2.68 +			    ACPI_DESC_TYPE_NAMED) {
    2.69 +				goto exit;
    2.70 +			}
    2.71 +		}
    2.72  	}
    2.73  
    2.74  	/* Create and init a new internal ACPI object */
    2.75 @@ -156,6 +221,7 @@ acpi_ds_build_internal_object(struct acp
    2.76  		return_ACPI_STATUS(status);
    2.77  	}
    2.78  
    2.79 +      exit:
    2.80  	*obj_desc_ptr = obj_desc;
    2.81  	return_ACPI_STATUS(AE_OK);
    2.82  }
    2.83 @@ -358,12 +424,25 @@ acpi_ds_build_internal_package_obj(struc
    2.84  	arg = arg->common.next;
    2.85  	for (i = 0; arg; i++) {
    2.86  		if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
    2.87 -
    2.88 -			/* Object (package or buffer) is already built */
    2.89 +			if (arg->common.node->type == ACPI_TYPE_METHOD) {
    2.90 +				/*
    2.91 +				 * A method reference "looks" to the parser to be a method
    2.92 +				 * invocation, so we special case it here
    2.93 +				 */
    2.94 +				arg->common.aml_opcode = AML_INT_NAMEPATH_OP;
    2.95 +				status =
    2.96 +				    acpi_ds_build_internal_object(walk_state,
    2.97 +								  arg,
    2.98 +								  &obj_desc->
    2.99 +								  package.
   2.100 +								  elements[i]);
   2.101 +			} else {
   2.102 +				/* This package element is already built, just get it */
   2.103  
   2.104 -			obj_desc->package.elements[i] =
   2.105 -			    ACPI_CAST_PTR(union acpi_operand_object,
   2.106 -					  arg->common.node);
   2.107 +				obj_desc->package.elements[i] =
   2.108 +				    ACPI_CAST_PTR(union acpi_operand_object,
   2.109 +						  arg->common.node);
   2.110 +			}
   2.111  		} else {
   2.112  			status = acpi_ds_build_internal_object(walk_state, arg,
   2.113  							       &obj_desc->
     3.1 --- a/drivers/acpi/processor_extcntl.c	Tue May 13 10:42:09 2008 +0900
     3.2 +++ b/drivers/acpi/processor_extcntl.c	Thu May 15 16:26:16 2008 +0900
     3.3 @@ -31,12 +31,50 @@
     3.4  #include <acpi/processor.h>
     3.5  
     3.6  static int processor_extcntl_parse_csd(struct acpi_processor *pr);
     3.7 +static int processor_extcntl_get_performance(struct acpi_processor *pr);
     3.8  /*
     3.9   * External processor control logic may register with its own set of
    3.10   * ops to get ACPI related notification. One example is like VMM.
    3.11   */
    3.12  struct processor_extcntl_ops *processor_extcntl_ops;
    3.13  
    3.14 +static int processor_notify_smm(void)
    3.15 +{
    3.16 +	acpi_status status;
    3.17 +	static int is_done = 0;
    3.18 +
    3.19 +	/* only need successfully notify BIOS once */
    3.20 +	/* avoid double notification which may lead to unexpected result */
    3.21 +	if (is_done)
    3.22 +		return 0;
    3.23 +
    3.24 +	/* Can't write pstate_cnt to smi_cmd if either value is zero */
    3.25 +	if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) {
    3.26 +		ACPI_DEBUG_PRINT((ACPI_DB_INFO,"No SMI port or pstate_cnt\n"));
    3.27 +		return 0;
    3.28 +	}
    3.29 +
    3.30 +	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
    3.31 +		"Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n",
    3.32 +		acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd));
    3.33 +
    3.34 +	/* FADT v1 doesn't support pstate_cnt, many BIOS vendors use
    3.35 +	 * it anyway, so we need to support it... */
    3.36 +	if (acpi_fadt_is_v1) {
    3.37 +		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
    3.38 +			"Using v1.0 FADT reserved value for pstate_cnt\n"));
    3.39 +	}
    3.40 +
    3.41 +	status = acpi_os_write_port(acpi_fadt.smi_cmd,
    3.42 +				    (u32) acpi_fadt.pstate_cnt, 8);
    3.43 +	if (ACPI_FAILURE(status)) 
    3.44 +		return status;
    3.45 +
    3.46 +	is_done = 1;
    3.47 +
    3.48 +	return 0;
    3.49 +}
    3.50 +
    3.51  int processor_notify_external(struct acpi_processor *pr, int event, int type)
    3.52  {
    3.53  	int ret = -EINVAL;
    3.54 @@ -109,7 +147,12 @@ int processor_unregister_extcntl(struct 
    3.55  int processor_extcntl_init(struct acpi_processor *pr)
    3.56  {
    3.57  	/* parse cstate dependency information */
    3.58 -	processor_extcntl_parse_csd(pr);
    3.59 +	if (processor_pm_external())
    3.60 +		processor_extcntl_parse_csd(pr);
    3.61 +
    3.62 +	/* Initialize performance states */
    3.63 +	if (processor_pmperf_external())
    3.64 +		processor_extcntl_get_performance(pr);
    3.65  
    3.66  	return 0;
    3.67  }
    3.68 @@ -135,3 +178,71 @@ static int processor_extcntl_parse_csd(s
    3.69  
    3.70  	return 0;
    3.71  }
    3.72 +
    3.73 +/*
    3.74 + * Existing ACPI module does parse performance states at some point,
    3.75 + * when acpi-cpufreq driver is loaded which however is something
    3.76 + * we'd like to disable to avoid confliction with external control
    3.77 + * logic. So we have to collect raw performance information here 
    3.78 + * when ACPI processor object is found and started.
    3.79 + */
    3.80 +#ifdef CONFIG_CPU_FREQ
    3.81 +static int processor_extcntl_get_performance(struct acpi_processor *pr)
    3.82 +{
    3.83 +	int ret;
    3.84 +	struct acpi_processor_performance *perf;
    3.85 +	struct acpi_psd_package *pdomain;
    3.86 +
    3.87 +	if (pr->performance)
    3.88 +		return -EBUSY;
    3.89 +
    3.90 +	perf = kzalloc(sizeof(struct acpi_processor_performance), GFP_KERNEL);
    3.91 +	if (!perf)
    3.92 +		return -ENOMEM;
    3.93 +
    3.94 +	pr->performance = perf;
    3.95 +	/* Get basic performance state information */
    3.96 +	ret = acpi_processor_get_performance_info(pr);
    3.97 +	if (ret < 0)
    3.98 +		goto err_out;
    3.99 +
   3.100 +	/*
   3.101 +	 * Well, here we need retrieve performance dependency information
   3.102 +	 * from _PSD object. The reason why existing interface is not used
   3.103 +	 * is due to the reason that existing interface sticks to Linux cpu
   3.104 +	 * id to construct some bitmap, however we want to split ACPI 
   3.105 +	 * processor objects from Linux cpu id logic. For example, even
   3.106 +	 * when Linux is configured as UP, we still want to parse all ACPI
   3.107 +	 * processor objects to external logic. In this case, it's preferred
   3.108 +	 * to use ACPI ID instead.
   3.109 +	 */
   3.110 +	pr->performance->domain_info.num_processors = 0;
   3.111 +	ret = acpi_processor_get_psd(pr);
   3.112 +	if (ret < 0)
   3.113 +		goto err_out;
   3.114 +
   3.115 +	/* Some sanity check */
   3.116 +	pdomain = &pr->performance->domain_info;
   3.117 +	if ((pdomain->revision != ACPI_PSD_REV0_REVISION) ||
   3.118 +	    (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) ||
   3.119 +	    ((pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL) &&
   3.120 +	     (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY) &&
   3.121 +	     (pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL))) {
   3.122 +		ret = -EINVAL;
   3.123 +		goto err_out;
   3.124 +	}
   3.125 +
   3.126 +	/* Last step is to notify BIOS that external logic exists */
   3.127 +	processor_notify_smm();
   3.128 +
   3.129 +	processor_notify_external(pr, PROCESSOR_PM_INIT, PM_TYPE_PERF);
   3.130 +
   3.131 +	return 0;
   3.132 +err_out:
   3.133 +	pr->performance = NULL;
   3.134 +	kfree(perf);
   3.135 +	return ret;
   3.136 +}
   3.137 +#else
   3.138 +static int processor_extcntl_get_performance(struct acpi_processor *pr) { return 0; }
   3.139 +#endif
     4.1 --- a/drivers/acpi/processor_perflib.c	Tue May 13 10:42:09 2008 +0900
     4.2 +++ b/drivers/acpi/processor_perflib.c	Thu May 15 16:26:16 2008 +0900
     4.3 @@ -304,7 +304,11 @@ static int acpi_processor_get_performanc
     4.4  	return result;
     4.5  }
     4.6  
     4.7 +#ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL
     4.8  static int acpi_processor_get_performance_info(struct acpi_processor *pr)
     4.9 +#else
    4.10 +int acpi_processor_get_performance_info(struct acpi_processor *pr)
    4.11 +#endif
    4.12  {
    4.13  	int result = 0;
    4.14  	acpi_status status = AE_OK;
    4.15 @@ -543,7 +547,11 @@ static void acpi_cpufreq_remove_file(str
    4.16  }
    4.17  #endif				/* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */
    4.18  
    4.19 +#ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL
    4.20  static int acpi_processor_get_psd(struct acpi_processor	*pr)
    4.21 +#else
    4.22 +int acpi_processor_get_psd(struct acpi_processor *pr)
    4.23 +#endif
    4.24  {
    4.25  	int result = 0;
    4.26  	acpi_status status = AE_OK;
     5.1 --- a/drivers/pci/msi-xen.c	Tue May 13 10:42:09 2008 +0900
     5.2 +++ b/drivers/pci/msi-xen.c	Thu May 15 16:26:16 2008 +0900
     5.3 @@ -32,7 +32,7 @@ int msi_register(struct msi_ops *ops)
     5.4  	return 0;
     5.5  }
     5.6  
     5.7 -static struct list_head msi_dev_head;
     5.8 +static LIST_HEAD(msi_dev_head);
     5.9  static int msi_dev_head_inited = 0;
    5.10  DEFINE_SPINLOCK(msi_dev_lock);
    5.11  
    5.12 @@ -54,11 +54,6 @@ static struct msi_dev_list *get_msi_dev_
    5.13  	struct msi_dev_list *msi_dev_list, *ret = NULL;
    5.14  	unsigned long flags;
    5.15  
    5.16 -	if (!msi_dev_head_inited) {
    5.17 -		INIT_LIST_HEAD(&msi_dev_head);
    5.18 -		msi_dev_head_inited = 1;
    5.19 -	}
    5.20 -
    5.21  	spin_lock_irqsave(&msi_dev_lock, flags);
    5.22  
    5.23  	list_for_each_entry(msi_dev_list, &msi_dev_head, list)
    5.24 @@ -79,10 +74,10 @@ static struct msi_dev_list *get_msi_dev_
    5.25  		return NULL;
    5.26  	}
    5.27  
    5.28 +	spin_lock_init(&ret->pirq_list_lock);
    5.29 +	INIT_LIST_HEAD(&ret->pirq_list_head);
    5.30  	list_add_tail(&ret->list, &msi_dev_head);
    5.31  	spin_unlock_irqrestore(&msi_dev_lock, flags);
    5.32 -	spin_lock_init(&ret->pirq_list_lock);
    5.33 -	INIT_LIST_HEAD(&ret->pirq_list_head);
    5.34  	return ret;
    5.35  }
    5.36  
    5.37 @@ -304,10 +299,9 @@ int pci_save_msix_state(struct pci_dev *
    5.38  	msi_dev_entry = get_msi_dev_pirq_list(dev);
    5.39  
    5.40  	spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags);
    5.41 -	if (!list_empty_careful(&msi_dev_entry->pirq_list_head))
    5.42 -		list_for_each_entry_safe(pirq_entry, tmp,
    5.43 -		                         &msi_dev_entry->pirq_list_head, list)
    5.44 -			msi_unmap_pirq(dev, pirq_entry->pirq);
    5.45 +        list_for_each_entry_safe(pirq_entry, tmp,
    5.46 +                                 &msi_dev_entry->pirq_list_head, list)
    5.47 +		msi_unmap_pirq(dev, pirq_entry->pirq);
    5.48  	spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags);
    5.49  
    5.50  	disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX);
    5.51 @@ -394,7 +388,7 @@ static int msix_capability_init(struct p
    5.52  		return -ENOMEM;
    5.53  
    5.54  	spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags);
    5.55 -	if (!list_empty_careful(&msi_dev_entry->pirq_list_head))
    5.56 +	if (!list_empty(&msi_dev_entry->pirq_list_head))
    5.57  	{
    5.58  		printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \
    5.59  		       before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn),
    5.60 @@ -677,7 +671,7 @@ void msi_remove_pci_irq_vectors(struct p
    5.61  	msi_dev_entry = get_msi_dev_pirq_list(dev);
    5.62  
    5.63  	spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags);
    5.64 -	if (!list_empty_careful(&msi_dev_entry->pirq_list_head))
    5.65 +	if (!list_empty(&msi_dev_entry->pirq_list_head))
    5.66  	{
    5.67  		printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \
    5.68  		       before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn),
     6.1 --- a/drivers/xen/blkback/blkback.c	Tue May 13 10:42:09 2008 +0900
     6.2 +++ b/drivers/xen/blkback/blkback.c	Thu May 15 16:26:16 2008 +0900
     6.3 @@ -344,6 +344,9 @@ static int do_block_io_op(blkif_t *blkif
     6.4  		}
     6.5  		blk_rings->common.req_cons = ++rc; /* before make_response() */
     6.6  
     6.7 +		/* Apply all sanity checks to /private copy/ of request. */
     6.8 +		barrier();
     6.9 +
    6.10  		switch (req.operation) {
    6.11  		case BLKIF_OP_READ:
    6.12  			blkif->st_rd_req++;
     7.1 --- a/drivers/xen/blktap/blktap.c	Tue May 13 10:42:09 2008 +0900
     7.2 +++ b/drivers/xen/blktap/blktap.c	Thu May 15 16:26:16 2008 +0900
     7.3 @@ -1264,6 +1264,9 @@ static int do_block_io_op(blkif_t *blkif
     7.4  		}
     7.5  		blk_rings->common.req_cons = ++rc; /* before make_response() */
     7.6  
     7.7 +		/* Apply all sanity checks to /private copy/ of request. */
     7.8 +		barrier();
     7.9 +
    7.10  		switch (req.operation) {
    7.11  		case BLKIF_OP_READ:
    7.12  			blkif->st_rd_req++;
     8.1 --- a/drivers/xen/pciback/conf_space_capability_msi.c	Tue May 13 10:42:09 2008 +0900
     8.2 +++ b/drivers/xen/pciback/conf_space_capability_msi.c	Thu May 15 16:26:16 2008 +0900
     8.3 @@ -11,7 +11,6 @@ int pciback_enable_msi(struct pciback_de
     8.4  		struct pci_dev *dev, struct xen_pci_op *op)
     8.5  {
     8.6  	int otherend = pdev->xdev->otherend_id;
     8.7 -	int irq;
     8.8  	int status;
     8.9  
    8.10  	status = pci_enable_msi(dev);
    8.11 @@ -29,8 +28,6 @@ int pciback_enable_msi(struct pciback_de
    8.12  int pciback_disable_msi(struct pciback_device *pdev,
    8.13  		struct pci_dev *dev, struct xen_pci_op *op)
    8.14  {
    8.15 -	int old_irq = dev->irq;
    8.16 -
    8.17  	pci_disable_msi(dev);
    8.18  
    8.19  	op->value = dev->irq;
    8.20 @@ -40,7 +37,7 @@ int pciback_disable_msi(struct pciback_d
    8.21  int pciback_enable_msix(struct pciback_device *pdev,
    8.22  		struct pci_dev *dev, struct xen_pci_op *op)
    8.23  {
    8.24 -	int otherend = pdev->xdev->otherend_id, result, i;
    8.25 +	int result;
    8.26  
    8.27  	result = pci_enable_msix(dev, op->msix_entries, op->value);
    8.28  
     9.1 --- a/include/acpi/processor.h	Tue May 13 10:42:09 2008 +0900
     9.2 +++ b/include/acpi/processor.h	Thu May 15 16:26:16 2008 +0900
     9.3 @@ -353,6 +353,8 @@ extern int processor_notify_external(str
     9.4  extern int processor_register_extcntl(struct processor_extcntl_ops *ops);
     9.5  extern int processor_unregister_extcntl(struct processor_extcntl_ops *ops);
     9.6  extern int processor_extcntl_init(struct acpi_processor *pr);
     9.7 +extern int acpi_processor_get_performance_info(struct acpi_processor *pr);
     9.8 +extern int acpi_processor_get_psd(struct acpi_processor *pr);
     9.9  #else
    9.10  static inline int processor_cntl_external(void) {return 0;}
    9.11  static inline int processor_pm_external(void) {return 0;}
    10.1 --- a/include/xen/blkif.h	Tue May 13 10:42:09 2008 +0900
    10.2 +++ b/include/xen/blkif.h	Thu May 15 16:26:16 2008 +0900
    10.3 @@ -98,8 +98,9 @@ static void inline blkif_get_x86_32_req(
    10.4  	dst->handle = src->handle;
    10.5  	dst->id = src->id;
    10.6  	dst->sector_number = src->sector_number;
    10.7 -	if (n > src->nr_segments)
    10.8 -		n = src->nr_segments;
    10.9 +	barrier();
   10.10 +	if (n > dst->nr_segments)
   10.11 +		n = dst->nr_segments;
   10.12  	for (i = 0; i < n; i++)
   10.13  		dst->seg[i] = src->seg[i];
   10.14  }
   10.15 @@ -112,8 +113,9 @@ static void inline blkif_get_x86_64_req(
   10.16  	dst->handle = src->handle;
   10.17  	dst->id = src->id;
   10.18  	dst->sector_number = src->sector_number;
   10.19 -	if (n > src->nr_segments)
   10.20 -		n = src->nr_segments;
   10.21 +	barrier();
   10.22 +	if (n > dst->nr_segments)
   10.23 +		n = dst->nr_segments;
   10.24  	for (i = 0; i < n; i++)
   10.25  		dst->seg[i] = src->seg[i];
   10.26  }
    11.1 --- a/include/xen/interface/hvm/hvm_op.h	Tue May 13 10:42:09 2008 +0900
    11.2 +++ b/include/xen/interface/hvm/hvm_op.h	Thu May 15 16:26:16 2008 +0900
    11.3 @@ -73,6 +73,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_
    11.4  /* Flushes all VCPU TLBs: @arg must be NULL. */
    11.5  #define HVMOP_flush_tlbs          5
    11.6  
    11.7 +/* Following tools-only interfaces may change in future. */
    11.8 +#if defined(__XEN__) || defined(__XEN_TOOLS__)
    11.9 +
   11.10  /* Track dirty VRAM. */
   11.11  #define HVMOP_track_dirty_vram    6
   11.12  struct xen_hvm_track_dirty_vram {
   11.13 @@ -89,4 +92,6 @@ struct xen_hvm_track_dirty_vram {
   11.14  typedef struct xen_hvm_track_dirty_vram xen_hvm_track_dirty_vram_t;
   11.15  DEFINE_XEN_GUEST_HANDLE(xen_hvm_track_dirty_vram_t);
   11.16  
   11.17 +#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
   11.18 +
   11.19  #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */
    12.1 --- a/include/xen/interface/io/pciif.h	Tue May 13 10:42:09 2008 +0900
    12.2 +++ b/include/xen/interface/io/pciif.h	Thu May 15 16:26:16 2008 +0900
    12.3 @@ -34,6 +34,10 @@
    12.4  /* xen_pci_op commands */
    12.5  #define XEN_PCI_OP_conf_read    (0)
    12.6  #define XEN_PCI_OP_conf_write   (1)
    12.7 +#define XEN_PCI_OP_enable_msi   (2)
    12.8 +#define XEN_PCI_OP_disable_msi  (3)
    12.9 +#define XEN_PCI_OP_enable_msix  (4)
   12.10 +#define XEN_PCI_OP_disable_msix (5)
   12.11  
   12.12  /* xen_pci_op error numbers */
   12.13  #define XEN_PCI_ERR_success          (0)
   12.14 @@ -44,6 +48,12 @@
   12.15  /* XEN_PCI_ERR_op_failed - backend failed to complete the operation */
   12.16  #define XEN_PCI_ERR_op_failed       (-5)
   12.17  
   12.18 +/*
   12.19 + * it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry))
   12.20 + * Should not exceed 128
   12.21 + */
   12.22 +#define SH_INFO_MAX_VEC     128
   12.23 +
   12.24  struct xen_pci_op {
   12.25      /* IN: what action to perform: XEN_PCI_OP_* */
   12.26      uint32_t cmd;
   12.27 @@ -62,6 +72,10 @@ struct xen_pci_op {
   12.28  
   12.29      /* IN/OUT: Contains the result after a READ or the value to WRITE */
   12.30      uint32_t value;
   12.31 +    /* IN: Contains extra infor for this operation */
   12.32 +    uint32_t info;
   12.33 +    /*IN:  param for msi-x */
   12.34 +    struct msix_entry msix_entries[SH_INFO_MAX_VEC];
   12.35  };
   12.36  
   12.37  struct xen_pci_sharedinfo {
    13.1 --- a/include/xen/interface/platform.h	Tue May 13 10:42:09 2008 +0900
    13.2 +++ b/include/xen/interface/platform.h	Thu May 15 16:26:16 2008 +0900
    13.3 @@ -211,6 +211,12 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_getidletim
    13.4  #define XEN_PM_PX   1
    13.5  #define XEN_PM_TX   2
    13.6  
    13.7 +/* Px sub info type */
    13.8 +#define XEN_PX_PCT   1
    13.9 +#define XEN_PX_PSS   2
   13.10 +#define XEN_PX_PPC   4
   13.11 +#define XEN_PX_PSD   8
   13.12 +
   13.13  struct xen_power_register {
   13.14      uint32_t     space_id;
   13.15      uint32_t     bit_width;
   13.16 @@ -252,12 +258,55 @@ struct xen_processor_power {
   13.17      XEN_GUEST_HANDLE(xen_processor_cx_t) states; /* supported c states */
   13.18  };
   13.19  
   13.20 +struct xen_pct_register {
   13.21 +    uint8_t  descriptor;
   13.22 +    uint16_t length;
   13.23 +    uint8_t  space_id;
   13.24 +    uint8_t  bit_width;
   13.25 +    uint8_t  bit_offset;
   13.26 +    uint8_t  reserved;
   13.27 +    uint64_t address;
   13.28 +};
   13.29 +
   13.30 +struct xen_processor_px {
   13.31 +    uint64_t core_frequency; /* megahertz */
   13.32 +    uint64_t power;      /* milliWatts */
   13.33 +    uint64_t transition_latency; /* microseconds */
   13.34 +    uint64_t bus_master_latency; /* microseconds */
   13.35 +    uint64_t control;        /* control value */
   13.36 +    uint64_t status;     /* success indicator */
   13.37 +};
   13.38 +typedef struct xen_processor_px xen_processor_px_t;
   13.39 +DEFINE_XEN_GUEST_HANDLE(xen_processor_px_t);
   13.40 +
   13.41 +struct xen_psd_package {
   13.42 +    uint64_t num_entries;
   13.43 +    uint64_t revision;
   13.44 +    uint64_t domain;
   13.45 +    uint64_t coord_type;
   13.46 +    uint64_t num_processors;
   13.47 +};
   13.48 +
   13.49 +struct xen_processor_performance {
   13.50 +    uint32_t flags;     /* flag for Px sub info type */
   13.51 +    uint32_t ppc;       /* Platform limitation on freq usage */
   13.52 +    struct xen_pct_register control_register;
   13.53 +    struct xen_pct_register status_register;
   13.54 +    uint32_t state_count;     /* total available performance states */
   13.55 +    XEN_GUEST_HANDLE(xen_processor_px_t) states;
   13.56 +    struct xen_psd_package domain_info;
   13.57 +    uint32_t shared_type;     /* coordination type of this processor */
   13.58 +};
   13.59 +typedef struct xen_processor_performance xen_processor_performance_t;
   13.60 +DEFINE_XEN_GUEST_HANDLE(xen_processor_performance_t);
   13.61 +
   13.62  struct xenpf_set_processor_pminfo {
   13.63      /* IN variables */
   13.64      uint32_t id;    /* ACPI CPU ID */
   13.65 -    uint32_t type;  /* {XEN_PM_CX, ...} */
   13.66 +    uint32_t type;  /* {XEN_PM_CX, XEN_PM_PX} */
   13.67      union {
   13.68          struct xen_processor_power          power;/* Cx: _CST/_CSD */
   13.69 +        struct xen_processor_performance    perf; /* Px: _PPC/_PCT/_PSS/_PSD */
   13.70      };
   13.71  };
   13.72  typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t;