rpms/kernel/devel drm-intel-no-tv-hotplug.patch, NONE, 1.1.2.1 linux-2.6-iwlagn-modify-digital-SVR-for-1000.patch, NONE, 1.1.2.1 linux-2.6-iwlwifi-Handle-new-firmware-file-with-ucode-build-number-in-header.patch, NONE, 1.1.2.1 linux-2.6-iwlwifi-fix-debugfs-buffer-handling.patch, NONE, 1.1.2.1 linux-2.6-iwlwifi-fix-unloading-driver-while-scanning.patch, NONE, 1.1.2.1 linux-2.6-iwlwifi-remove-deprecated-6000-series-adapters.patch, NONE, 1.1.2.1 linux-2.6-iwlwifi-traverse-linklist-to-find-the-valid-OTP-block.patch, NONE, 1.1.2.1 linux-2.6-iwlwifi-update-1000-series-API-version-to-match-firmware.patch, NONE, 1.1.2.1 linux-2.6-raidlockdep.patch, NONE, 1.1.2.1 linux-2.6-selinux-module-load-perms.patch, NONE, 1.1.2.1 linux-2.6.31-cpufreq-powernow-k8-oops.patch, NONE, 1.1.2.1 linux-2.6.31-cpuidle-faster-io.patch, NONE, 1.1.2.1 ppc-hates-my-family-and-swore-revenge.patch, NONE, 1.1.2.1 Makefile, 1.97.6.6, 1.97.6.7 config-powerpc64, 1.27.6.4, 1.27.6.5 drm-nouveau.patch, 1.8.6.18, 1.8.6.19 kernel.spec, 1.1294.2.67, 1.1294.2.68 xen.pvops.patch, 1.1.2.42, 1.1.2.43 xen.pvops.post.patch, 1.1.2.27, 1.1.2.28 drm-page-flip.patch, 1.2.6.5, NONE linux-2.6-mac80211-age-scan-results-on-resume.patch, 1.1.10.2, NONE linux-2.6-rt2x00-asus-leds.patch, 1.1, NONE

myoung myoung at fedoraproject.org
Sat Sep 19 16:47:46 UTC 2009


Author: myoung

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12113

Modified Files:
      Tag: private-myoung-dom0-branch
	Makefile config-powerpc64 drm-nouveau.patch kernel.spec 
	xen.pvops.patch xen.pvops.post.patch 
Added Files:
      Tag: private-myoung-dom0-branch
	drm-intel-no-tv-hotplug.patch 
	linux-2.6-iwlagn-modify-digital-SVR-for-1000.patch 
	linux-2.6-iwlwifi-Handle-new-firmware-file-with-ucode-build-number-in-header.patch 
	linux-2.6-iwlwifi-fix-debugfs-buffer-handling.patch 
	linux-2.6-iwlwifi-fix-unloading-driver-while-scanning.patch 
	linux-2.6-iwlwifi-remove-deprecated-6000-series-adapters.patch 
	linux-2.6-iwlwifi-traverse-linklist-to-find-the-valid-OTP-block.patch 
	linux-2.6-iwlwifi-update-1000-series-API-version-to-match-firmware.patch 
	linux-2.6-raidlockdep.patch 
	linux-2.6-selinux-module-load-perms.patch 
	linux-2.6.31-cpufreq-powernow-k8-oops.patch 
	linux-2.6.31-cpuidle-faster-io.patch 
	ppc-hates-my-family-and-swore-revenge.patch 
Removed Files:
      Tag: private-myoung-dom0-branch
	drm-page-flip.patch 
	linux-2.6-mac80211-age-scan-results-on-resume.patch 
	linux-2.6-rt2x00-asus-leds.patch 
Log Message:
Switch pvops from rebase/master to xen/master branch


drm-intel-no-tv-hotplug.patch:
 i915_reg.h |    1 -
 1 file changed, 1 deletion(-)

--- NEW FILE drm-intel-no-tv-hotplug.patch ---
diff -up linux-2.6.31.noarch/drivers/gpu/drm/i915/i915_reg.h.jx linux-2.6.31.noarch/drivers/gpu/drm/i915/i915_reg.h
--- linux-2.6.31.noarch/drivers/gpu/drm/i915/i915_reg.h.jx	2009-09-16 13:36:20.000000000 -0400
+++ linux-2.6.31.noarch/drivers/gpu/drm/i915/i915_reg.h	2009-09-16 13:40:32.000000000 -0400
@@ -836,7 +836,6 @@
 			 HDMID_HOTPLUG_INT_EN |	  \
 			 SDVOB_HOTPLUG_INT_EN |	  \
 			 SDVOC_HOTPLUG_INT_EN |	  \
-			 TV_HOTPLUG_INT_EN |	  \
 			 CRT_HOTPLUG_INT_EN)
 
 

linux-2.6-iwlagn-modify-digital-SVR-for-1000.patch:
 iwl-5000.c |    7 +++++++
 iwl-prph.h |    5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

--- NEW FILE linux-2.6-iwlagn-modify-digital-SVR-for-1000.patch ---
commit 02c06e4abc0680afd31bf481a803541556757fb6
Author: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Date:   Fri Jul 17 09:30:14 2009 -0700

    iwlagn: modify digital SVR for 1000
    
    On 1000, there are two Switching Voltage Regulators (SVR). The first one
    apply digital voltage level (1.32V) for PCIe block and core. We need to
    use this regulator to solve a stability issue related to noisy DC2DC
    line in the silicon.
    
    Signed-off-by: Wey-Yi Guy <wey-yi.w.guy at intel.com>
    Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 85e8bac..3f9da6e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -239,6 +239,13 @@ static void iwl5000_nic_config(struct iwl_priv *priv)
 				APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS,
 				~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
 
+	if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_1000) {
+		/* Setting digital SVR for 1000 card to 1.32V */
+		iwl_set_bits_mask_prph(priv, APMG_DIGITAL_SVR_REG,
+					APMG_SVR_DIGITAL_VOLTAGE_1_32,
+					~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK);
+	}
+
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h
index 3b9cac3..d393e8f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-prph.h
+++ b/drivers/net/wireless/iwlwifi/iwl-prph.h
@@ -80,6 +80,8 @@
 #define APMG_RFKILL_REG			(APMG_BASE + 0x0014)
 #define APMG_RTC_INT_STT_REG		(APMG_BASE + 0x001c)
 #define APMG_RTC_INT_MSK_REG		(APMG_BASE + 0x0020)
+#define APMG_DIGITAL_SVR_REG		(APMG_BASE + 0x0058)
+#define APMG_ANALOG_SVR_REG		(APMG_BASE + 0x006C)
 
 #define APMG_CLK_VAL_DMA_CLK_RQT	(0x00000200)
 #define APMG_CLK_VAL_BSM_CLK_RQT	(0x00000800)
@@ -91,7 +93,8 @@
 #define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN		(0x00000000)
 #define APMG_PS_CTRL_VAL_PWR_SRC_MAX		(0x01000000) /* 3945 only */
 #define APMG_PS_CTRL_VAL_PWR_SRC_VAUX		(0x02000000)
-
+#define APMG_SVR_VOLTAGE_CONFIG_BIT_MSK	(0x000001E0) /* bit 8:5 */
+#define APMG_SVR_DIGITAL_VOLTAGE_1_32		(0x00000060)
 
 #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS		(0x00000800)
 

linux-2.6-iwlwifi-Handle-new-firmware-file-with-ucode-build-number-in-header.patch:
 iwl-3945.c     |   40 ++++++++++++++++++++++++++++++++++++++++
 iwl-4965.c     |   39 +++++++++++++++++++++++++++++++++++++++
 iwl-5000.c     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 iwl-6000.c     |    5 +++--
 iwl-agn.c      |   55 ++++++++++++++++++++++++++++++++-----------------------
 iwl-core.h     |   12 ++++++++++++
 iwl-dev.h      |   31 +++++++++++++++++++++++--------
 iwl3945-base.c |   45 ++++++++++++++++++++++++---------------------
 8 files changed, 224 insertions(+), 54 deletions(-)

--- NEW FILE linux-2.6-iwlwifi-Handle-new-firmware-file-with-ucode-build-number-in-header.patch ---
commit cc0f555d511a5fe9d4519334c8f674a1dbab9e3a
Author: Jay Sternberg <jay.e.sternberg at intel.com>
Date:   Fri Jul 17 09:30:16 2009 -0700

    iwlwifi: Handle new firmware file with ucode build number in header
    
    Adding new API version to account for change to ucode file format.  New
    header includes the build number of the ucode.  This build number is the
    SVN revision thus allowing for exact correlation to the code that
    generated it.
    
    The header adds the build number so that older ucode images can also be
    enhanced to include the build in the future.
    
    some cleanup in iwl_read_ucode needed to ensure old header not used and
    reduce unnecessary references through pointer with the data is already
    in heap variable.
    
    Signed-off-by: Jay Sternberg <jay.e.sternberg at intel.com>
    Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 1227ed2..14a47c0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2786,11 +2786,50 @@ static int iwl3945_load_bsm(struct iwl_priv *priv)
 	return 0;
 }
 
+#define IWL3945_UCODE_GET(item)						\
+static u32 iwl3945_ucode_get_##item(const struct iwl_ucode_header *ucode,\
+				    u32 api_ver)			\
+{									\
+	return le32_to_cpu(ucode->u.v1.item);				\
+}
+
+static u32 iwl3945_ucode_get_header_size(u32 api_ver)
+{
+	return UCODE_HEADER_SIZE(1);
+}
+static u32 iwl3945_ucode_get_build(const struct iwl_ucode_header *ucode,
+				   u32 api_ver)
+{
+	return 0;
+}
+static u8 *iwl3945_ucode_get_data(const struct iwl_ucode_header *ucode,
+				  u32 api_ver)
+{
+	return (u8 *) ucode->u.v1.data;
+}
+
+IWL3945_UCODE_GET(inst_size);
+IWL3945_UCODE_GET(data_size);
+IWL3945_UCODE_GET(init_size);
+IWL3945_UCODE_GET(init_data_size);
+IWL3945_UCODE_GET(boot_size);
+
 static struct iwl_hcmd_ops iwl3945_hcmd = {
 	.rxon_assoc = iwl3945_send_rxon_assoc,
 	.commit_rxon = iwl3945_commit_rxon,
 };
 
+static struct iwl_ucode_ops iwl3945_ucode = {
+	.get_header_size = iwl3945_ucode_get_header_size,
+	.get_build = iwl3945_ucode_get_build,
+	.get_inst_size = iwl3945_ucode_get_inst_size,
+	.get_data_size = iwl3945_ucode_get_data_size,
+	.get_init_size = iwl3945_ucode_get_init_size,
+	.get_init_data_size = iwl3945_ucode_get_init_data_size,
+	.get_boot_size = iwl3945_ucode_get_boot_size,
+	.get_data = iwl3945_ucode_get_data,
+};
+
 static struct iwl_lib_ops iwl3945_lib = {
 	.txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd,
 	.txq_free_tfd = iwl3945_hw_txq_free_tfd,
@@ -2831,6 +2870,7 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
 };
 
 static struct iwl_ops iwl3945_ops = {
+	.ucode = &iwl3945_ucode,
 	.lib = &iwl3945_lib,
 	.hcmd = &iwl3945_hcmd,
 	.utils = &iwl3945_hcmd_utils,
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index edbb0bf..f4eb683 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2221,12 +2221,50 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv)
 	cancel_work_sync(&priv->txpower_work);
 }
 
+#define IWL4965_UCODE_GET(item)						\
+static u32 iwl4965_ucode_get_##item(const struct iwl_ucode_header *ucode,\
+				    u32 api_ver)			\
+{									\
+	return le32_to_cpu(ucode->u.v1.item);				\
+}
+
+static u32 iwl4965_ucode_get_header_size(u32 api_ver)
+{
+	return UCODE_HEADER_SIZE(1);
+}
+static u32 iwl4965_ucode_get_build(const struct iwl_ucode_header *ucode,
+				   u32 api_ver)
+{
+	return 0;
+}
+static u8 *iwl4965_ucode_get_data(const struct iwl_ucode_header *ucode,
+				  u32 api_ver)
+{
+	return (u8 *) ucode->u.v1.data;
+}
+
+IWL4965_UCODE_GET(inst_size);
+IWL4965_UCODE_GET(data_size);
+IWL4965_UCODE_GET(init_size);
+IWL4965_UCODE_GET(init_data_size);
+IWL4965_UCODE_GET(boot_size);
+
 static struct iwl_hcmd_ops iwl4965_hcmd = {
 	.rxon_assoc = iwl4965_send_rxon_assoc,
 	.commit_rxon = iwl_commit_rxon,
 	.set_rxon_chain = iwl_set_rxon_chain,
 };
 
+static struct iwl_ucode_ops iwl4965_ucode = {
+	.get_header_size = iwl4965_ucode_get_header_size,
+	.get_build = iwl4965_ucode_get_build,
+	.get_inst_size = iwl4965_ucode_get_inst_size,
+	.get_data_size = iwl4965_ucode_get_data_size,
+	.get_init_size = iwl4965_ucode_get_init_size,
+	.get_init_data_size = iwl4965_ucode_get_init_data_size,
+	.get_boot_size = iwl4965_ucode_get_boot_size,
+	.get_data = iwl4965_ucode_get_data,
+};
 static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = {
 	.get_hcmd_size = iwl4965_get_hcmd_size,
 	.build_addsta_hcmd = iwl4965_build_addsta_hcmd,
@@ -2287,6 +2325,7 @@ static struct iwl_lib_ops iwl4965_lib = {
 };
 
 static struct iwl_ops iwl4965_ops = {
+	.ucode = &iwl4965_ucode,
 	.lib = &iwl4965_lib,
 	.hcmd = &iwl4965_hcmd,
 	.utils = &iwl4965_hcmd_utils,
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 3f9da6e..74103cf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1456,6 +1456,44 @@ int iwl5000_calc_rssi(struct iwl_priv *priv,
 	return max_rssi - agc - IWL49_RSSI_OFFSET;
 }
 
+#define IWL5000_UCODE_GET(item)						\
+static u32 iwl5000_ucode_get_##item(const struct iwl_ucode_header *ucode,\
+				    u32 api_ver)			\
+{									\
+	if (api_ver <= 2)						\
+		return le32_to_cpu(ucode->u.v1.item);			\
+	return le32_to_cpu(ucode->u.v2.item);				\
+}
+
+static u32 iwl5000_ucode_get_header_size(u32 api_ver)
+{
+	if (api_ver <= 2)
+		return UCODE_HEADER_SIZE(1);
+	return UCODE_HEADER_SIZE(2);
+}
+
+static u32 iwl5000_ucode_get_build(const struct iwl_ucode_header *ucode,
+				   u32 api_ver)
+{
+	if (api_ver <= 2)
+		return 0;
+	return le32_to_cpu(ucode->u.v2.build);
+}
+
+static u8 *iwl5000_ucode_get_data(const struct iwl_ucode_header *ucode,
+				  u32 api_ver)
+{
+	if (api_ver <= 2)
+		return (u8 *) ucode->u.v1.data;
+	return (u8 *) ucode->u.v2.data;
+}
+
+IWL5000_UCODE_GET(inst_size);
+IWL5000_UCODE_GET(data_size);
+IWL5000_UCODE_GET(init_size);
+IWL5000_UCODE_GET(init_data_size);
+IWL5000_UCODE_GET(boot_size);
+
 struct iwl_hcmd_ops iwl5000_hcmd = {
 	.rxon_assoc = iwl5000_send_rxon_assoc,
 	.commit_rxon = iwl_commit_rxon,
@@ -1471,6 +1509,17 @@ struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = {
 	.calc_rssi = iwl5000_calc_rssi,
 };
 
+struct iwl_ucode_ops iwl5000_ucode = {
+	.get_header_size = iwl5000_ucode_get_header_size,
+	.get_build = iwl5000_ucode_get_build,
+	.get_inst_size = iwl5000_ucode_get_inst_size,
+	.get_data_size = iwl5000_ucode_get_data_size,
+	.get_init_size = iwl5000_ucode_get_init_size,
+	.get_init_data_size = iwl5000_ucode_get_init_data_size,
+	.get_boot_size = iwl5000_ucode_get_boot_size,
+	.get_data = iwl5000_ucode_get_data,
+};
+
 struct iwl_lib_ops iwl5000_lib = {
 	.set_hw_params = iwl5000_hw_set_hw_params,
 	.txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
@@ -1572,12 +1621,14 @@ static struct iwl_lib_ops iwl5150_lib = {
 };
 
 struct iwl_ops iwl5000_ops = {
+	.ucode = &iwl5000_ucode,
 	.lib = &iwl5000_lib,
 	.hcmd = &iwl5000_hcmd,
 	.utils = &iwl5000_hcmd_utils,
 };
 
 static struct iwl_ops iwl5150_ops = {
+	.ucode = &iwl5000_ucode,
 	.lib = &iwl5150_lib,
 	.hcmd = &iwl5000_hcmd,
 	.utils = &iwl5000_hcmd_utils,
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index bd438d8..26c5d4a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -46,8 +46,8 @@
 #include "iwl-5000-hw.h"
 
 /* Highest firmware API version supported */
-#define IWL6000_UCODE_API_MAX 2
-#define IWL6050_UCODE_API_MAX 2
+#define IWL6000_UCODE_API_MAX 3
+#define IWL6050_UCODE_API_MAX 3
 
 /* Lowest firmware API version supported */
 #define IWL6000_UCODE_API_MIN 1
@@ -69,6 +69,7 @@ static struct iwl_hcmd_utils_ops iwl6000_hcmd_utils = {
 };
 
 static struct iwl_ops iwl6000_ops = {
+	.ucode = &iwl5000_ucode,
 	.lib = &iwl5000_lib,
 	.hcmd = &iwl5000_hcmd,
 	.utils = &iwl6000_hcmd_utils,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index ad50022..6b874da 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1284,7 +1284,7 @@ static void iwl_nic_start(struct iwl_priv *priv)
  */
 static int iwl_read_ucode(struct iwl_priv *priv)
 {
-	struct iwl_ucode *ucode;
+	struct iwl_ucode_header *ucode;
 	int ret = -EINVAL, index;
 	const struct firmware *ucode_raw;
 	const char *name_pre = priv->cfg->fw_name_pre;
@@ -1293,7 +1293,8 @@ static int iwl_read_ucode(struct iwl_priv *priv)
 	char buf[25];
 	u8 *src;
 	size_t len;
-	u32 api_ver, inst_size, data_size, init_size, init_data_size, boot_size;
+	u32 api_ver, build;
+	u32 inst_size, data_size, init_size, init_data_size, boot_size;
 
 	/* Ask kernel firmware_class module to get the boot firmware off disk.
 	 * request_firmware() is synchronous, file is in memory on return. */
@@ -1323,23 +1324,26 @@ static int iwl_read_ucode(struct iwl_priv *priv)
 	if (ret < 0)
 		goto error;
 
-	/* Make sure that we got at least our header! */
-	if (ucode_raw->size < sizeof(*ucode)) {
+	/* Make sure that we got at least the v1 header! */
+	if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) {
 		IWL_ERR(priv, "File size way too small!\n");
 		ret = -EINVAL;
 		goto err_release;
 	}
 
 	/* Data from ucode file:  header followed by uCode images */
-	ucode = (void *)ucode_raw->data;
+	ucode = (struct iwl_ucode_header *)ucode_raw->data;
 
 	priv->ucode_ver = le32_to_cpu(ucode->ver);
 	api_ver = IWL_UCODE_API(priv->ucode_ver);
-	inst_size = le32_to_cpu(ucode->inst_size);
-	data_size = le32_to_cpu(ucode->data_size);
-	init_size = le32_to_cpu(ucode->init_size);
-	init_data_size = le32_to_cpu(ucode->init_data_size);
-	boot_size = le32_to_cpu(ucode->boot_size);
+	build = priv->cfg->ops->ucode->get_build(ucode, api_ver);
+	inst_size = priv->cfg->ops->ucode->get_inst_size(ucode, api_ver);
+	data_size = priv->cfg->ops->ucode->get_data_size(ucode, api_ver);
+	init_size = priv->cfg->ops->ucode->get_init_size(ucode, api_ver);
+	init_data_size =
+		priv->cfg->ops->ucode->get_init_data_size(ucode, api_ver);
+	boot_size = priv->cfg->ops->ucode->get_boot_size(ucode, api_ver);
+	src = priv->cfg->ops->ucode->get_data(ucode, api_ver);
 
 	/* api_ver should match the api version forming part of the
 	 * firmware filename ... but we don't check for that and only rely
@@ -1365,6 +1369,9 @@ static int iwl_read_ucode(struct iwl_priv *priv)
 	       IWL_UCODE_API(priv->ucode_ver),
 	       IWL_UCODE_SERIAL(priv->ucode_ver));
 
+	if (build)
+		IWL_DEBUG_INFO(priv, "Build %u\n", build);
+
 	IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n",
 		       priv->ucode_ver);
 	IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n",
@@ -1379,12 +1386,14 @@ static int iwl_read_ucode(struct iwl_priv *priv)
 		       boot_size);
 
 	/* Verify size of file vs. image size info in file's header */
-	if (ucode_raw->size < sizeof(*ucode) +
+	if (ucode_raw->size !=
+		priv->cfg->ops->ucode->get_header_size(api_ver) +
 		inst_size + data_size + init_size +
 		init_data_size + boot_size) {
 
-		IWL_DEBUG_INFO(priv, "uCode file size %d too small\n",
-			       (int)ucode_raw->size);
+		IWL_DEBUG_INFO(priv,
+			"uCode file size %d does not match expected size\n",
+			(int)ucode_raw->size);
 		ret = -EINVAL;
 		goto err_release;
 	}
@@ -1464,42 +1473,42 @@ static int iwl_read_ucode(struct iwl_priv *priv)
 	/* Copy images into buffers for card's bus-master reads ... */
 
 	/* Runtime instructions (first block of data in file) */
-	src = &ucode->data[0];
-	len = priv->ucode_code.len;
+	len = inst_size;
 	IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n", len);
 	memcpy(priv->ucode_code.v_addr, src, len);
+	src += len;
+
 	IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n",
 		priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
 
 	/* Runtime data (2nd block)
 	 * NOTE:  Copy into backup buffer will be done in iwl_up()  */
-	src = &ucode->data[inst_size];
-	len = priv->ucode_data.len;
+	len = data_size;
 	IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n", len);
 	memcpy(priv->ucode_data.v_addr, src, len);
 	memcpy(priv->ucode_data_backup.v_addr, src, len);
+	src += len;
 
 	/* Initialization instructions (3rd block) */
 	if (init_size) {
-		src = &ucode->data[inst_size + data_size];
-		len = priv->ucode_init.len;
+		len = init_size;
 		IWL_DEBUG_INFO(priv, "Copying (but not loading) init instr len %Zd\n",
 				len);
 		memcpy(priv->ucode_init.v_addr, src, len);
+		src += len;
 	}
 
 	/* Initialization data (4th block) */
 	if (init_data_size) {
-		src = &ucode->data[inst_size + data_size + init_size];
-		len = priv->ucode_init_data.len;
+		len = init_data_size;
 		IWL_DEBUG_INFO(priv, "Copying (but not loading) init data len %Zd\n",
 			       len);
 		memcpy(priv->ucode_init_data.v_addr, src, len);
+		src += len;
 	}
 
 	/* Bootstrap instructions (5th block) */
-	src = &ucode->data[inst_size + data_size + init_size + init_data_size];
-	len = priv->ucode_boot.len;
+	len = boot_size;
 	IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", len);
 	memcpy(priv->ucode_boot.v_addr, src, len);
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 640c464..c844fab 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -116,6 +116,17 @@ struct iwl_temp_ops {
 	void (*set_ct_kill)(struct iwl_priv *priv);
 };
 
+struct iwl_ucode_ops {
+	u32 (*get_header_size)(u32);
+	u32 (*get_build)(const struct iwl_ucode_header *, u32);
+	u32 (*get_inst_size)(const struct iwl_ucode_header *, u32);
+	u32 (*get_data_size)(const struct iwl_ucode_header *, u32);
+	u32 (*get_init_size)(const struct iwl_ucode_header *, u32);
+	u32 (*get_init_data_size)(const struct iwl_ucode_header *, u32);
+	u32 (*get_boot_size)(const struct iwl_ucode_header *, u32);
+	u8 * (*get_data)(const struct iwl_ucode_header *, u32);
+};
+
 struct iwl_lib_ops {
 	/* set hw dependent parameters */
 	int (*set_hw_params)(struct iwl_priv *priv);
@@ -171,6 +182,7 @@ struct iwl_lib_ops {
 };
 
 struct iwl_ops {
+	const struct iwl_ucode_ops *ucode;
 	const struct iwl_lib_ops *lib;
 	const struct iwl_hcmd_ops *hcmd;
 	const struct iwl_hcmd_utils_ops *utils;
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index b989d5c..f4afd0c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -66,6 +66,7 @@ extern struct iwl_cfg iwl1000_bgn_cfg;
 /* shared structures from iwl-5000.c */
 extern struct iwl_mod_params iwl50_mod_params;
 extern struct iwl_ops iwl5000_ops;
+extern struct iwl_ucode_ops iwl5000_ucode;
 extern struct iwl_lib_ops iwl5000_lib;
 extern struct iwl_hcmd_ops iwl5000_hcmd;
 extern struct iwl_hcmd_utils_ops iwl5000_hcmd_utils;
@@ -525,15 +526,29 @@ struct fw_desc {
 };
 
 /* uCode file layout */
-struct iwl_ucode {
-	__le32 ver;		/* major/minor/API/serial */
-	__le32 inst_size;	/* bytes of runtime instructions */
-	__le32 data_size;	/* bytes of runtime data */
-	__le32 init_size;	/* bytes of initialization instructions */
-	__le32 init_data_size;	/* bytes of initialization data */
-	__le32 boot_size;	/* bytes of bootstrap instructions */
-	u8 data[0];		/* data in same order as "size" elements */
+struct iwl_ucode_header {
+	__le32 ver;	/* major/minor/API/serial */
+	union {
+		struct {
+			__le32 inst_size;	/* bytes of runtime code */
+			__le32 data_size;	/* bytes of runtime data */
+			__le32 init_size;	/* bytes of init code */
+			__le32 init_data_size;	/* bytes of init data */
+			__le32 boot_size;	/* bytes of bootstrap code */
+			u8 data[0];		/* in same order as sizes */
+		} v1;
+		struct {
+			__le32 build;		/* build number */
+			__le32 inst_size;	/* bytes of runtime code */
+			__le32 data_size;	/* bytes of runtime data */
+			__le32 init_size;	/* bytes of init code */
+			__le32 init_data_size;	/* bytes of init data */
+			__le32 boot_size;	/* bytes of bootstrap code */
+			u8 data[0];		/* in same order as sizes */
+		} v2;
+	} u;
 };
+#define UCODE_HEADER_SIZE(ver) ((ver) == 1 ? 24 : 28)
 
 struct iwl4965_ibss_seq {
 	u8 mac[ETH_ALEN];
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index c9b3ea9..bd6a067 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2041,7 +2041,7 @@ static void iwl3945_nic_start(struct iwl_priv *priv)
  */
 static int iwl3945_read_ucode(struct iwl_priv *priv)
 {
-	struct iwl_ucode *ucode;
+	const struct iwl_ucode_header *ucode;
 	int ret = -EINVAL, index;
 	const struct firmware *ucode_raw;
 	/* firmware file name contains uCode/driver compatibility version */
@@ -2082,22 +2082,24 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
 		goto error;
 
 	/* Make sure that we got at least our header! */
-	if (ucode_raw->size < sizeof(*ucode)) {
+	if (ucode_raw->size <  priv->cfg->ops->ucode->get_header_size(1)) {
 		IWL_ERR(priv, "File size way too small!\n");
 		ret = -EINVAL;
 		goto err_release;
 	}
 
 	/* Data from ucode file:  header followed by uCode images */
-	ucode = (void *)ucode_raw->data;
+	ucode = (struct iwl_ucode_header *)ucode_raw->data;
 
 	priv->ucode_ver = le32_to_cpu(ucode->ver);
 	api_ver = IWL_UCODE_API(priv->ucode_ver);
-	inst_size = le32_to_cpu(ucode->inst_size);
-	data_size = le32_to_cpu(ucode->data_size);
-	init_size = le32_to_cpu(ucode->init_size);
-	init_data_size = le32_to_cpu(ucode->init_data_size);
-	boot_size = le32_to_cpu(ucode->boot_size);
+	inst_size = priv->cfg->ops->ucode->get_inst_size(ucode, api_ver);
+	data_size = priv->cfg->ops->ucode->get_data_size(ucode, api_ver);
+	init_size = priv->cfg->ops->ucode->get_init_size(ucode, api_ver);
+	init_data_size =
+		priv->cfg->ops->ucode->get_init_data_size(ucode, api_ver);
+	boot_size = priv->cfg->ops->ucode->get_boot_size(ucode, api_ver);
+	src = priv->cfg->ops->ucode->get_data(ucode, api_ver);
 
 	/* api_ver should match the api version forming part of the
 	 * firmware filename ... but we don't check for that and only rely
@@ -2138,12 +2140,13 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
 
 
 	/* Verify size of file vs. image size info in file's header */
-	if (ucode_raw->size < sizeof(*ucode) +
+	if (ucode_raw->size != priv->cfg->ops->ucode->get_header_size(api_ver) +
 		inst_size + data_size + init_size +
 		init_data_size + boot_size) {
 
-		IWL_DEBUG_INFO(priv, "uCode file size %zd too small\n",
-			       ucode_raw->size);
+		IWL_DEBUG_INFO(priv,
+			"uCode file size %zd does not match expected size\n",
+			ucode_raw->size);
 		ret = -EINVAL;
 		goto err_release;
 	}
@@ -2226,44 +2229,44 @@ static int iwl3945_read_ucode(struct iwl_priv *priv)
 	/* Copy images into buffers for card's bus-master reads ... */
 
 	/* Runtime instructions (first block of data in file) */
-	src = &ucode->data[0];
-	len = priv->ucode_code.len;
+	len = inst_size;
 	IWL_DEBUG_INFO(priv,
 		"Copying (but not loading) uCode instr len %zd\n", len);
 	memcpy(priv->ucode_code.v_addr, src, len);
+	src += len;
+
 	IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n",
 		priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
 
 	/* Runtime data (2nd block)
 	 * NOTE:  Copy into backup buffer will be done in iwl3945_up()  */
-	src = &ucode->data[inst_size];
-	len = priv->ucode_data.len;
+	len = data_size;
 	IWL_DEBUG_INFO(priv,
 		"Copying (but not loading) uCode data len %zd\n", len);
 	memcpy(priv->ucode_data.v_addr, src, len);
 	memcpy(priv->ucode_data_backup.v_addr, src, len);
+	src += len;
 
 	/* Initialization instructions (3rd block) */
 	if (init_size) {
-		src = &ucode->data[inst_size + data_size];
-		len = priv->ucode_init.len;
+		len = init_size;
 		IWL_DEBUG_INFO(priv,
 			"Copying (but not loading) init instr len %zd\n", len);
 		memcpy(priv->ucode_init.v_addr, src, len);
+		src += len;
 	}
 
 	/* Initialization data (4th block) */
 	if (init_data_size) {
-		src = &ucode->data[inst_size + data_size + init_size];
-		len = priv->ucode_init_data.len;
+		len = init_data_size;
 		IWL_DEBUG_INFO(priv,
 			"Copying (but not loading) init data len %zd\n", len);
 		memcpy(priv->ucode_init_data.v_addr, src, len);
+		src += len;
 	}
 
 	/* Bootstrap instructions (5th block) */
-	src = &ucode->data[inst_size + data_size + init_size + init_data_size];
-	len = priv->ucode_boot.len;
+	len = boot_size;
 	IWL_DEBUG_INFO(priv,
 		"Copying (but not loading) boot instr len %zd\n", len);
 	memcpy(priv->ucode_boot.v_addr, src, len);

linux-2.6-iwlwifi-fix-debugfs-buffer-handling.patch:
 iwl-debugfs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE linux-2.6-iwlwifi-fix-debugfs-buffer-handling.patch ---
Back-port to 2.6.31 of the following (pending) upstream commit...

>From ed9645671632b31d553c6336c4c1a8419afede7a Mon Sep 17 00:00:00 2001
From: Reinette Chatre <reinette.chatre at intel.com>
Date: Mon, 14 Sep 2009 11:12:10 -0700
Subject: [PATCH] iwlwifi: fix debugfs buffer handling

From: Reinette Chatre <reinette.chatre at intel.com>

We keep track of where to write into a buffer by keeping a count of how
much has been written so far. When writing to the buffer we thus take the
buffer pointer and adding the count of what has been written so far.
Keeping track of what has been written so far is done by incrementing
this number every time something is written to the buffer with how much has
been written at that time.

Currently this number is incremented incorrectly when using the
"hex_dump_to_buffer" call to add data to the buffer. Fix this by only
adding what has been added to the buffer in that call instead of what has
been added since beginning of buffer.

Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
---
diff -up linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-debugfs.c.orig linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-debugfs.c
--- linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-debugfs.c.orig	2009-09-09 18:13:59.000000000 -0400
+++ linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-debugfs.c	2009-09-16 15:30:50.000000000 -0400
@@ -327,7 +327,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct
 		pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
 		hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos,
 				   buf_size - pos, 0);
-		pos += strlen(buf);
+		pos += strlen(buf + pos);
 		if (buf_size - pos > 0)
 			buf[pos++] = '\n';
 	}

linux-2.6-iwlwifi-fix-unloading-driver-while-scanning.patch:
 iwl-agn.c  |    2 +-
 iwl-scan.c |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

--- NEW FILE linux-2.6-iwlwifi-fix-unloading-driver-while-scanning.patch ---
commit 5bddf54962bf68002816df710348ba197d6391bb
Author: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Date:   Fri Aug 21 13:34:25 2009 -0700

    iwlwifi: fix unloading driver while scanning
    
    If NetworkManager is busy scanning when user
    tries to unload the module, the driver can not be unloaded
    because HW still scanning.
    
    Make sure driver sends abort scan host command to uCode if it
    is in the middle of scanning during driver unload.
    
    Signed-off-by: Wey-Yi Guy <wey-yi.w.guy at intel.com>
    Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 533b393..00457bf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2155,7 +2155,7 @@ static void iwl_mac_stop(struct ieee80211_hw *hw)
 
 	priv->is_open = 0;
 
-	if (iwl_is_ready_rf(priv)) {
+	if (iwl_is_ready_rf(priv) || test_bit(STATUS_SCAN_HW, &priv->status)) {
 		/* stop mac, cancel any scan request and clear
 		 * RXON_FILTER_ASSOC_MSK BIT
 		 */
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index c4c916d..4f3a108 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -796,7 +796,8 @@ void iwl_bg_abort_scan(struct work_struct *work)
 {
 	struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan);
 
-	if (!iwl_is_ready(priv))
+	if (!test_bit(STATUS_READY, &priv->status) ||
+	    !test_bit(STATUS_GEO_CONFIGURED, &priv->status))
 		return;
 
 	mutex_lock(&priv->mutex);

linux-2.6-iwlwifi-remove-deprecated-6000-series-adapters.patch:
 iwl-6000.c |   18 ------------------
 iwl-agn.c  |    5 -----
 iwl-dev.h  |    1 -
 3 files changed, 24 deletions(-)

--- NEW FILE linux-2.6-iwlwifi-remove-deprecated-6000-series-adapters.patch ---
commit a11c4d000b84f7f49ebefc018c24bbfa3c9c0f3b
Author: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Date:   Fri Jul 31 14:28:08 2009 -0700

    iwlwifi: remove deprecated 6000 series adapters
    
    Remove the support for deprecated devices. These devices are
    engineering samples and no longer supported by the uCode.
    
    Signed-off-by: Wey-Yi Guy <wey-yi.w.guy at intel.com>
    Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

diff -up linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-6000.c.orig linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-6000.c
--- linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-6000.c.orig	2009-09-17 10:35:39.000000000 -0400
+++ linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-6000.c	2009-09-17 10:38:22.000000000 -0400
@@ -75,24 +75,6 @@ static struct iwl_ops iwl6000_ops = {
 	.utils = &iwl6000_hcmd_utils,
 };
 
-struct iwl_cfg iwl6000_2ag_cfg = {
-	.name = "6000 Series 2x2 AG",
-	.fw_name_pre = IWL6000_FW_PRE,
-	.ucode_api_max = IWL6000_UCODE_API_MAX,
-	.ucode_api_min = IWL6000_UCODE_API_MIN,
-	.sku = IWL_SKU_A|IWL_SKU_G,
-	.ops = &iwl6000_ops,
-	.eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
-	.eeprom_ver = EEPROM_5000_EEPROM_VERSION,
-	.eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
-	.mod_params = &iwl50_mod_params,
-	.valid_tx_ant = ANT_BC,
-	.valid_rx_ant = ANT_BC,
-	.need_pll_cfg = false,
-	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
-	.shadow_ram_support = true,
-};
-
 struct iwl_cfg iwl6000_2agn_cfg = {
 	.name = "6000 Series 2x2 AGN",
 	.fw_name_pre = IWL6000_FW_PRE,
diff -up linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-agn.c.orig linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-agn.c
--- linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-agn.c.orig	2009-09-17 10:35:39.000000000 -0400
+++ linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-agn.c	2009-09-17 10:37:46.000000000 -0400
@@ -3172,15 +3172,10 @@ static struct pci_device_id iwl_hw_card_
 	{IWL_PCI_DEVICE(0x423C, PCI_ANY_ID, iwl5150_agn_cfg)},
 	{IWL_PCI_DEVICE(0x423D, PCI_ANY_ID, iwl5150_agn_cfg)},
 /* 6000/6050 Series */
-	{IWL_PCI_DEVICE(0x0082, 0x1102, iwl6000_2ag_cfg)},
-	{IWL_PCI_DEVICE(0x0085, 0x1112, iwl6000_2ag_cfg)},
-	{IWL_PCI_DEVICE(0x0082, 0x1122, iwl6000_2ag_cfg)},
 	{IWL_PCI_DEVICE(0x422B, PCI_ANY_ID, iwl6000_3agn_cfg)},
 	{IWL_PCI_DEVICE(0x422C, PCI_ANY_ID, iwl6000_2agn_cfg)},
 	{IWL_PCI_DEVICE(0x4238, PCI_ANY_ID, iwl6000_3agn_cfg)},
 	{IWL_PCI_DEVICE(0x4239, PCI_ANY_ID, iwl6000_2agn_cfg)},
-	{IWL_PCI_DEVICE(0x0082, PCI_ANY_ID, iwl6000_2agn_cfg)},
-	{IWL_PCI_DEVICE(0x0085, PCI_ANY_ID, iwl6000_3agn_cfg)},
 	{IWL_PCI_DEVICE(0x0086, PCI_ANY_ID, iwl6050_3agn_cfg)},
 	{IWL_PCI_DEVICE(0x0087, PCI_ANY_ID, iwl6050_2agn_cfg)},
 	{IWL_PCI_DEVICE(0x0088, PCI_ANY_ID, iwl6050_3agn_cfg)},
diff -up linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-dev.h.orig linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-dev.h
--- linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-dev.h.orig	2009-09-17 10:35:39.000000000 -0400
+++ linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-dev.h	2009-09-17 10:38:00.000000000 -0400
@@ -56,7 +56,6 @@ extern struct iwl_cfg iwl5350_agn_cfg;
 extern struct iwl_cfg iwl5100_bg_cfg;
 extern struct iwl_cfg iwl5100_abg_cfg;
 extern struct iwl_cfg iwl5150_agn_cfg;
-extern struct iwl_cfg iwl6000_2ag_cfg;
 extern struct iwl_cfg iwl6000_2agn_cfg;
 extern struct iwl_cfg iwl6000_3agn_cfg;
 extern struct iwl_cfg iwl6050_2agn_cfg;

linux-2.6-iwlwifi-traverse-linklist-to-find-the-valid-OTP-block.patch:
 iwl-1000.c   |    4 -
 iwl-6000.c   |   18 ++++-
 iwl-core.h   |    4 +
 iwl-dev.h    |   12 +++
 iwl-eeprom.c |  185 +++++++++++++++++++++++++++++++++++++++++++++++------------
 iwl-eeprom.h |   10 ++-
 6 files changed, 191 insertions(+), 42 deletions(-)

--- NEW FILE linux-2.6-iwlwifi-traverse-linklist-to-find-the-valid-OTP-block.patch ---
Backport of the following upstream commit...

commit 415e49936b4b29b34c2fb561eeab867d41fc43a6
Author: Wey-Yi Guy <wey-yi.w.guy at intel.com>
Date:   Thu Aug 13 13:30:54 2009 -0700

    iwlwifi: traverse linklist to find the valid OTP block
    
    For devices using OTP memory, EEPROM image can start from
    any one of the OTP blocks. If shadow RAM is disabled, we need to
    traverse link list to find the last valid block, then start the EEPROM
    image reading.
    
    If OTP is not full, the valid block is the block _before_ the last block
    on the link list; the last block on the link list is the empty block
    ready for next OTP refresh/update.
    
    If OTP is full, then the last block is the valid block to be used for
    configure the device.
    
    Signed-off-by: Wey-Yi Guy <wey-yi.w.guy at intel.com>
    Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

diff -up linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-1000.c.orig linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-1000.c
--- linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-1000.c.orig	2009-09-17 09:22:27.000000000 -0400
+++ linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-1000.c	2009-09-17 09:26:23.000000000 -0400
@@ -62,12 +62,14 @@ struct iwl_cfg iwl1000_bgn_cfg = {
 	.ucode_api_min = IWL1000_UCODE_API_MIN,
 	.sku = IWL_SKU_G|IWL_SKU_N,
 	.ops = &iwl5000_ops,
-	.eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
+	.eeprom_size = OTP_LOW_IMAGE_SIZE,
 	.eeprom_ver = EEPROM_5000_EEPROM_VERSION,
 	.eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
 	.mod_params = &iwl50_mod_params,
 	.valid_tx_ant = ANT_A,
 	.valid_rx_ant = ANT_AB,
 	.need_pll_cfg = true,
+	.max_ll_items = OTP_MAX_LL_ITEMS_1000,
+	.shadow_ram_support = false,
 };
 
diff -up linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-6000.c.orig linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-6000.c
--- linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-6000.c.orig	2009-09-17 09:22:27.000000000 -0400
+++ linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-6000.c	2009-09-17 09:55:14.000000000 -0400
@@ -89,6 +89,8 @@ struct iwl_cfg iwl6000_2ag_cfg = {
 	.valid_tx_ant = ANT_BC,
 	.valid_rx_ant = ANT_BC,
 	.need_pll_cfg = false,
+	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
+	.shadow_ram_support = true,
 };
 
 struct iwl_cfg iwl6000_2agn_cfg = {
@@ -98,13 +100,15 @@ struct iwl_cfg iwl6000_2agn_cfg = {
 	.ucode_api_min = IWL6000_UCODE_API_MIN,
 	.sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
 	.ops = &iwl6000_ops,
-	.eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
+	.eeprom_size = OTP_LOW_IMAGE_SIZE,
 	.eeprom_ver = EEPROM_5000_EEPROM_VERSION,
 	.eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
 	.mod_params = &iwl50_mod_params,
 	.valid_tx_ant = ANT_AB,
 	.valid_rx_ant = ANT_AB,
 	.need_pll_cfg = false,
+	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
+	.shadow_ram_support = true,
 };
 
 struct iwl_cfg iwl6050_2agn_cfg = {
@@ -114,13 +118,15 @@ struct iwl_cfg iwl6050_2agn_cfg = {
 	.ucode_api_min = IWL6050_UCODE_API_MIN,
 	.sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
 	.ops = &iwl6000_ops,
-	.eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
+ 	.eeprom_size = OTP_LOW_IMAGE_SIZE,
 	.eeprom_ver = EEPROM_5000_EEPROM_VERSION,
 	.eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
 	.mod_params = &iwl50_mod_params,
 	.valid_tx_ant = ANT_AB,
 	.valid_rx_ant = ANT_AB,
 	.need_pll_cfg = false,
+	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
+	.shadow_ram_support = true,
 };
 
 struct iwl_cfg iwl6000_3agn_cfg = {
@@ -130,13 +136,15 @@ struct iwl_cfg iwl6000_3agn_cfg = {
 	.ucode_api_min = IWL6000_UCODE_API_MIN,
 	.sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
 	.ops = &iwl6000_ops,
-	.eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
+ 	.eeprom_size = OTP_LOW_IMAGE_SIZE,
 	.eeprom_ver = EEPROM_5000_EEPROM_VERSION,
 	.eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
 	.mod_params = &iwl50_mod_params,
 	.valid_tx_ant = ANT_ABC,
 	.valid_rx_ant = ANT_ABC,
 	.need_pll_cfg = false,
+	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
+	.shadow_ram_support = true,
 };
 
 struct iwl_cfg iwl6050_3agn_cfg = {
@@ -146,13 +154,15 @@ struct iwl_cfg iwl6050_3agn_cfg = {
 	.ucode_api_min = IWL6050_UCODE_API_MIN,
 	.sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
 	.ops = &iwl6000_ops,
-	.eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
+	.eeprom_size = OTP_LOW_IMAGE_SIZE,
 	.eeprom_ver = EEPROM_5000_EEPROM_VERSION,
 	.eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
 	.mod_params = &iwl50_mod_params,
 	.valid_tx_ant = ANT_ABC,
 	.valid_rx_ant = ANT_ABC,
 	.need_pll_cfg = false,
+	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
+	.shadow_ram_support = true,
 };
 
 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
diff -up linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-core.h.orig linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-core.h
--- linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-core.h.orig	2009-09-17 09:22:27.000000000 -0400
+++ linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-core.h	2009-09-17 09:35:58.000000000 -0400
@@ -207,6 +207,8 @@ struct iwl_mod_params {
  * 	filename is constructed as fw_name_pre<api>.ucode.
  * @ucode_api_max: Highest version of uCode API supported by driver.
  * @ucode_api_min: Lowest version of uCode API supported by driver.
+ * @max_ll_items: max number of OTP blocks
+ * @shadow_ram_support: shadow support for OTP memory
  *
  * We enable the driver to be backward compatible wrt API version. The
  * driver specifies which APIs it supports (with @ucode_api_max being the
@@ -243,6 +245,8 @@ struct iwl_cfg {
 	u8   valid_rx_ant;
 	bool need_pll_cfg;
 	bool use_isr_legacy;
+	const u16 max_ll_items;
+	const bool shadow_ram_support;
 };
 
 /***************************
diff -up linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-dev.h.orig linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-dev.h
--- linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-dev.h.orig	2009-09-17 09:22:27.000000000 -0400
+++ linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-dev.h	2009-09-17 09:40:55.000000000 -0400
@@ -835,6 +835,18 @@ enum iwl_nvm_type {
 	NVM_DEVICE_TYPE_OTP,
 };
 
+/*
+ * Two types of OTP memory access modes
+ *   IWL_OTP_ACCESS_ABSOLUTE - absolute address mode,
+ * 			        based on physical memory addressing
+ *   IWL_OTP_ACCESS_RELATIVE - relative address mode,
+ * 			       based on logical memory addressing
+ */
+enum iwl_access_mode {
+	IWL_OTP_ACCESS_ABSOLUTE,
+	IWL_OTP_ACCESS_RELATIVE,
+};
+
 /* interrupt statistics */
 struct isr_statistics {
 	u32 hw;
diff -up linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-eeprom.c.orig linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-eeprom.c
--- linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-eeprom.c.orig	2009-09-09 18:13:59.000000000 -0400
+++ linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-eeprom.c	2009-09-17 09:37:20.000000000 -0400
@@ -152,6 +152,19 @@ int iwlcore_eeprom_verify_signature(stru
 }
 EXPORT_SYMBOL(iwlcore_eeprom_verify_signature);
 
+static void iwl_set_otp_access(struct iwl_priv *priv, enum iwl_access_mode mode)
+{
+	u32 otpgp;
+
+	otpgp = iwl_read32(priv, CSR_OTP_GP_REG);
+	if (mode == IWL_OTP_ACCESS_ABSOLUTE)
+		iwl_clear_bit(priv, CSR_OTP_GP_REG,
+				CSR_OTP_GP_REG_OTP_ACCESS_MODE);
+	else
+		iwl_set_bit(priv, CSR_OTP_GP_REG,
+				CSR_OTP_GP_REG_OTP_ACCESS_MODE);
+}
+
 static int iwlcore_get_nvm_type(struct iwl_priv *priv)
 {
 	u32 otpgp;
@@ -249,6 +262,124 @@ static int iwl_init_otp_access(struct iw
 	return ret;
 }
 
+static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data)
+{
+	int ret = 0;
+	u32 r;
+	u32 otpgp;
+
+	_iwl_write32(priv, CSR_EEPROM_REG,
+		     CSR_EEPROM_REG_MSK_ADDR & (addr << 1));
+	ret = iwl_poll_direct_bit(priv, CSR_EEPROM_REG,
+				  CSR_EEPROM_REG_READ_VALID_MSK,
+				  IWL_EEPROM_ACCESS_TIMEOUT);
+	if (ret < 0) {
+		IWL_ERR(priv, "Time out reading OTP[%d]\n", addr);
+		return ret;
+	}
+	r = _iwl_read_direct32(priv, CSR_EEPROM_REG);
+	/* check for ECC errors: */
+	otpgp = iwl_read32(priv, CSR_OTP_GP_REG);
+	if (otpgp & CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK) {
+		/* stop in this case */
+		/* set the uncorrectable OTP ECC bit for acknowledgement */
+		iwl_set_bit(priv, CSR_OTP_GP_REG,
+			CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK);
+		IWL_ERR(priv, "Uncorrectable OTP ECC error, abort OTP read\n");
+		return -EINVAL;
+	}
+	if (otpgp & CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK) {
+		/* continue in this case */
+		/* set the correctable OTP ECC bit for acknowledgement */
+		iwl_set_bit(priv, CSR_OTP_GP_REG,
+				CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK);
+		IWL_ERR(priv, "Correctable OTP ECC error, continue read\n");
+	}
+	*eeprom_data = le16_to_cpu((__force __le16)(r >> 16));
+	return 0;
+}
+
+/*
+ * iwl_is_otp_empty: check for empty OTP
+ */
+static bool iwl_is_otp_empty(struct iwl_priv *priv)
+{
+	u16 next_link_addr = 0, link_value;
+	bool is_empty = false;
+
+	/* locate the beginning of OTP link list */
+	if (!iwl_read_otp_word(priv, next_link_addr, &link_value)) {
+		if (!link_value) {
+			IWL_ERR(priv, "OTP is empty\n");
+			is_empty = true;
+		}
+	} else {
+		IWL_ERR(priv, "Unable to read first block of OTP list.\n");
+		is_empty = true;
+	}
+
+	return is_empty;
+}
+
+
+/*
+ * iwl_find_otp_image: find EEPROM image in OTP
+ *   finding the OTP block that contains the EEPROM image.
+ *   the last valid block on the link list (the block _before_ the last block)
+ *   is the block we should read and used to configure the device.
+ *   If all the available OTP blocks are full, the last block will be the block
+ *   we should read and used to configure the device.
+ *   only perform this operation if shadow RAM is disabled
+ */
+static int iwl_find_otp_image(struct iwl_priv *priv,
+					u16 *validblockaddr)
+{
+	u16 next_link_addr = 0, link_value = 0, valid_addr;
+	int ret = 0;
+	int usedblocks = 0;
+
+	/* set addressing mode to absolute to traverse the link list */
+	iwl_set_otp_access(priv, IWL_OTP_ACCESS_ABSOLUTE);
+
+	/* checking for empty OTP or error */
+	if (iwl_is_otp_empty(priv))
+		return -EINVAL;
+
+	/*
+	 * start traverse link list
+	 * until reach the max number of OTP blocks
+	 * different devices have different number of OTP blocks
+	 */
+	do {
+		/* save current valid block address
+		 * check for more block on the link list
+		 */
+		valid_addr = next_link_addr;
+		next_link_addr = link_value;
+		IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n",
+			       usedblocks, next_link_addr);
+		if (iwl_read_otp_word(priv, next_link_addr, &link_value))
+			return -EINVAL;
+		if (!link_value) {
+			/*
+			 * reach the end of link list,
+			 * set address point to the starting address
+			 * of the image
+			 */
+			goto done;
+		}
+		/* more in the link list, continue */
+		usedblocks++;
+	} while (usedblocks < priv->cfg->max_ll_items);
+	/* OTP full, use last block */
+	IWL_DEBUG_INFO(priv, "OTP is full, use last block\n");
+done:
+	*validblockaddr = valid_addr;
+	/* skip first 2 bytes (link list pointer) */
+	*validblockaddr += 2;
+	return ret;
+}
+
 /**
  * iwl_eeprom_init - read EEPROM contents
  *
@@ -263,14 +394,13 @@ int iwl_eeprom_init(struct iwl_priv *pri
 	int sz;
 	int ret;
 	u16 addr;
-	u32 otpgp;
+	u16 validblockaddr = 0;
+	u16 cache_addr = 0;
 
 	priv->nvm_device_type = iwlcore_get_nvm_type(priv);
 
 	/* allocate eeprom */
-	if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
-		priv->cfg->eeprom_size =
-			OTP_BLOCK_SIZE * OTP_LOWER_BLOCKS_TOTAL;
+	IWL_DEBUG_INFO(priv, "NVM size = %d\n", priv->cfg->eeprom_size);
 	sz = priv->cfg->eeprom_size;
 	priv->eeprom = kzalloc(sz, GFP_KERNEL);
 	if (!priv->eeprom) {
@@ -298,46 +428,31 @@ int iwl_eeprom_init(struct iwl_priv *pri
 		if (ret) {
 			IWL_ERR(priv, "Failed to initialize OTP access.\n");
 			ret = -ENOENT;
-			goto err;
+			goto done;
 		}
 		_iwl_write32(priv, CSR_EEPROM_GP,
 			     iwl_read32(priv, CSR_EEPROM_GP) &
 			     ~CSR_EEPROM_GP_IF_OWNER_MSK);
-		/* clear */
-		_iwl_write32(priv, CSR_OTP_GP_REG,
-			     iwl_read32(priv, CSR_OTP_GP_REG) |
+
+		iwl_set_bit(priv, CSR_OTP_GP_REG,
 			     CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK |
 			     CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK);
-
-		for (addr = 0; addr < sz; addr += sizeof(u16)) {
-			u32 r;
-
-			_iwl_write32(priv, CSR_EEPROM_REG,
-				     CSR_EEPROM_REG_MSK_ADDR & (addr << 1));
-
-			ret = iwl_poll_direct_bit(priv, CSR_EEPROM_REG,
-						  CSR_EEPROM_REG_READ_VALID_MSK,
-						  IWL_EEPROM_ACCESS_TIMEOUT);
-			if (ret < 0) {
-				IWL_ERR(priv, "Time out reading OTP[%d]\n", addr);
+		/* traversing the linked list if no shadow ram supported */
+		if (!priv->cfg->shadow_ram_support) {
+			if (iwl_find_otp_image(priv, &validblockaddr)) {
+				ret = -ENOENT;
 				goto done;
 			}
-			r = _iwl_read_direct32(priv, CSR_EEPROM_REG);
-			/* check for ECC errors: */
-			otpgp = iwl_read32(priv, CSR_OTP_GP_REG);
-			if (otpgp & CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK) {
-				/* stop in this case */
-				IWL_ERR(priv, "Uncorrectable OTP ECC error, Abort OTP read\n");
+		}
+		for (addr = validblockaddr; addr < validblockaddr + sz;
+		     addr += sizeof(u16)) {
+			u16 eeprom_data;
+
+			ret = iwl_read_otp_word(priv, addr, &eeprom_data);
+			if (ret)
 				goto done;
-			}
-			if (otpgp & CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK) {
-				/* continue in this case */
-				_iwl_write32(priv, CSR_OTP_GP_REG,
-					     iwl_read32(priv, CSR_OTP_GP_REG) |
-					     CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK);
-				IWL_ERR(priv, "Correctable OTP ECC error, continue read\n");
-			}
-			e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
+			e[cache_addr / 2] = eeprom_data;
+			cache_addr += sizeof(u16);
 		}
 	} else {
 		/* eeprom is an array of 16bit values */
diff -up linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-eeprom.h.orig linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-eeprom.h
--- linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-eeprom.h.orig	2009-09-09 18:13:59.000000000 -0400
+++ linux-2.6.31.noarch/drivers/net/wireless/iwlwifi/iwl-eeprom.h	2009-09-17 09:24:20.000000000 -0400
@@ -180,8 +180,14 @@ struct iwl_eeprom_channel {
 #define EEPROM_5050_EEPROM_VERSION	(0x21E)
 
 /* OTP */
-#define OTP_LOWER_BLOCKS_TOTAL		(3)
-#define OTP_BLOCK_SIZE			(0x400)
+/* lower blocks contain EEPROM image and calibration data */
+#define OTP_LOW_IMAGE_SIZE		(2 * 512 * sizeof(u16)) /* 2 KB */
+/* high blocks contain PAPD data */
+#define OTP_HIGH_IMAGE_SIZE_6x00        (6 * 512 * sizeof(u16)) /* 6 KB */
+#define OTP_HIGH_IMAGE_SIZE_1000        (0x200 * sizeof(u16)) /* 1024 bytes */
+#define OTP_MAX_LL_ITEMS_1000		(3)	/* OTP blocks for 1000 */
+#define OTP_MAX_LL_ITEMS_6x00		(4)	/* OTP blocks for 6x00 */
+#define OTP_MAX_LL_ITEMS_6x50		(7)	/* OTP blocks for 6x50 */
 
 /* 2.4 GHz */
 extern const u8 iwl_eeprom_band_1[14];

linux-2.6-iwlwifi-update-1000-series-API-version-to-match-firmware.patch:
 iwl-1000.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE linux-2.6-iwlwifi-update-1000-series-API-version-to-match-firmware.patch ---
commit cce53aa347c1e023d967b1cb1aa393c725aedba5
Author: Jay Sternberg <jay.e.sternberg at intel.com>
Date:   Fri Jul 17 09:30:22 2009 -0700

    iwlwifi: update 1000 series API version to match firmware
    
    firmware file now contains build number so API needs to be updated.
    
    Signed-off-by: Jay Sternberg <jay.e.sternberg at intel.com>
    Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
    Signed-off-by: John W. Linville <linville at tuxdriver.com>

diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 7da52f1..a899be9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -46,7 +46,7 @@
 #include "iwl-5000-hw.h"
 
 /* Highest firmware API version supported */
-#define IWL1000_UCODE_API_MAX 2
+#define IWL1000_UCODE_API_MAX 3
 
 /* Lowest firmware API version supported */
 #define IWL1000_UCODE_API_MIN 1

linux-2.6-raidlockdep.patch:
 file.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

--- NEW FILE linux-2.6-raidlockdep.patch ---
Subject:
Re: 2.6.31rc5 RAID10 lockdep report - sysfs_nofity_dirent locking issue
From:
Dan Williams <dan.j.williams at intel.com>
Date:
Tue, 15 Sep 2009 16:05:51 -0700
To:
Greg KH <gregkh at suse.de>
CC:
Neil Brown <neilb at suse.de>, Dave Jones <davej at redhat.com>, Linux Kernel <linux-kernel at vger.kernel.org>, Hans de Goede <hdegoede at redhat.com>

>From 1ee8b5bfeb2de765d3b2acbaf5357c4c0eb65dbe Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb at suse.de>
Date: Thu, 6 Aug 2009 15:42:08 +1000
Subject: [PATCH] Allow sysfs_notify_dirent to be called from interrupt context.

sysfs_notify_dirent is a simple atomic operation that can be used to
alert user-space that new data can be read from a sysfs attribute.

Unfortunately it cannot currently be called from non-process context
because of its use of spin_lock which is sometimes taken with
interrupts enabled.

So change all lockers of sysfs_open_dirent_lock to disable interrupts,
thus making sysfs_notify_dirent safe to be called from non-process
context (as drivers/md does in md_safemode_timeout).

sysfs_get_open_dirent is (documented as being) only called from
process context, so it uses spin_lock_irq.  Other places
use spin_lock_irqsave.

The usage for sysfs_notify_dirent in md_safemode_timeout was
introduced in 2.6.28, so this patch is suitable for that and more
recent kernels.

Cc: <stable at kernel.org>
Reported-by: Joel Andres Granados <jgranado at redhat.com>
Signed-off-by: NeilBrown <neilb at suse.de>
Signed-off-by: Dan Williams <dan.j.williams at intel.com>
---
>> > > Greg?
>> > > 
>> > > Looks like this never made it upstream, and now Hans is hitting this
>> > > in his tests.
> > 
> > Ok, I don't have this in my queue, so someone needs to resubmit it and
> > tell me what kernel trees it should be applicable for.

As mentioned in the commit log should be applicable back to 2.6.28.

Thanks,
Dan


 fs/sysfs/file.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 561a9c0..f5ea468 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -268,7 +268,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd,
 	struct sysfs_open_dirent *od, *new_od = NULL;
 
  retry:
-	spin_lock(&sysfs_open_dirent_lock);
+	spin_lock_irq(&sysfs_open_dirent_lock);
 
 	if (!sd->s_attr.open && new_od) {
 		sd->s_attr.open = new_od;
@@ -281,7 +281,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd,
 		list_add_tail(&buffer->list, &od->buffers);
 	}
 
-	spin_unlock(&sysfs_open_dirent_lock);
+	spin_unlock_irq(&sysfs_open_dirent_lock);
 
 	if (od) {
 		kfree(new_od);
@@ -315,8 +315,9 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd,
 				  struct sysfs_buffer *buffer)
 {
 	struct sysfs_open_dirent *od = sd->s_attr.open;
+	unsigned long flags;
 
-	spin_lock(&sysfs_open_dirent_lock);
+	spin_lock_irqsave(&sysfs_open_dirent_lock, flags);
 
 	list_del(&buffer->list);
 	if (atomic_dec_and_test(&od->refcnt))
@@ -324,7 +325,7 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd,
 	else
 		od = NULL;
 
-	spin_unlock(&sysfs_open_dirent_lock);
+	spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
 
 	kfree(od);
 }
@@ -456,8 +457,9 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
 void sysfs_notify_dirent(struct sysfs_dirent *sd)
 {
 	struct sysfs_open_dirent *od;
+	unsigned long flags;
 
-	spin_lock(&sysfs_open_dirent_lock);
+	spin_lock_irqsave(&sysfs_open_dirent_lock, flags);
 
 	od = sd->s_attr.open;
 	if (od) {
@@ -465,7 +467,7 @@ void sysfs_notify_dirent(struct sysfs_dirent *sd)
 		wake_up_interruptible(&od->poll);
 	}
 
-	spin_unlock(&sysfs_open_dirent_lock);
+	spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
 }
 EXPORT_SYMBOL_GPL(sysfs_notify_dirent);
 
-- 1.6.0.6 
linux-2.6-selinux-module-load-perms.patch:
 drivers/staging/comedi/comedi_fops.c         |    8 ++++----
 include/linux/security.h                     |   10 ++++++++++
 kernel/kmod.c                                |    4 ++++
 net/core/dev.c                               |    2 +-
 net/ipv4/tcp_cong.c                          |    4 ++--
 security/capability.c                        |    6 ++++++
 security/security.c                          |    5 +++++
 security/selinux/hooks.c                     |    6 ++++++
 security/selinux/include/av_perm_to_string.h |    1 +
 security/selinux/include/av_permissions.h    |    1 +
 10 files changed, 40 insertions(+), 7 deletions(-)

--- NEW FILE linux-2.6-selinux-module-load-perms.patch ---
diff -up linux-2.6.31.x86_64/drivers/staging/comedi/comedi_fops.c.pre.module linux-2.6.31.x86_64/drivers/staging/comedi/comedi_fops.c
--- linux-2.6.31.x86_64/drivers/staging/comedi/comedi_fops.c.pre.module	2009-09-14 14:02:56.726491957 -0400
+++ linux-2.6.31.x86_64/drivers/staging/comedi/comedi_fops.c	2009-09-14 14:03:30.035571987 -0400
@@ -1752,12 +1752,12 @@ static int comedi_open(struct inode *ino
 	mutex_lock(&dev->mutex);
 	if (dev->attached)
 		goto ok;
-	if (!capable(CAP_SYS_MODULE) && dev->in_request_module) {
+	if (!capable(CAP_NET_ADMIN) && dev->in_request_module) {
 		DPRINTK("in request module\n");
 		mutex_unlock(&dev->mutex);
 		return -ENODEV;
 	}
-	if (capable(CAP_SYS_MODULE) && dev->in_request_module)
+	if (capable(CAP_NET_ADMIN) && dev->in_request_module)
 		goto ok;
 
 	dev->in_request_module = 1;
@@ -1770,8 +1770,8 @@ static int comedi_open(struct inode *ino
 
 	dev->in_request_module = 0;
 
-	if (!dev->attached && !capable(CAP_SYS_MODULE)) {
-		DPRINTK("not attached and not CAP_SYS_MODULE\n");
+	if (!dev->attached && !capable(CAP_NET_ADMIN)) {
+		DPRINTK("not attached and not CAP_NET_ADMIN\n");
 		mutex_unlock(&dev->mutex);
 		return -ENODEV;
 	}
diff -up linux-2.6.31.x86_64/include/linux/security.h.pre.module linux-2.6.31.x86_64/include/linux/security.h
--- linux-2.6.31.x86_64/include/linux/security.h.pre.module	2009-09-14 14:01:55.018199730 -0400
+++ linux-2.6.31.x86_64/include/linux/security.h	2009-09-14 14:03:35.710454710 -0400
@@ -678,6 +678,9 @@ static inline void security_free_mnt_opt
  *	@inode points to the inode to use as a reference.
  *	The current task must be the one that nominated @inode.
  *	Return 0 if successful.
+ * @kernel_module_request:
+ *	Ability to trigger the kernel to automatically upcall to userspace for
+ *	userspace to load a kernel module with the given name.
  * @task_setuid:
  *	Check permission before setting one or more of the user identity
  *	attributes of the current process.  The @flags parameter indicates
@@ -1489,6 +1492,7 @@ struct security_operations {
 	void (*cred_commit)(struct cred *new, const struct cred *old);
 	int (*kernel_act_as)(struct cred *new, u32 secid);
 	int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
+	int (*kernel_module_request)(void);
 	int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
 	int (*task_fix_setuid) (struct cred *new, const struct cred *old,
 				int flags);
@@ -1741,6 +1745,7 @@ int security_prepare_creds(struct cred *
 void security_commit_creds(struct cred *new, const struct cred *old);
 int security_kernel_act_as(struct cred *new, u32 secid);
 int security_kernel_create_files_as(struct cred *new, struct inode *inode);
+int security_kernel_module_request(void);
 int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
 int security_task_fix_setuid(struct cred *new, const struct cred *old,
 			     int flags);
@@ -2292,6 +2297,11 @@ static inline int security_kernel_create
 	return 0;
 }
 
+static inline int security_kernel_module_request(void)
+{
+	return 0;
+}
+
 static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
 				       int flags)
 {
diff -up linux-2.6.31.x86_64/kernel/kmod.c.pre.module linux-2.6.31.x86_64/kernel/kmod.c
--- linux-2.6.31.x86_64/kernel/kmod.c.pre.module	2009-09-14 14:02:04.516942256 -0400
+++ linux-2.6.31.x86_64/kernel/kmod.c	2009-09-14 14:03:35.716407772 -0400
@@ -78,6 +78,10 @@ int __request_module(bool wait, const ch
 #define MAX_KMOD_CONCURRENT 50	/* Completely arbitrary value - KAO */
 	static int kmod_loop_msg;
 
+	ret = security_kernel_module_request();
+	if (ret)
+		return ret;
+
 	va_start(args, fmt);
 	ret = vsnprintf(module_name, MODULE_NAME_LEN, fmt, args);
 	va_end(args);
diff -up linux-2.6.31.x86_64/net/core/dev.c.pre.module linux-2.6.31.x86_64/net/core/dev.c
--- linux-2.6.31.x86_64/net/core/dev.c.pre.module	2009-09-14 14:03:03.826314426 -0400
+++ linux-2.6.31.x86_64/net/core/dev.c	2009-09-14 14:03:30.044573421 -0400
@@ -1031,7 +1031,7 @@ void dev_load(struct net *net, const cha
 	dev = __dev_get_by_name(net, name);
 	read_unlock(&dev_base_lock);
 
-	if (!dev && capable(CAP_SYS_MODULE))
+	if (!dev && capable(CAP_NET_ADMIN))
 		request_module("%s", name);
 }
 
diff -up linux-2.6.31.x86_64/net/ipv4/tcp_cong.c.pre.module linux-2.6.31.x86_64/net/ipv4/tcp_cong.c
--- linux-2.6.31.x86_64/net/ipv4/tcp_cong.c.pre.module	2009-09-14 14:03:09.495142463 -0400
+++ linux-2.6.31.x86_64/net/ipv4/tcp_cong.c	2009-09-14 14:03:30.054565116 -0400
@@ -116,7 +116,7 @@ int tcp_set_default_congestion_control(c
 	spin_lock(&tcp_cong_list_lock);
 	ca = tcp_ca_find(name);
 #ifdef CONFIG_MODULES
-	if (!ca && capable(CAP_SYS_MODULE)) {
+	if (!ca && capable(CAP_NET_ADMIN)) {
 		spin_unlock(&tcp_cong_list_lock);
 
 		request_module("tcp_%s", name);
@@ -246,7 +246,7 @@ int tcp_set_congestion_control(struct so
 
 #ifdef CONFIG_MODULES
 	/* not found attempt to autoload module */
-	if (!ca && capable(CAP_SYS_MODULE)) {
+	if (!ca && capable(CAP_NET_ADMIN)) {
 		rcu_read_unlock();
 		request_module("tcp_%s", name);
 		rcu_read_lock();
diff -up linux-2.6.31.x86_64/security/capability.c.pre.module linux-2.6.31.x86_64/security/capability.c
--- linux-2.6.31.x86_64/security/capability.c.pre.module	2009-09-14 14:02:11.009778206 -0400
+++ linux-2.6.31.x86_64/security/capability.c	2009-09-14 14:03:35.718408863 -0400
@@ -396,6 +396,11 @@ static int cap_kernel_create_files_as(st
 	return 0;
 }
 
+static int cap_kernel_module_request(void)
+{
+	return 0;
+}
+
 static int cap_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags)
 {
 	return 0;
@@ -945,6 +950,7 @@ void security_fixup_ops(struct security_
 	set_to_cap_if_null(ops, cred_commit);
 	set_to_cap_if_null(ops, kernel_act_as);
 	set_to_cap_if_null(ops, kernel_create_files_as);
+	set_to_cap_if_null(ops, kernel_module_request);
 	set_to_cap_if_null(ops, task_setuid);
 	set_to_cap_if_null(ops, task_fix_setuid);
 	set_to_cap_if_null(ops, task_setgid);
diff -up linux-2.6.31.x86_64/security/security.c.pre.module linux-2.6.31.x86_64/security/security.c
--- linux-2.6.31.x86_64/security/security.c.pre.module	2009-09-14 14:02:17.341611595 -0400
+++ linux-2.6.31.x86_64/security/security.c	2009-09-14 14:03:35.720408600 -0400
@@ -709,6 +709,11 @@ int security_kernel_create_files_as(stru
 	return security_ops->kernel_create_files_as(new, inode);
 }
 
+int security_kernel_module_request(void)
+{
+	return security_ops->kernel_module_request();
+}
+
 int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags)
 {
 	return security_ops->task_setuid(id0, id1, id2, flags);
diff -up linux-2.6.31.x86_64/security/selinux/hooks.c.pre.module linux-2.6.31.x86_64/security/selinux/hooks.c
--- linux-2.6.31.x86_64/security/selinux/hooks.c.pre.module	2009-09-14 14:02:24.072199503 -0400
+++ linux-2.6.31.x86_64/security/selinux/hooks.c	2009-09-14 14:03:39.017312134 -0400
@@ -3292,6 +3292,11 @@ static int selinux_kernel_create_files_a
 	return 0;
 }
 
+static int selinux_kernel_module_request(void)
+{
+	return task_has_system(current, SYSTEM__MODULE_REQUEST);
+}
+
 static int selinux_task_setpgid(struct task_struct *p, pid_t pgid)
 {
 	return current_has_perm(p, PROCESS__SETPGID);
@@ -5400,6 +5405,7 @@ static struct security_operations selinu
 	.cred_prepare =			selinux_cred_prepare,
 	.kernel_act_as =		selinux_kernel_act_as,
 	.kernel_create_files_as =	selinux_kernel_create_files_as,
+	.kernel_module_request =	selinux_kernel_module_request,
 	.task_setpgid =			selinux_task_setpgid,
 	.task_getpgid =			selinux_task_getpgid,
 	.task_getsid =			selinux_task_getsid,
diff -up linux-2.6.31.x86_64/security/selinux/include/av_permissions.h.pre.module linux-2.6.31.x86_64/security/selinux/include/av_permissions.h
--- linux-2.6.31.x86_64/security/selinux/include/av_permissions.h.pre.module	2009-09-14 14:02:48.685714616 -0400
+++ linux-2.6.31.x86_64/security/selinux/include/av_permissions.h	2009-09-14 14:03:39.022321676 -0400
@@ -508,6 +508,7 @@
 #define SYSTEM__SYSLOG_READ                       0x00000002UL
 #define SYSTEM__SYSLOG_MOD                        0x00000004UL
 #define SYSTEM__SYSLOG_CONSOLE                    0x00000008UL
+#define SYSTEM__MODULE_REQUEST                    0x00000010UL
 #define CAPABILITY__CHOWN                         0x00000001UL
 #define CAPABILITY__DAC_OVERRIDE                  0x00000002UL
 #define CAPABILITY__DAC_READ_SEARCH               0x00000004UL
diff -up linux-2.6.31.x86_64/security/selinux/include/av_perm_to_string.h.pre.module linux-2.6.31.x86_64/security/selinux/include/av_perm_to_string.h
--- linux-2.6.31.x86_64/security/selinux/include/av_perm_to_string.h.pre.module	2009-09-14 14:02:37.563058003 -0400
+++ linux-2.6.31.x86_64/security/selinux/include/av_perm_to_string.h	2009-09-14 14:03:39.019310239 -0400
@@ -107,6 +107,7 @@
    S_(SECCLASS_SYSTEM, SYSTEM__SYSLOG_READ, "syslog_read")
    S_(SECCLASS_SYSTEM, SYSTEM__SYSLOG_MOD, "syslog_mod")
    S_(SECCLASS_SYSTEM, SYSTEM__SYSLOG_CONSOLE, "syslog_console")
+   S_(SECCLASS_SYSTEM, SYSTEM__MODULE_REQUEST, "module_request")
    S_(SECCLASS_CAPABILITY, CAPABILITY__CHOWN, "chown")
    S_(SECCLASS_CAPABILITY, CAPABILITY__DAC_OVERRIDE, "dac_override")
    S_(SECCLASS_CAPABILITY, CAPABILITY__DAC_READ_SEARCH, "dac_read_search")

linux-2.6.31-cpufreq-powernow-k8-oops.patch:
 powernow-k8.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

--- NEW FILE linux-2.6.31-cpufreq-powernow-k8-oops.patch ---
--- vanilla-2.6.31/arch/x86/kernel/cpu/cpufreq/powernow-k8.c	2009-09-09 18:13:59.000000000 -0400
+++ linux-2.6.31.noarch/arch/x86/kernel/cpu/cpufreq/powernow-k8.c	2009-09-16 11:27:33.000000000 -0400
@@ -605,9 +605,10 @@ static int check_pst_table(struct powern
 	return 0;
 }
 
-static void invalidate_entry(struct powernow_k8_data *data, unsigned int entry)
+static void invalidate_entry(struct cpufreq_frequency_table *powernow_table,
+		unsigned int entry)
 {
-	data->powernow_table[entry].frequency = CPUFREQ_ENTRY_INVALID;
+	powernow_table[entry].frequency = CPUFREQ_ENTRY_INVALID;
 }
 
 static void print_basics(struct powernow_k8_data *data)
@@ -914,13 +915,13 @@ static int fill_powernow_table_pstate(st
 					"bad value %d.\n", i, index);
 			printk(KERN_ERR PFX "Please report to BIOS "
 					"manufacturer\n");
-			invalidate_entry(data, i);
+			invalidate_entry(powernow_table, i);
 			continue;
 		}
 		rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
 		if (!(hi & HW_PSTATE_VALID_MASK)) {
 			dprintk("invalid pstate %d, ignoring\n", index);
-			invalidate_entry(data, i);
+			invalidate_entry(powernow_table, i);
 			continue;
 		}
 
@@ -970,7 +971,7 @@ static int fill_powernow_table_fidvid(st
 		/* verify frequency is OK */
 		if ((freq > (MAX_FREQ * 1000)) || (freq < (MIN_FREQ * 1000))) {
 			dprintk("invalid freq %u kHz, ignoring\n", freq);
-			invalidate_entry(data, i);
+			invalidate_entry(powernow_table, i);
 			continue;
 		}
 
@@ -978,7 +979,7 @@ static int fill_powernow_table_fidvid(st
 		 * BIOSs are using "off" to indicate invalid */
 		if (vid == VID_OFF) {
 			dprintk("invalid vid %u, ignoring\n", vid);
-			invalidate_entry(data, i);
+			invalidate_entry(powernow_table, i);
 			continue;
 		}
 
@@ -997,7 +998,7 @@ static int fill_powernow_table_fidvid(st
 
 				dprintk("double low frequency table entry, "
 						"ignoring it.\n");
-				invalidate_entry(data, i);
+				invalidate_entry(powernow_table, i);
 				continue;
 			} else
 				cntlofreq = i;
@@ -1009,7 +1010,7 @@ static int fill_powernow_table_fidvid(st
 				(unsigned int)
 				(data->acpi_data.states[i].core_frequency
 				 * 1000));
-			invalidate_entry(data, i);
+			invalidate_entry(powernow_table, i);
 			continue;
 		}
 	}

linux-2.6.31-cpuidle-faster-io.patch:
 drivers/cpuidle/governors/menu.c |  251 ++++++++++++++++++++++++++++++++-------
 include/linux/sched.h            |    4 
 kernel/sched.c                   |   18 ++
 3 files changed, 231 insertions(+), 42 deletions(-)

--- NEW FILE linux-2.6.31-cpuidle-faster-io.patch ---
Date: 	Tue, 15 Sep 2009 05:42:59 +0200
From: Arjan van de Ven <arjan at infradead.org>
To: linux-kernel at vger.kernel.org
Cc: Andrew Morton <akpm at linux-foundation.org>,
        Arjan van de Ven <arjan at infradead.org>, lenb at kernel.org, mingo at elte.hu,
        yanmin_zhang at linux.intel.com, jens.axboe at oracle.com,
        Ivan Kokshaysky <ink at jurassic.park.msu.ru>
Subject: [PATCH v2] cpuidle: Fix the menu governor to boost IO performance
Message-ID: <20090915054259.5282e5ba at infradead.org>

Reworked patch based on Andrew's review feedback and spelling fixes.
Rather than adding a new governor temporarily, this just puts the fixes
into the existing menu governor.

Andrew: this replaces cpuidle-a-new-variant-of-the-menu-governor-to-boost-io-performance.patch


I don't have a power meter in my hotel room so I've only been able to verify
that the patch functions as before with the timechart tool.
(no major changes were done though, only review feedback)


From: Arjan van de Ven <arjan at linux.intel.com>
Subject: cpuidle: Fix the menu governor to boost IO performance

Fix the menu idle governor which balances power savings, energy efficiency
and performance impact.

The reason for a reworked governor is that there have been serious
performance issues reported with the existing code on Nehalem server
systems.

To show this I'm sure Andrew wants to see benchmark results:
(benchmark is "fio", "no cstates" is using "idle=poll")

		no cstates	current linux	new algorithm
1 disk		107 Mb/s	85 Mb/s		105 Mb/s
2 disks		215 Mb/s	123 Mb/s	209 Mb/s
12 disks	590 Mb/s	320 Mb/s	585 Mb/s

In various power benchmark measurements, no degredation was found by our
measurement&diagnostics team.  Obviously a small percentage more power 
was used in the "fio" benchmark, due to the much higher performance.

While it would be a novel idea to describe the new algorithm in this
commit message, I cheaped out and described it in comments in the code
instead.

[changes since first post: spelling fixes from akpm, review feedback,
folded menu-tng into menu.c]

Signed-off-by: Arjan van de Ven <arjan at linux.intel.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi at intel.com>
Cc: Len Brown <lenb at kernel.org>
Cc: Ingo Molnar <mingo at elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra at chello.nl>
Cc: Yanmin Zhang <yanmin_zhang at linux.intel.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
---
 drivers/cpuidle/governors/menu.c |  251 ++++++++++++++++++++++++++++++++------
 include/linux/sched.h            |    4 +
 kernel/sched.c                   |   15 +++
 3 files changed, 231 insertions(+), 39 deletions(-)

diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index f1df59f..9f3d775 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -2,8 +2,12 @@
  * menu.c - the menu idle governor
  *
  * Copyright (C) 2006-2007 Adam Belay <abelay at novell.com>
+ * Copyright (C) 2009 Intel Corporation
+ * Author:
+ *        Arjan van de Ven <arjan at linux.intel.com>
  *
- * This code is licenced under the GPL.
+ * This code is licenced under the GPL version 2 as described
+ * in the COPYING file that acompanies the Linux Kernel.
  */
 
 #include <linux/kernel.h>
@@ -13,20 +17,153 @@
 #include <linux/ktime.h>
 #include <linux/hrtimer.h>
 #include <linux/tick.h>
+#include <linux/sched.h>
 
-#define BREAK_FUZZ	4	/* 4 us */
-#define PRED_HISTORY_PCT	50
+#define BUCKETS 12
+#define RESOLUTION 1024
+#define DECAY 4
+#define MAX_INTERESTING 50000
+
+/*
+ * Concepts and ideas behind the menu governor
+ *
+ * For the menu governor, there are 3 decision factors for picking a C
+ * state:
+ * 1) Energy break even point
+ * 2) Performance impact
+ * 3) Latency tolerance (from pmqos infrastructure)
+ * These these three factors are treated independently.
+ *
+ * Energy break even point
+ * -----------------------
+ * C state entry and exit have an energy cost, and a certain amount of time in
+ * the  C state is required to actually break even on this cost. CPUIDLE
+ * provides us this duration in the "target_residency" field. So all that we
+ * need is a good prediction of how long we'll be idle. Like the traditional
+ * menu governor, we start with the actual known "next timer event" time.
+ *
+ * Since there are other source of wakeups (interrupts for example) than
+ * the next timer event, this estimation is rather optimistic. To get a
+ * more realistic estimate, a correction factor is applied to the estimate,
+ * that is based on historic behavior. For example, if in the past the actual
+ * duration always was 50% of the next timer tick, the correction factor will
+ * be 0.5.
+ *
+ * menu uses a running average for this correction factor, however it uses a
+ * set of factors, not just a single factor. This stems from the realization
+ * that the ratio is dependent on the order of magnitude of the expected
+ * duration; if we expect 500 milliseconds of idle time the likelihood of
+ * getting an interrupt very early is much higher than if we expect 50 micro
+ * seconds of idle time. A second independent factor that has big impact on
+ * the actual factor is if there is (disk) IO outstanding or not.
+ * (as a special twist, we consider every sleep longer than 50 milliseconds
+ * as perfect; there are no power gains for sleeping longer than this)
+ *
+ * For these two reasons we keep an array of 12 independent factors, that gets
+ * indexed based on the magnitude of the expected duration as well as the
+ * "is IO outstanding" property.
+ *
+ * Limiting Performance Impact
+ * ---------------------------
+ * C states, especially those with large exit latencies, can have a real
+ * noticable impact on workloads, which is not acceptable for most sysadmins,
+ * and in addition, less performance has a power price of its own.
+ *
+ * As a general rule of thumb, menu assumes that the following heuristic
+ * holds:
+ *     The busier the system, the less impact of C states is acceptable
+ *
+ * This rule-of-thumb is implemented using a performance-multiplier:
+ * If the exit latency times the performance multiplier is longer than
+ * the predicted duration, the C state is not considered a candidate
+ * for selection due to a too high performance impact. So the higher
+ * this multiplier is, the longer we need to be idle to pick a deep C
+ * state, and thus the less likely a busy CPU will hit such a deep
+ * C state.
+ *
+ * Two factors are used in determing this multiplier:
+ * a value of 10 is added for each point of "per cpu load average" we have.
+ * a value of 5 points is added for each process that is waiting for
+ * IO on this CPU.
+ * (these values are experimentally determined)
+ *
+ * The load average factor gives a longer term (few seconds) input to the
+ * decision, while the iowait value gives a cpu local instantanious input.
+ * The iowait factor may look low, but realize that this is also already
+ * represented in the system load average.
+ *
+ */
 
 struct menu_device {
 	int		last_state_idx;
 
 	unsigned int	expected_us;
-	unsigned int	predicted_us;
-	unsigned int    current_predicted_us;
-	unsigned int	last_measured_us;
-	unsigned int	elapsed_us;
+	u64		predicted_us;
+	unsigned int	measured_us;
+	unsigned int	exit_us;
+	unsigned int	bucket;
+	u64		correction_factor[BUCKETS];
 };
 
+
+#define LOAD_INT(x) ((x) >> FSHIFT)
+#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
+
+static int get_loadavg(void)
+{
+	unsigned long this = this_cpu_load();
+
+
+	return LOAD_INT(this) * 10 + LOAD_FRAC(this) / 10;
+}
+
+static inline int which_bucket(unsigned int duration)
+{
+	int bucket = 0;
+
+	/*
+	 * We keep two groups of stats; one with no
+	 * IO pending, one without.
+	 * This allows us to calculate
+	 * E(duration)|iowait
+	 */
+	if (nr_iowait_cpu())
+		bucket = BUCKETS/2;
+
+	if (duration < 10)
+		return bucket;
+	if (duration < 100)
+		return bucket + 1;
+	if (duration < 1000)
+		return bucket + 2;
+	if (duration < 10000)
+		return bucket + 3;
+	if (duration < 100000)
+		return bucket + 4;
+	return bucket + 5;
+}
+
+/*
+ * Return a multiplier for the exit latency that is intended
+ * to take performance requirements into account.
+ * The more performance critical we estimate the system
+ * to be, the higher this multiplier, and thus the higher
+ * the barrier to go to an expensive C state.
+ */
+static inline int performance_multiplier(void)
+{
+	int mult = 1;
+
+	/* for higher loadavg, we are more reluctant */
+
+	mult += 2 * get_loadavg();
+
+	/* for IO wait tasks (per cpu!) we add 5x each */
+	mult += 10 * nr_iowait_cpu();
+
+	return mult;
+}
+
 static DEFINE_PER_CPU(struct menu_device, menu_devices);
 
 /**
@@ -38,37 +175,59 @@ static int menu_select(struct cpuidle_device *dev)
 	struct menu_device *data = &__get_cpu_var(menu_devices);
 	int latency_req = pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY);
 	int i;
+	int multiplier;
+
+	data->last_state_idx = 0;
+	data->exit_us = 0;
 
 	/* Special case when user has set very strict latency requirement */
-	if (unlikely(latency_req == 0)) {
-		data->last_state_idx = 0;
+	if (unlikely(latency_req == 0))
 		return 0;
-	}
 
-	/* determine the expected residency time */
+	/* determine the expected residency time, round up */
 	data->expected_us =
-		(u32) ktime_to_ns(tick_nohz_get_sleep_length()) / 1000;
+	    DIV_ROUND_UP((u32)ktime_to_ns(tick_nohz_get_sleep_length()), 1000);
+
+
+	data->bucket = which_bucket(data->expected_us);
+
+	multiplier = performance_multiplier();
+
+	/*
+	 * if the correction factor is 0 (eg first time init or cpu hotplug
+	 * etc), we actually want to start out with a unity factor.
+	 */
+	if (data->correction_factor[data->bucket] == 0)
+		data->correction_factor[data->bucket] = RESOLUTION * DECAY;
+
+	/* Make sure to round up for half microseconds */
+	data->predicted_us = DIV_ROUND_CLOSEST(
+		data->expected_us * data->correction_factor[data->bucket],
+		RESOLUTION * DECAY);
+
+	/*
+	 * We want to default to C1 (hlt), not to busy polling
+	 * unless the timer is happening really really soon.
+	 */
+	if (data->expected_us > 5)
+		data->last_state_idx = CPUIDLE_DRIVER_STATE_START;
 
-	/* Recalculate predicted_us based on prediction_history_pct */
-	data->predicted_us *= PRED_HISTORY_PCT;
-	data->predicted_us += (100 - PRED_HISTORY_PCT) *
-				data->current_predicted_us;
-	data->predicted_us /= 100;
 
 	/* find the deepest idle state that satisfies our constraints */
-	for (i = CPUIDLE_DRIVER_STATE_START + 1; i < dev->state_count; i++) {
+	for (i = CPUIDLE_DRIVER_STATE_START; i < dev->state_count; i++) {
 		struct cpuidle_state *s = &dev->states[i];
 
-		if (s->target_residency > data->expected_us)
-			break;
 		if (s->target_residency > data->predicted_us)
 			break;
 		if (s->exit_latency > latency_req)
 			break;
+		if (s->exit_latency * multiplier > data->predicted_us)
+			break;
+		data->exit_us = s->exit_latency;
+		data->last_state_idx = i;
 	}
 
-	data->last_state_idx = i - 1;
-	return i - 1;
+	return data->last_state_idx;
 }
 
 /**
@@ -85,35 +244,49 @@ static void menu_reflect(struct cpuidle_device *dev)
 	unsigned int last_idle_us = cpuidle_get_last_residency(dev);
 	struct cpuidle_state *target = &dev->states[last_idx];
 	unsigned int measured_us;
+	u64 new_factor;
 
 	/*
 	 * Ugh, this idle state doesn't support residency measurements, so we
 	 * are basically lost in the dark.  As a compromise, assume we slept
-	 * for one full standard timer tick.  However, be aware that this
-	 * could potentially result in a suboptimal state transition.
+	 * for the whole expected time.
 	 */
 	if (unlikely(!(target->flags & CPUIDLE_FLAG_TIME_VALID)))
-		last_idle_us = USEC_PER_SEC / HZ;
+		last_idle_us = data->expected_us;
+
+
+	measured_us = last_idle_us;
 
 	/*
-	 * measured_us and elapsed_us are the cumulative idle time, since the
-	 * last time we were woken out of idle by an interrupt.
+	 * We correct for the exit latency; we are assuming here that the
+	 * exit latency happens after the event that we're interested in.
 	 */
-	if (data->elapsed_us <= data->elapsed_us + last_idle_us)
-		measured_us = data->elapsed_us + last_idle_us;
+	if (measured_us > data->exit_us)
+		measured_us -= data->exit_us;
+
+
+	/* update our correction ratio */
+
+	new_factor = data->correction_factor[data->bucket]
+			* (DECAY - 1) / DECAY;
+
+	if (data->expected_us > 0 && data->measured_us < MAX_INTERESTING)
+		new_factor += RESOLUTION * measured_us / data->expected_us;
 	else
-		measured_us = -1;
+		/*
+		 * we were idle so long that we count it as a perfect
+		 * prediction
+		 */
+		new_factor += RESOLUTION;
 
-	/* Predict time until next break event */
-	data->current_predicted_us = max(measured_us, data->last_measured_us);
+	/*
+	 * We don't want 0 as factor; we always want at least
+	 * a tiny bit of estimated time.
+	 */
+	if (new_factor == 0)
+		new_factor = 1;
 
-	if (last_idle_us + BREAK_FUZZ <
-	    data->expected_us - target->exit_latency) {
-		data->last_measured_us = measured_us;
-		data->elapsed_us = 0;
-	} else {
-		data->elapsed_us = measured_us;
-	}
+	data->correction_factor[data->bucket] = new_factor;
 }
 
 /**
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c0d9944..6b29155 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -140,6 +140,10 @@ extern int nr_processes(void);
 extern unsigned long nr_running(void);
 extern unsigned long nr_uninterruptible(void);
 extern unsigned long nr_iowait(void);
+extern unsigned long nr_iowait_cpu(void);
+extern unsigned long this_cpu_load(void);
+
+
 extern void calc_global_load(void);
 extern u64 cpu_nr_migrations(int cpu);
 
diff --git a/kernel/sched.c b/kernel/sched.c
index c512a02..1e2f1d0 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3064,6 +3064,21 @@ unsigned long nr_iowait(void)
 	return sum;
 }
 
+unsigned long nr_iowait_cpu(void)
+{
+	int this_cpu = smp_processor_id();
+	struct rq *this_rq = cpu_rq(this_cpu);
+	return atomic_read(&this_rq->nr_iowait);
+}
+
+unsigned long this_cpu_load(void)
+{
+	int this_cpu = smp_processor_id();
+	struct rq *this_rq = cpu_rq(this_cpu);
+	return this_rq->cpu_load[0];
+}
+
+
 /* Variables and functions for calc_load */
 static atomic_long_t calc_load_tasks;
 static unsigned long calc_load_update;
-- 
1.6.0.6


-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


ppc-hates-my-family-and-swore-revenge.patch:
 kernel/prom_init_check.sh |    6 ++++++
 lib/crtsavres.S           |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

--- NEW FILE ppc-hates-my-family-and-swore-revenge.patch ---
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index 1ac136b..9f82f49 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -52,12 +52,18 @@ do
 	if [ "${UNDEF:0:9}" = "_restgpr_" ]; then
 		OK=1
 	fi
+	if [ "${UNDEF:0:10}" = "_restgpr0_" ]; then
+		OK=1
+	fi
 	if [ "${UNDEF:0:11}" = "_rest32gpr_" ]; then
 		OK=1
 	fi
 	if [ "${UNDEF:0:9}" = "_savegpr_" ]; then
 		OK=1
 	fi
+	if [ "${UNDEF:0:10}" = "_savegpr0_" ]; then
+		OK=1
+	fi
 	if [ "${UNDEF:0:11}" = "_save32gpr_" ]; then
 		OK=1
 	fi
diff --git a/arch/powerpc/lib/crtsavres.S b/arch/powerpc/lib/crtsavres.S
index 70a9cd8..42ed290 100644
--- a/arch/powerpc/lib/crtsavres.S
+++ b/arch/powerpc/lib/crtsavres.S
@@ -49,57 +49,75 @@
 /* function, just beyond the end of the integer save area.  */
 
 _GLOBAL(_savegpr_14)
+_GLOBAL(_savegpr0_14)
 _GLOBAL(_save32gpr_14)
 	stw	14,-72(11)	/* save gp registers */
 _GLOBAL(_savegpr_15)
+_GLOBAL(_savegpr0_15)
 _GLOBAL(_save32gpr_15)
 	stw	15,-68(11)
 _GLOBAL(_savegpr_16)
+_GLOBAL(_savegpr0_16)
 _GLOBAL(_save32gpr_16)
 	stw	16,-64(11)
 _GLOBAL(_savegpr_17)
+_GLOBAL(_savegpr0_17)
 _GLOBAL(_save32gpr_17)
 	stw	17,-60(11)
 _GLOBAL(_savegpr_18)
+_GLOBAL(_savegpr0_18)
 _GLOBAL(_save32gpr_18)
 	stw	18,-56(11)
 _GLOBAL(_savegpr_19)
+_GLOBAL(_savegpr0_19)
 _GLOBAL(_save32gpr_19)
 	stw	19,-52(11)
 _GLOBAL(_savegpr_20)
+_GLOBAL(_savegpr0_20)
 _GLOBAL(_save32gpr_20)
 	stw	20,-48(11)
 _GLOBAL(_savegpr_21)
+_GLOBAL(_savegpr0_21)
 _GLOBAL(_save32gpr_21)
 	stw	21,-44(11)
 _GLOBAL(_savegpr_22)
+_GLOBAL(_savegpr0_22)
 _GLOBAL(_save32gpr_22)
 	stw	22,-40(11)
 _GLOBAL(_savegpr_23)
+_GLOBAL(_savegpr0_23)
 _GLOBAL(_save32gpr_23)
 	stw	23,-36(11)
 _GLOBAL(_savegpr_24)
+_GLOBAL(_savegpr0_24)
 _GLOBAL(_save32gpr_24)
 	stw	24,-32(11)
 _GLOBAL(_savegpr_25)
+_GLOBAL(_savegpr0_25)
 _GLOBAL(_save32gpr_25)
 	stw	25,-28(11)
 _GLOBAL(_savegpr_26)
+_GLOBAL(_savegpr0_26)
 _GLOBAL(_save32gpr_26)
 	stw	26,-24(11)
 _GLOBAL(_savegpr_27)
+_GLOBAL(_savegpr0_27)
 _GLOBAL(_save32gpr_27)
 	stw	27,-20(11)
 _GLOBAL(_savegpr_28)
+_GLOBAL(_savegpr0_28)
 _GLOBAL(_save32gpr_28)
 	stw	28,-16(11)
 _GLOBAL(_savegpr_29)
+_GLOBAL(_savegpr0_29)
 _GLOBAL(_save32gpr_29)
 	stw	29,-12(11)
 _GLOBAL(_savegpr_30)
+_GLOBAL(_savegpr0_30)
 _GLOBAL(_save32gpr_30)
 	stw	30,-8(11)
 _GLOBAL(_savegpr_31)
+_GLOBAL(_savegpr0_31)
 _GLOBAL(_save32gpr_31)
 	stw	31,-4(11)
 	blr
@@ -109,57 +127,75 @@ _GLOBAL(_save32gpr_31)
 /* function, just beyond the end of the integer restore area.  */
 
 _GLOBAL(_restgpr_14)
+_GLOBAL(_restgpr0_14)
 _GLOBAL(_rest32gpr_14)
 	lwz	14,-72(11)	/* restore gp registers */
 _GLOBAL(_restgpr_15)
+_GLOBAL(_restgpr0_15)
 _GLOBAL(_rest32gpr_15)
 	lwz	15,-68(11)
 _GLOBAL(_restgpr_16)
+_GLOBAL(_restgpr0_16)
 _GLOBAL(_rest32gpr_16)
 	lwz	16,-64(11)
 _GLOBAL(_restgpr_17)
+_GLOBAL(_restgpr0_17)
 _GLOBAL(_rest32gpr_17)
 	lwz	17,-60(11)
 _GLOBAL(_restgpr_18)
+_GLOBAL(_restgpr0_18)
 _GLOBAL(_rest32gpr_18)
 	lwz	18,-56(11)
 _GLOBAL(_restgpr_19)
+_GLOBAL(_restgpr0_19)
 _GLOBAL(_rest32gpr_19)
 	lwz	19,-52(11)
 _GLOBAL(_restgpr_20)
+_GLOBAL(_restgpr0_20)
 _GLOBAL(_rest32gpr_20)
 	lwz	20,-48(11)
 _GLOBAL(_restgpr_21)
+_GLOBAL(_restgpr0_21)
 _GLOBAL(_rest32gpr_21)
 	lwz	21,-44(11)
 _GLOBAL(_restgpr_22)
+_GLOBAL(_restgpr0_22)
 _GLOBAL(_rest32gpr_22)
 	lwz	22,-40(11)
 _GLOBAL(_restgpr_23)
+_GLOBAL(_restgpr0_23)
 _GLOBAL(_rest32gpr_23)
 	lwz	23,-36(11)
 _GLOBAL(_restgpr_24)
+_GLOBAL(_restgpr0_24)
 _GLOBAL(_rest32gpr_24)
 	lwz	24,-32(11)
 _GLOBAL(_restgpr_25)
+_GLOBAL(_restgpr0_25)
 _GLOBAL(_rest32gpr_25)
 	lwz	25,-28(11)
 _GLOBAL(_restgpr_26)
+_GLOBAL(_restgpr0_26)
 _GLOBAL(_rest32gpr_26)
 	lwz	26,-24(11)
 _GLOBAL(_restgpr_27)
+_GLOBAL(_restgpr0_27)
 _GLOBAL(_rest32gpr_27)
 	lwz	27,-20(11)
 _GLOBAL(_restgpr_28)
+_GLOBAL(_restgpr0_28)
 _GLOBAL(_rest32gpr_28)
 	lwz	28,-16(11)
 _GLOBAL(_restgpr_29)
+_GLOBAL(_restgpr0_29)
 _GLOBAL(_rest32gpr_29)
 	lwz	29,-12(11)
 _GLOBAL(_restgpr_30)
+_GLOBAL(_restgpr0_30)
 _GLOBAL(_rest32gpr_30)
 	lwz	30,-8(11)
 _GLOBAL(_restgpr_31)
+_GLOBAL(_restgpr0_31)
 _GLOBAL(_rest32gpr_31)
 	lwz	31,-4(11)
 	blr


Index: Makefile
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/Makefile,v
retrieving revision 1.97.6.6
retrieving revision 1.97.6.7
diff -u -p -r1.97.6.6 -r1.97.6.7
--- Makefile	3 Jul 2009 18:54:45 -0000	1.97.6.6
+++ Makefile	19 Sep 2009 16:47:26 -0000	1.97.6.7
@@ -136,6 +136,9 @@ reconfig:
 force-tag: $(SPECFILE) $(COMMON_DIR)/branches
 	@$(MAKE) tag TAG_OPTS="-F $(TAG_OPTS)"
 
+unused-kernel-patches:
+	@for f in *.patch; do if [ -e $$f ]; then (egrep -q "^Patch[[:digit:]]+:[[:space:]]+$$f" $(SPECFILE) || echo "Unused:    $$f") && egrep -q "^ApplyPatch[[:space:]]+$$f|^ApplyOptionalPatch[[:space:]]+$$f" $(SPECFILE) || echo "Unapplied: $$f"; fi; done
+
 # since i386 isn't a target...
 compile compile-short: DIST_DEFINES += --target $(shell uname -m)
 


Index: config-powerpc64
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/config-powerpc64,v
retrieving revision 1.27.6.4
retrieving revision 1.27.6.5
diff -u -p -r1.27.6.4 -r1.27.6.5
--- config-powerpc64	5 Aug 2009 23:00:09 -0000	1.27.6.4
+++ config-powerpc64	19 Sep 2009 16:47:26 -0000	1.27.6.5
@@ -186,3 +186,5 @@ CONFIG_RCU_FANOUT=64
 
 CONFIG_PERF_COUNTERS=y
 CONFIG_EVENT_PROFILE=y
+
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set

drm-nouveau.patch:
 drivers/gpu/drm/Kconfig                     |   45 
 drivers/gpu/drm/Makefile                    |    2 
 drivers/gpu/drm/drm_bufs.c                  |   28 
 drivers/gpu/drm/i2c/Makefile                |    4 
 drivers/gpu/drm/i2c/ch7006_drv.c            |  532 
 drivers/gpu/drm/i2c/ch7006_mode.c           |  473 
 drivers/gpu/drm/i2c/ch7006_priv.h           |  340 
 drivers/gpu/drm/nouveau/Makefile            |   28 
 drivers/gpu/drm/nouveau/nouveau_acpi.c      |  127 
 drivers/gpu/drm/nouveau/nouveau_backlight.c |  155 
 drivers/gpu/drm/nouveau/nouveau_bios.c      | 5217 ++++++
 drivers/gpu/drm/nouveau/nouveau_bios.h      |  235 
 drivers/gpu/drm/nouveau/nouveau_bo.c        |  622 
 drivers/gpu/drm/nouveau/nouveau_calc.c      |  626 
 drivers/gpu/drm/nouveau/nouveau_channel.c   |  537 
 drivers/gpu/drm/nouveau/nouveau_connector.c |  750 
 drivers/gpu/drm/nouveau/nouveau_connector.h |   55 
 drivers/gpu/drm/nouveau/nouveau_crtc.h      |   95 
 drivers/gpu/drm/nouveau/nouveau_display.c   |  115 
 drivers/gpu/drm/nouveau/nouveau_dma.c       |  206 
 drivers/gpu/drm/nouveau/nouveau_dma.h       |  148 
 drivers/gpu/drm/nouveau/nouveau_drv.c       |  433 
 drivers/gpu/drm/nouveau/nouveau_drv.h       | 1218 +
 drivers/gpu/drm/nouveau/nouveau_encoder.h   |   66 
 drivers/gpu/drm/nouveau/nouveau_fb.h        |   47 
 drivers/gpu/drm/nouveau/nouveau_fbcon.c     |  354 
 drivers/gpu/drm/nouveau/nouveau_fbcon.h     |   48 
 drivers/gpu/drm/nouveau/nouveau_fence.c     |  261 
 drivers/gpu/drm/nouveau/nouveau_gem.c       |  954 +
 drivers/gpu/drm/nouveau/nouveau_hw.c        | 1077 +
 drivers/gpu/drm/nouveau/nouveau_hw.h        |  446 
 drivers/gpu/drm/nouveau/nouveau_i2c.c       |  256 
 drivers/gpu/drm/nouveau/nouveau_i2c.h       |   45 
 drivers/gpu/drm/nouveau/nouveau_ioc32.c     |   72 
 drivers/gpu/drm/nouveau/nouveau_irq.c       |  683 
 drivers/gpu/drm/nouveau/nouveau_mem.c       |  565 
 drivers/gpu/drm/nouveau/nouveau_notifier.c  |  194 
 drivers/gpu/drm/nouveau/nouveau_object.c    | 1279 +
 drivers/gpu/drm/nouveau/nouveau_reg.h       |  833 +
 drivers/gpu/drm/nouveau/nouveau_sgdma.c     |  317 
 drivers/gpu/drm/nouveau/nouveau_state.c     |  834 +
 drivers/gpu/drm/nouveau/nouveau_swmthd.h    |   33 
 drivers/gpu/drm/nouveau/nouveau_ttm.c       |  131 
 drivers/gpu/drm/nouveau/nv04_crtc.c         | 1014 +
 drivers/gpu/drm/nouveau/nv04_cursor.c       |   70 
 drivers/gpu/drm/nouveau/nv04_dac.c          |  525 
 drivers/gpu/drm/nouveau/nv04_dfp.c          |  621 
 drivers/gpu/drm/nouveau/nv04_display.c      |  293 
 drivers/gpu/drm/nouveau/nv04_fb.c           |   21 
 drivers/gpu/drm/nouveau/nv04_fbcon.c        |  295 
 drivers/gpu/drm/nouveau/nv04_fifo.c         |  295 
 drivers/gpu/drm/nouveau/nv04_graph.c        |  583 
 drivers/gpu/drm/nouveau/nv04_instmem.c      |  213 
 drivers/gpu/drm/nouveau/nv04_mc.c           |   20 
 drivers/gpu/drm/nouveau/nv04_timer.c        |   51 
 drivers/gpu/drm/nouveau/nv04_tv.c           |  304 
 drivers/gpu/drm/nouveau/nv10_fb.c           |   24 
 drivers/gpu/drm/nouveau/nv10_fifo.c         |  177 
 drivers/gpu/drm/nouveau/nv10_graph.c        |  945 +
 drivers/gpu/drm/nouveau/nv17_tv.c           |  660 
 drivers/gpu/drm/nouveau/nv17_tv.h           |  156 
 drivers/gpu/drm/nouveau/nv17_tv_modes.c     |  582 
 drivers/gpu/drm/nouveau/nv20_graph.c        |  784 
 drivers/gpu/drm/nouveau/nv40_fb.c           |   62 
 drivers/gpu/drm/nouveau/nv40_fifo.c         |  223 
 drivers/gpu/drm/nouveau/nv40_graph.c        | 2214 ++
 drivers/gpu/drm/nouveau/nv40_mc.c           |   38 
 drivers/gpu/drm/nouveau/nv50_crtc.c         |  799 +
 drivers/gpu/drm/nouveau/nv50_cursor.c       |  151 
 drivers/gpu/drm/nouveau/nv50_dac.c          |  296 
 drivers/gpu/drm/nouveau/nv50_display.c      |  905 +
 drivers/gpu/drm/nouveau/nv50_display.h      |   46 
 drivers/gpu/drm/nouveau/nv50_evo.h          |  113 
 drivers/gpu/drm/nouveau/nv50_fbcon.c        |  256 
 drivers/gpu/drm/nouveau/nv50_fifo.c         |  473 
 drivers/gpu/drm/nouveau/nv50_graph.c        |  450 
 drivers/gpu/drm/nouveau/nv50_grctx.h        |22284 ++++++++++++++++++++++++++++
 drivers/gpu/drm/nouveau/nv50_instmem.c      |  499 
 drivers/gpu/drm/nouveau/nv50_mc.c           |   40 
 drivers/gpu/drm/nouveau/nv50_sor.c          |  250 
 drivers/gpu/drm/nouveau/nvreg.h             |  535 
 drivers/gpu/drm/ttm/ttm_bo.c                |    4 
 include/drm/Kbuild                          |    1 
 include/drm/drmP.h                          |    2 
 include/drm/i2c/ch7006.h                    |   86 
 include/drm/nouveau_drm.h                   |  216 
 86 files changed, 58041 insertions(+), 21 deletions(-)

Index: drm-nouveau.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/drm-nouveau.patch,v
retrieving revision 1.8.6.18
retrieving revision 1.8.6.19
diff -u -p -r1.8.6.18 -r1.8.6.19
--- drm-nouveau.patch	15 Sep 2009 19:45:37 -0000	1.8.6.18
+++ drm-nouveau.patch	19 Sep 2009 16:47:26 -0000	1.8.6.19
@@ -1822,10 +1822,10 @@ index 0000000..20564f8
 +}
 diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
 new file mode 100644
-index 0000000..b37ad94
+index 0000000..305efc3
 --- /dev/null
 +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
-@@ -0,0 +1,5209 @@
+@@ -0,0 +1,5217 @@
 +/*
 + * Copyright 2005-2006 Erik Waling
 + * Copyright 2006 Stephane Marchesin
@@ -6927,6 +6927,11 @@ index 0000000..b37ad94
 +	if (bios->major_version < 5)	/* BMP only */
 +		load_nv17_hw_sequencer_ucode(dev, bios);
 +
++	if (bios->execute) {
++		bios->fp.last_script_invoc = 0;
++		bios->fp.lvds_init_run = false;
++	}
++
 +	parse_init_tables(bios);
 +
 +	/* Runs some additional script seen on G8x VBIOSen.  The VBIOS'
@@ -7016,9 +7021,12 @@ index 0000000..b37ad94
 +		return ret;
 +	}
 +
-+	if (bios->major_version < 5)
-+		/* feature_byte on BMP is poor, but init always sets CR4B */
++	/* feature_byte on BMP is poor, but init always sets CR4B */
++	if (bios->major_version < 5) {
++		bool waslocked = NVLockVgaCrtcs(dev, false);
 +		bios->is_mobile = NVReadVgaCrtc(dev, 0, NV_CIO_CRE_4B) & 0x40;
++		NVLockVgaCrtcs(dev, waslocked);
++	}
 +
 +	/* all BIT systems need p_f_m_t for digital_min_front_porch */
 +	if (bios->is_mobile || bios->major_version >= 5)
@@ -34165,10 +34173,10 @@ index 0000000..6bc0824
 +
 diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c
 new file mode 100644
-index 0000000..9a88a1a
+index 0000000..a96766d
 --- /dev/null
 +++ b/drivers/gpu/drm/nouveau/nv50_graph.c
-@@ -0,0 +1,443 @@
+@@ -0,0 +1,450 @@
 +/*
 + * Copyright (C) 2007 Ben Skeggs.
 + * All Rights Reserved.
@@ -34445,20 +34453,27 @@ index 0000000..9a88a1a
 +{
 +	struct drm_device *dev = chan->dev;
 +	struct drm_nouveau_private *dev_priv = dev->dev_private;
++	int i, hdr = IS_G80 ? 0x200 : 0x20;
++	uint32_t inst;
 +
 +	NV_DEBUG(dev, "ch%d\n", chan->id);
 +
-+	if (chan->ramin && chan->ramin->gpuobj) {
-+		int i, hdr;
-+
-+		hdr = IS_G80 ? 0x200 : 0x20;
-+		dev_priv->engine.instmem.prepare_access(dev, true);
-+		for (i=hdr; i<hdr+24; i+=4)
-+			nv_wo32(dev, chan->ramin->gpuobj, i/4, 0);
-+		dev_priv->engine.instmem.finish_access(dev);
++	if (!chan->ramin || !chan->ramin->gpuobj)
++		return;
 +
-+		nouveau_gpuobj_ref_del(dev, &chan->ramin_grctx);
++	inst = nv_rd32(dev, NV50_PGRAPH_CTXCTL_CUR);
++	if (inst & NV50_PGRAPH_CTXCTL_CUR_LOADED) {
++		inst &= NV50_PGRAPH_CTXCTL_CUR_INSTANCE;
++		if (inst == chan->ramin->instance >> 12)
++			nv_wr32(dev, NV50_PGRAPH_CTXCTL_CUR, inst);
 +	}
++
++	dev_priv->engine.instmem.prepare_access(dev, true);
++	for (i=hdr; i<hdr+24; i+=4)
++		nv_wo32(dev, chan->ramin->gpuobj, i/4, 0);
++	dev_priv->engine.instmem.finish_access(dev);
++
++	nouveau_gpuobj_ref_del(dev, &chan->ramin_grctx);
 +}
 +
 +static int


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1294.2.67
retrieving revision 1.1294.2.68
diff -u -p -r1.1294.2.67 -r1.1294.2.68
--- kernel.spec	15 Sep 2009 23:03:21 -0000	1.1294.2.67
+++ kernel.spec	19 Sep 2009 16:47:28 -0000	1.1294.2.68
@@ -435,7 +435,7 @@ Summary: The Linux kernel
 #
 %define kernel_prereq  fileutils, module-init-tools, initscripts >= 8.11.1-1, kernel-firmware >= %{rpmversion}-%{pkg_release}
 %if %{with_dracut}
-%define initrd_prereq  dracut-kernel >= 001-7
+%define initrd_prereq  dracut >= 001-7
 %else
 %define initrd_prereq  mkinitrd >= 6.0.61-1
 %endif
@@ -667,8 +667,13 @@ Patch611: alsa-tell-user-that-stream-to-
 Patch670: linux-2.6-ata-quirk.patch
 Patch671: linux-2.6-ahci-export-capabilities.patch
 
-Patch680: linux-2.6-rt2x00-asus-leds.patch
-Patch681: linux-2.6-mac80211-age-scan-results-on-resume.patch
+Patch680: linux-2.6-iwlagn-modify-digital-SVR-for-1000.patch
+Patch681: linux-2.6-iwlwifi-update-1000-series-API-version-to-match-firmware.patch
+Patch682: linux-2.6-iwlwifi-Handle-new-firmware-file-with-ucode-build-number-in-header.patch
+Patch683: linux-2.6-iwlwifi-fix-debugfs-buffer-handling.patch
+Patch684: linux-2.6-iwlwifi-traverse-linklist-to-find-the-valid-OTP-block.patch
+Patch685: linux-2.6-iwlwifi-fix-unloading-driver-while-scanning.patch
+Patch686: linux-2.6-iwlwifi-remove-deprecated-6000-series-adapters.patch
 
 Patch700: linux-2.6.31-nx-data.patch
 Patch701: linux-2.6.31-modules-ro-nx.patch
@@ -677,6 +682,10 @@ Patch800: linux-2.6-crash-driver.patch
 
 Patch900: linux-2.6-pci-cacheline-sizing.patch
 
+Patch1000: linux-2.6.31-cpufreq-powernow-k8-oops.patch
+
+Patch1100: linux-2.6.31-cpuidle-faster-io.patch
+
 Patch1515: lirc-2.6.31.patch
 Patch1517: hdpvr-ir-enable.patch
 Patch1518: hid-ignore-all-recent-imon-devices.patch
@@ -698,10 +707,10 @@ Patch1813: drm-radeon-pm.patch
 Patch1814: drm-nouveau.patch
 Patch1818: drm-i915-resume-force-mode.patch
 Patch1819: drm-intel-big-hammer.patch
-Patch1821: drm-page-flip.patch
 # intel drm is all merged upstream
 Patch1824: drm-intel-next.patch
 Patch1825: drm-intel-pm.patch
+Patch1826: drm-intel-no-tv-hotplug.patch
 
 # vga arb
 Patch1900: linux-2.6-vga-arb.patch
@@ -738,12 +747,17 @@ Patch12010: linux-2.6-dell-laptop-rfkill
 Patch12011: linux-2.6-block-silently-error-unsupported-empty-barriers-too.patch
 Patch12012: linux-2.6-rtc-show-hctosys.patch
 Patch12013: linux-2.6-rfkill-all.patch
+Patch12014: linux-2.6-selinux-module-load-perms.patch
+
+Patch13000: ppc-hates-my-family-and-swore-revenge.patch
 
 # patches headed for -stable
 
 # scsi oops fixes
 Patch14000: linux-2.6-scsi-sd-fix-oops-during-scanning.patch
 Patch14001: linux-2.6-scsi-sg-fix-oops-in-error-path.patch
+# Raid10 lockdep fix
+Patch14002: linux-2.6-raidlockdep.patch
 
 Patch19997: xen.pvops.pre.patch
 Patch19998: xen.pvops.patch
@@ -1156,8 +1170,8 @@ ApplyOptionalPatch linux-2.6-compile-fix
 # revert patches from upstream that conflict or that we get via other means
 ApplyOptionalPatch linux-2.6-upstream-reverts.patch -R
 
-#ApplyPatch git-cpufreq.patch
-#ApplyPatch git-bluetooth.patch
+ApplyOptionalPatch git-cpufreq.patch
+#ApplyOptionalPatch git-bluetooth.patch
 
 ApplyPatch linux-2.6-hotfixes.patch
 
@@ -1306,11 +1320,16 @@ ApplyPatch linux-2.6-ata-quirk.patch
 # Make it possible to identify non-hotplug SATA ports
 ApplyPatch linux-2.6-ahci-export-capabilities.patch
 
-# rt2x00: back-port activity LED init patches
-#ApplyPatch linux-2.6-rt2x00-asus-leds.patch
+# iwl1000 support patches
+ApplyPatch linux-2.6-iwlagn-modify-digital-SVR-for-1000.patch
+ApplyPatch linux-2.6-iwlwifi-Handle-new-firmware-file-with-ucode-build-number-in-header.patch
+ApplyPatch linux-2.6-iwlwifi-update-1000-series-API-version-to-match-firmware.patch
+ApplyPatch linux-2.6-iwlwifi-fix-debugfs-buffer-handling.patch
+ApplyPatch linux-2.6-iwlwifi-traverse-linklist-to-find-the-valid-OTP-block.patch
+ApplyPatch linux-2.6-iwlwifi-fix-unloading-driver-while-scanning.patch
 
-# back-port scan result aging patches
-#ApplyPatch linux-2.6-mac80211-age-scan-results-on-resume.patch
+# remove support for deprecated iwl6000 parts
+ApplyPatch linux-2.6-iwlwifi-remove-deprecated-6000-series-adapters.patch
 
 # Mark kernel data as NX
 ApplyPatch linux-2.6.31-nx-data.patch
@@ -1323,6 +1342,12 @@ ApplyPatch linux-2.6-crash-driver.patch
 # Determine cacheline sizes in a generic manner.
 ApplyPatch linux-2.6-pci-cacheline-sizing.patch
 
+# fix upstream bug #13780
+ApplyPatch linux-2.6.31-cpufreq-powernow-k8-oops.patch
+
+# cpuidle: Fix the menu governor to boost IO performance
+ApplyPatch linux-2.6.31-cpuidle-faster-io.patch
+
 # http://www.lirc.org/
 ApplyPatch lirc-2.6.31.patch
 # enable IR receiver on Hauppauge HD PVR (v4l-dvb merge pending)
@@ -1357,10 +1382,10 @@ ApplyPatch drm-nouveau.patch
 #ApplyPatch drm-radeon-pm.patch
 ApplyPatch drm-i915-resume-force-mode.patch
 ApplyPatch drm-intel-big-hammer.patch
-ApplyPatch drm-page-flip.patch
 ApplyOptionalPatch drm-intel-next.patch
 #this appears to be upstream - mjg59?
 #ApplyPatch drm-intel-pm.patch
+ApplyPatch drm-intel-no-tv-hotplug.patch
 
 # VGA arb + drm
 ApplyPatch linux-2.6-vga-arb.patch
@@ -1383,12 +1408,17 @@ ApplyPatch v4l-dvb-fix-cx25840-firmware-
 # Patches headed upstream
 ApplyPatch linux-2.6-rtc-show-hctosys.patch
 ApplyPatch linux-2.6-rfkill-all.patch
+ApplyPatch linux-2.6-selinux-module-load-perms.patch
+
+#ApplyPatch ppc-hates-my-family-and-swore-revenge.patch
 
 # patches headed for -stable
 
 # scsi oops fixes
 ApplyPatch linux-2.6-scsi-sd-fix-oops-during-scanning.patch
 ApplyPatch linux-2.6-scsi-sg-fix-oops-in-error-path.patch
+# Raid10 lockdep fix
+ApplyPatch linux-2.6-raidlockdep.patch
 
 ApplyPatch xen.pvops.pre.patch
 ApplyPatch xen.pvops.patch
@@ -1485,7 +1515,7 @@ BuildKernel() {
 
     cat >> Makefile <<\EOF
 # XXX temp workaround for https://bugzilla.redhat.com/show_bug.cgi?id=521991
-KBUILD_CFLAGS += -fno-var-tracking-assignments
+KBUILD_CFLAGS += $(call cc-option,-fno-var-tracking-assignments)
 EOF
 
     # if pre-rc1 devel kernel, must fix up SUBLEVEL for our versioning scheme
@@ -2006,7 +2036,7 @@ fi
 %endif\
 /lib/modules/%{KVERREL}%{?2:.%{2}}/modules.*\
 %if %{with_dracut}\
-%ghost /boot/dracut-%{KVERREL}%{?2:.%{2}}.img\
+%ghost /boot/initramfs-%{KVERREL}%{?2:.%{2}}.img\
 %else\
 %ghost /boot/initrd-%{KVERREL}%{?2:.%{2}}.img\
 %endif\
@@ -2049,6 +2079,53 @@ fi
 # and build.
 
 %changelog
+* Sat Sep 19 2009 Michael Young <m.a.young at durham.ac.uk>
+- Switch pvops from rebase/master to xen/master branch
+
+* Fri Sep 18 2009 Dave Jones <davej at redhat.com>
+- %ghost the dracut initramfs file.
+
+* Thu Sep 17 2009 Hans de Goede <hdegoede at redhat.com>
+- Now that we have %%post generation of dracut images we do not need to
+  Require dracut-kernel anymore
+
+* Thu Sep 17 2009 Kyle McMartin <kyle at redhat.com> 2.6.31-33
+- Turn off CONFIG_CC_OPTIMIZE_FOR_SIZE on ppc64 until ld decides to play nice
+  and generate the save/restore stubs.
+
+* Thu Sep 17 2009 Kristian Høgsberg <krh at redhat.com>
+- Drop drm page-flip patch for F12.
+
+* Thu Sep 17 2009 Dave Jones <davej at redhat.com>
+- cpuidle: Fix the menu governor to boost IO performance.
+
+* Wed Sep 16 2009 John W. Linville <linville at redhat.com>
+- Add a few more iwl1000 support patches.
+- Remove support for deprecated iwl6000 parts.
+
+* Wed Sep 16 2009 Eric Paris <eparis at redhat.com>
+- Do not check CAP_SYS_MODULE when networking tres to autoload a module
+
+* Wed Sep 16 2009 John W. Linville <linville at redhat.com>
+- Add iwl1000 support patches.
+
+* Wed Sep 16 2009 Adam Jackson <ajax at redhat.com>
+- Disable hotplug interrupts on TV connectors on i915.
+
+* Wed Sep 16 2009 Dave Jones <davej at redhat.com>
+- Fix NULL deref in powernow-k8 driver. (korg #13780)
+
+* Wed Sep 16 2009 Hans de Goede <hdegoede at redhat.com>
+- Fix lockdep warning (and potential real deadlock) in mdraid10 code,
+  requested for -stable, rh#515471
+
+* Wed Sep 16 2009 Ben Skeggs <bskeggs at redhat.com> 2.6.31-17
+- nouveau: potential fix for rh#522649 + misc other fixes
+
+* Tue Sep 15 2009 Chuck Ebbert <cebbert at redhat.com>
+- Add unused-kernel-patches Make target, change some patches to
+  use ApplyOptionalPatch
+
 * Tue Sep 15 2009 Michael Young <m.a.young at durham.ac.uk>
 - switch to the F-12 branch for the moment
 - try an NX related fix

xen.pvops.patch:
 arch/x86/Kconfig                           |    4 
 arch/x86/Makefile                          |    2 
 arch/x86/include/asm/agp.h                 |   15 
 arch/x86/include/asm/e820.h                |    2 
 arch/x86/include/asm/i387.h                |    1 
 arch/x86/include/asm/io.h                  |   15 
 arch/x86/include/asm/io_apic.h             |    7 
 arch/x86/include/asm/microcode.h           |    9 
 arch/x86/include/asm/paravirt.h            |  718 ------------
 arch/x86/include/asm/paravirt_types.h      |  722 +++++++++++++
 arch/x86/include/asm/pci.h                 |    8 
 arch/x86/include/asm/pci_x86.h             |    2 
 arch/x86/include/asm/pgtable.h             |    3 
 arch/x86/include/asm/processor.h           |    4 
 arch/x86/include/asm/tlbflush.h            |    6 
 arch/x86/include/asm/xen/hypercall.h       |   44 
 arch/x86/include/asm/xen/interface.h       |    8 
 arch/x86/include/asm/xen/interface_32.h    |    5 
 arch/x86/include/asm/xen/interface_64.h    |   13 
 arch/x86/include/asm/xen/iommu.h           |   12 
 arch/x86/include/asm/xen/page.h            |   16 
 arch/x86/include/asm/xen/pci.h             |   37 
 arch/x86/include/asm/xen/swiotlb.h         |   10 
 arch/x86/kernel/Makefile                   |    1 
 arch/x86/kernel/acpi/boot.c                |   18 
 arch/x86/kernel/acpi/processor.c           |    4 
 arch/x86/kernel/acpi/sleep.c               |    2 
 arch/x86/kernel/apic/io_apic.c             |   49 
 arch/x86/kernel/cpu/mtrr/Makefile          |    1 
 arch/x86/kernel/cpu/mtrr/amd.c             |    6 
 arch/x86/kernel/cpu/mtrr/centaur.c         |    6 
 arch/x86/kernel/cpu/mtrr/cyrix.c           |    6 
 arch/x86/kernel/cpu/mtrr/generic.c         |   10 
 arch/x86/kernel/cpu/mtrr/main.c            |   19 
 arch/x86/kernel/cpu/mtrr/mtrr.h            |   11 
 arch/x86/kernel/cpu/mtrr/xen.c             |  104 +
 arch/x86/kernel/e820.c                     |   30 
 arch/x86/kernel/ioport.c                   |   29 
 arch/x86/kernel/microcode_core.c           |    5 
 arch/x86/kernel/microcode_xen.c            |  200 +++
 arch/x86/kernel/paravirt.c                 |    1 
 arch/x86/kernel/pci-dma.c                  |    6 
 arch/x86/kernel/pci-swiotlb.c              |   25 
 arch/x86/kernel/process.c                  |   27 
 arch/x86/kernel/process_32.c               |   27 
 arch/x86/kernel/process_64.c               |   33 
 arch/x86/kernel/setup.c                    |    4 
 arch/x86/kernel/traps.c                    |   33 
 arch/x86/mm/Makefile                       |    7 
 arch/x86/mm/init_32.c                      |   42 
 arch/x86/mm/ioremap.c                      |   72 -
 arch/x86/mm/pat.c                          |    2 
 arch/x86/mm/pgtable.c                      |   10 
 arch/x86/mm/physaddr.c                     |   70 +
 arch/x86/mm/physaddr.h                     |   10 
 arch/x86/mm/tlb.c                          |   35 
 arch/x86/pci/Makefile                      |    1 
 arch/x86/pci/common.c                      |   18 
 arch/x86/pci/i386.c                        |    3 
 arch/x86/pci/init.c                        |    6 
 arch/x86/pci/xen.c                         |   51 
 arch/x86/xen/Kconfig                       |   33 
 arch/x86/xen/Makefile                      |    5 
 arch/x86/xen/apic.c                        |   57 +
 arch/x86/xen/enlighten.c                   |  220 +++
 arch/x86/xen/mmu.c                         |  455 ++++++++
 arch/x86/xen/pci-swiotlb.c                 |  989 +++++++++++++++++
 arch/x86/xen/pci.c                         |  111 ++
 arch/x86/xen/setup.c                       |  108 +
 arch/x86/xen/smp.c                         |    3 
 arch/x86/xen/spinlock.c                    |   28 
 arch/x86/xen/time.c                        |    2 
 arch/x86/xen/vga.c                         |   67 +
 arch/x86/xen/xen-ops.h                     |   19 
 block/blk-core.c                           |    2 
 drivers/acpi/acpica/hwsleep.c              |   17 
 drivers/acpi/processor_core.c              |   29 
 drivers/acpi/processor_idle.c              |   23 
 drivers/acpi/processor_perflib.c           |   10 
 drivers/acpi/sleep.c                       |   19 
 drivers/block/Kconfig                      |    1 
 drivers/char/agp/intel-agp.c               |   17 
 drivers/char/hvc_xen.c                     |   99 +
 drivers/net/Kconfig                        |    1 
 drivers/pci/Makefile                       |    2 
 drivers/pci/msi.c                          |    5 
 drivers/pci/xen-iommu.c                    |  271 ++++
 drivers/xen/Kconfig                        |   41 
 drivers/xen/Makefile                       |   23 
 drivers/xen/acpi.c                         |   23 
 drivers/xen/acpi_processor.c               |  451 ++++++++
 drivers/xen/balloon.c                      |  161 ++
 drivers/xen/biomerge.c                     |   14 
 drivers/xen/blkback/Makefile               |    3 
 drivers/xen/blkback/blkback.c              |  657 +++++++++++
 drivers/xen/blkback/common.h               |  137 ++
 drivers/xen/blkback/interface.c            |  182 +++
 drivers/xen/blkback/vbd.c                  |  118 ++
 drivers/xen/blkback/xenbus.c               |  542 +++++++++
 drivers/xen/events.c                       |  422 +++++++
 drivers/xen/evtchn.c                       |    1 
 drivers/xen/features.c                     |    2 
 drivers/xen/grant-table.c                  |  103 +
 drivers/xen/mce.c                          |  213 +++
 drivers/xen/netback/Makefile               |    3 
 drivers/xen/netback/common.h               |  221 ++++
 drivers/xen/netback/interface.c            |  401 +++++++
 drivers/xen/netback/netback.c              | 1602 +++++++++++++++++++++++++++++
 drivers/xen/netback/xenbus.c               |  454 ++++++++
 drivers/xen/pci.c                          |  124 ++
 drivers/xen/xenbus/Makefile                |    5 
 drivers/xen/xenbus/xenbus_comms.c          |    1 
 drivers/xen/xenbus/xenbus_probe.c          |  380 +-----
 drivers/xen/xenbus/xenbus_probe.h          |   29 
 drivers/xen/xenbus/xenbus_probe_backend.c  |  298 +++++
 drivers/xen/xenbus/xenbus_probe_frontend.c |  292 +++++
 drivers/xen/xenfs/Makefile                 |    3 
 drivers/xen/xenfs/privcmd.c                |  403 +++++++
 drivers/xen/xenfs/super.c                  |   98 +
 drivers/xen/xenfs/xenfs.h                  |    3 
 drivers/xen/xenfs/xenstored.c              |   67 +
 include/acpi/processor.h                   |    2 
 include/asm-generic/pci.h                  |    2 
 include/linux/interrupt.h                  |    1 
 include/linux/page-flags.h                 |   18 
 include/xen/Kbuild                         |    1 
 include/xen/acpi.h                         |   84 +
 include/xen/balloon.h                      |    8 
 include/xen/blkif.h                        |  122 ++
 include/xen/events.h                       |   27 
 include/xen/grant_table.h                  |   43 
 include/xen/interface/grant_table.h        |   22 
 include/xen/interface/memory.h             |   92 +
 include/xen/interface/physdev.h            |   51 
 include/xen/interface/platform.h           |  336 ++++++
 include/xen/interface/xen-mca.h            |  429 +++++++
 include/xen/interface/xen.h                |   44 
 include/xen/privcmd.h                      |   80 +
 include/xen/swiotlb.h                      |  102 +
 include/xen/xen-ops.h                      |   11 
 include/xen/xenbus.h                       |    2 
 kernel/irq/manage.c                        |    3 
 lib/swiotlb.c                              |    5 
 mm/page_alloc.c                            |   14 
 144 files changed, 12784 insertions(+), 1432 deletions(-)

Index: xen.pvops.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/Attic/xen.pvops.patch,v
retrieving revision 1.1.2.42
retrieving revision 1.1.2.43
diff -u -p -r1.1.2.42 -r1.1.2.43
--- xen.pvops.patch	15 Sep 2009 19:45:40 -0000	1.1.2.42
+++ xen.pvops.patch	19 Sep 2009 16:47:29 -0000	1.1.2.43
@@ -2042,19 +2042,17 @@ index 0000000..cb84abe
 +#endif	/* _ASM_X86_XEN_PCI_H */
 diff --git a/arch/x86/include/asm/xen/swiotlb.h b/arch/x86/include/asm/xen/swiotlb.h
 new file mode 100644
-index 0000000..81d8502
+index 0000000..d094f89
 --- /dev/null
 +++ b/arch/x86/include/asm/xen/swiotlb.h
-@@ -0,0 +1,12 @@
+@@ -0,0 +1,10 @@
 +#ifndef _ASM_X86_XEN_SWIOTLB_H
 +#define _ASM_X86_XEN_SWIOTLB_H
 +
 +#ifdef CONFIG_PCI_XEN
-+extern int xen_swiotlb_init(void);
-+extern void xen_swiotlb_init_alloc(void);
++extern void xen_swiotlb_init(void);
 +#else
-+static inline int xen_swiotlb_init(void) { return -ENODEV; }
-+static void xen_swiotlb_init_alloc(void) { }
++static void xen_swiotlb_init(void) { }
 +#endif
 +
 +#endif
@@ -2420,7 +2418,7 @@ index 8fc248b..072eeda 100644
  		if (use_intel()) {
  			get_mtrr_state();
 diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.h b/arch/x86/kernel/cpu/mtrr/mtrr.h
-index 7538b76..1e035d3 100644
+index 7538b76..012be50 100644
 --- a/arch/x86/kernel/cpu/mtrr/mtrr.h
 +++ b/arch/x86/kernel/cpu/mtrr/mtrr.h
 @@ -5,6 +5,8 @@
@@ -2445,7 +2443,7 @@ index 7538b76..1e035d3 100644
  int amd_init_mtrr(void);
  int cyrix_init_mtrr(void);
  int centaur_init_mtrr(void);
-+#ifdef CONFIG_XEN
++#ifdef CONFIG_XEN_DOM0
 +void xen_init_mtrr(void);
 +#else
 +static inline void xen_init_mtrr(void)
@@ -2913,7 +2911,7 @@ index 70ec9b9..cef3d70 100644
  
  	.start_context_switch = paravirt_nop,
 diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
-index 1a041bc..90da583 100644
+index 1a041bc..6b76948 100644
 --- a/arch/x86/kernel/pci-dma.c
 +++ b/arch/x86/kernel/pci-dma.c
 @@ -10,6 +10,8 @@
@@ -2929,19 +2927,17 @@ index 1a041bc..90da583 100644
  
  	amd_iommu_detect();
  
-+	xen_swiotlb_init_alloc();
++	xen_swiotlb_init();
 +
  	pci_swiotlb_init();
  }
  
-@@ -281,6 +285,10 @@ static int __init pci_iommu_init(void)
+@@ -281,6 +285,8 @@ static int __init pci_iommu_init(void)
  	dma_debug_add_bus(&pci_bus_type);
  #endif
  
 +	xen_iommu_init();
 +
-+	xen_swiotlb_init();
-+
  	calgary_iommu_init();
  
  	intel_iommu_init();
@@ -3230,10 +3226,10 @@ index 5204332..22a5a6d 100644
  EXPORT_SYMBOL_GPL(math_state_restore);
  
 diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
-index eefdeee..9b5a9f5 100644
+index eefdeee..dd313d0 100644
 --- a/arch/x86/mm/Makefile
 +++ b/arch/x86/mm/Makefile
-@@ -1,5 +1,9 @@
+@@ -1,5 +1,10 @@
  obj-y	:=  init.o init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \
 -	    pat.o pgtable.o gup.o
 +	    pat.o pgtable.o physaddr.o gup.o
@@ -3241,6 +3237,7 @@ index eefdeee..9b5a9f5 100644
 +# Make sure __phys_addr has no stackprotector
 +nostackp := $(call cc-option, -fno-stack-protector)
 +CFLAGS_physaddr.o		:= $(nostackp)
++CFLAGS_init.o			:= $(nostackp)
  
  obj-$(CONFIG_SMP)		+= tlb.o
  
@@ -3881,7 +3878,7 @@ index 0000000..ee0db39
 +#endif
 +}
 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
-index eb33aaa..7119d45 100644
+index eb33aaa..44576cb 100644
 --- a/arch/x86/xen/enlighten.c
 +++ b/arch/x86/xen/enlighten.c
 @@ -51,6 +51,7 @@
@@ -4025,7 +4022,7 @@ index eb33aaa..7119d45 100644
 +
 +		pte = pfn_pte(pfn, PAGE_KERNEL_RO);
 +
-+		if (HYPERVISOR_update_va_mapping((unsigned long)va, pte, 0))
++		if (HYPERVISOR_update_va_mapping(va, pte, 0))
 +			BUG();
 +
 +		frames[f] = mfn;
@@ -4038,7 +4035,23 @@ index eb33aaa..7119d45 100644
  static void load_TLS_descriptor(struct thread_struct *t,
  				unsigned int cpu, unsigned int i)
  {
-@@ -581,6 +647,29 @@ static void xen_write_gdt_entry(struct desc_struct *dt, int entry,
+@@ -461,11 +527,10 @@ static int cvt_gate_to_trap(int vector, const gate_desc *val,
+ 	} else if (addr == (unsigned long)machine_check) {
+ 		return 0;
+ #endif
+-	} else {
+-		/* Some other trap using IST? */
+-		if (WARN_ON(val->ist != 0))
+-			return 0;
+-	}
++	} else if (WARN(val->ist != 0,
++			"Unknown IST-using trap: vector %d, %pF, val->ist=%d\n",
++			vector, (void *)addr, val->ist))
++		return 0;
+ #endif	/* CONFIG_X86_64 */
+ 	info->address = addr;
+ 
+@@ -581,6 +646,29 @@ static void xen_write_gdt_entry(struct desc_struct *dt, int entry,
  	preempt_enable();
  }
  
@@ -4068,7 +4081,7 @@ index eb33aaa..7119d45 100644
  static void xen_load_sp0(struct tss_struct *tss,
  			 struct thread_struct *thread)
  {
-@@ -598,6 +687,18 @@ static void xen_set_iopl_mask(unsigned mask)
+@@ -598,6 +686,18 @@ static void xen_set_iopl_mask(unsigned mask)
  	HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
  }
  
@@ -4087,7 +4100,7 @@ index eb33aaa..7119d45 100644
  static void xen_io_delay(void)
  {
  }
-@@ -635,7 +736,7 @@ static u32 xen_safe_apic_wait_icr_idle(void)
+@@ -635,7 +735,7 @@ static u32 xen_safe_apic_wait_icr_idle(void)
          return 0;
  }
  
@@ -4096,7 +4109,15 @@ index eb33aaa..7119d45 100644
  {
  	apic->read = xen_apic_read;
  	apic->write = xen_apic_write;
-@@ -907,6 +1008,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
+@@ -647,7 +747,6 @@ static void set_xen_basic_apic_ops(void)
+ 
+ #endif
+ 
+-
+ static void xen_clts(void)
+ {
+ 	struct multicall_space mcs;
+@@ -907,6 +1006,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
  	.load_sp0 = xen_load_sp0,
  
  	.set_iopl_mask = xen_set_iopl_mask,
@@ -4104,7 +4125,7 @@ index eb33aaa..7119d45 100644
  	.io_delay = xen_io_delay,
  
  	/* Xen takes care of %gs when switching to usermode for us */
-@@ -965,6 +1067,23 @@ static const struct machine_ops __initdata xen_machine_ops = {
+@@ -965,6 +1065,23 @@ static const struct machine_ops __initdata xen_machine_ops = {
  	.emergency_restart = xen_emergency_restart,
  };
  
@@ -4128,7 +4149,7 @@ index eb33aaa..7119d45 100644
  /* First C function to be called on Xen boot */
  asmlinkage void __init xen_start_kernel(void)
  {
-@@ -983,13 +1102,28 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -983,14 +1100,34 @@ asmlinkage void __init xen_start_kernel(void)
  	pv_apic_ops = xen_apic_ops;
  	pv_mmu_ops = xen_mmu_ops;
  
@@ -4140,7 +4161,6 @@ index eb33aaa..7119d45 100644
 +	 * Set up some pagetable state before starting to set any ptes.
  	 */
 -	load_percpu_segment(0);
--#endif
 +
 +	/* Prevent unwanted bits from being set in PTEs. */
 +	__supported_pte_mask &= ~_PAGE_GLOBAL;
@@ -4149,6 +4169,11 @@ index eb33aaa..7119d45 100644
 +
 +	__supported_pte_mask |= _PAGE_IOMAP;
 +
++#ifdef CONFIG_X86_64
++	/* Work out if we support NX */
++	check_efer();
+ #endif
+ 
 +	xen_setup_features();
 +
 +	/* Get mfn list */
@@ -4160,10 +4185,11 @@ index eb33aaa..7119d45 100644
 +	 * -fstack-protector code can be executed.
 +	 */
 +	xen_setup_stackprotector();
- 
++
  	xen_init_irq_ops();
  	xen_init_cpuid_mask();
-@@ -1001,7 +1135,7 @@ asmlinkage void __init xen_start_kernel(void)
+ 
+@@ -1001,7 +1138,7 @@ asmlinkage void __init xen_start_kernel(void)
  	set_xen_basic_apic_ops();
  #endif
  
@@ -4172,7 +4198,7 @@ index eb33aaa..7119d45 100644
  
  	if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) {
  		pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start;
-@@ -1019,17 +1153,8 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1019,22 +1156,8 @@ asmlinkage void __init xen_start_kernel(void)
  
  	xen_smp_init();
  
@@ -4187,10 +4213,15 @@ index eb33aaa..7119d45 100644
 -	if (!xen_initial_domain())
 -		__supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
 -
- #ifdef CONFIG_X86_64
- 	/* Work out if we support NX */
- 	check_efer();
-@@ -1044,6 +1169,7 @@ asmlinkage void __init xen_start_kernel(void)
+-#ifdef CONFIG_X86_64
+-	/* Work out if we support NX */
+-	check_efer();
+-#endif
+-
+ 	/* Don't do the full vcpu_info placement stuff until we have a
+ 	   possible map and a non-dummy shared_info. */
+ 	per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
+@@ -1044,6 +1167,7 @@ asmlinkage void __init xen_start_kernel(void)
  
  	xen_raw_console_write("mapping kernel into physical memory\n");
  	pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages);
@@ -4198,7 +4229,7 @@ index eb33aaa..7119d45 100644
  
  	init_mm.pgd = pgd;
  
-@@ -1053,9 +1179,21 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1053,9 +1177,21 @@ asmlinkage void __init xen_start_kernel(void)
  	if (xen_feature(XENFEAT_supervisor_mode_kernel))
  		pv_info.kernel_rpl = 0;
  
@@ -4220,7 +4251,7 @@ index eb33aaa..7119d45 100644
  #ifdef CONFIG_X86_32
  	/* set up basic CPUID stuff */
  	cpu_detect(&new_cpu_data);
-@@ -1075,6 +1213,16 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1075,6 +1211,16 @@ asmlinkage void __init xen_start_kernel(void)
  		add_preferred_console("xenboot", 0, NULL);
  		add_preferred_console("tty", 0, NULL);
  		add_preferred_console("hvc", 0, NULL);
@@ -4845,10 +4876,10 @@ index 4ceb285..a654a49 100644
  static struct dentry *d_mmu_debug;
 diff --git a/arch/x86/xen/pci-swiotlb.c b/arch/x86/xen/pci-swiotlb.c
 new file mode 100644
-index 0000000..19b78e2
+index 0000000..5e2c856
 --- /dev/null
 +++ b/arch/x86/xen/pci-swiotlb.c
-@@ -0,0 +1,988 @@
+@@ -0,0 +1,989 @@
 +/*
 + * Dynamic DMA mapping support.
 + *
@@ -5195,8 +5226,15 @@ index 0000000..19b78e2
 +	return swiotlb_force || xen_swiotlb_arch_range_needs_mapping(paddr, size);
 +}
 +
-+static int is_xen_swiotlb_buffer(char *addr)
++static int is_xen_swiotlb_buffer(dma_addr_t dma_addr)
 +{
++	unsigned long mfn = PFN_DOWN(dma_addr);
++	unsigned long pfn = mfn_to_local_pfn(mfn);
++	char *addr = NULL;
++
++	if (pfn_valid(pfn))
++		addr = __va(pfn << PAGE_SHIFT);
++
 +	return addr >= xen_io_tlb_start && addr < xen_io_tlb_end;
 +}
 +
@@ -5351,7 +5389,8 @@ index 0000000..19b78e2
 + * dma_addr is the kernel virtual address of the bounce buffer to unmap.
 + */
 +static void
-+do_unmap_single(struct device *hwdev, char *dma_addr, size_t size, int dir)
++do_unmap_single(struct device *hwdev, char *dma_addr, size_t size,
++		enum dma_data_direction dir)
 +{
 +	unsigned long flags;
 +	int i, count, nslots = ALIGN(size, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
@@ -5546,13 +5585,13 @@ index 0000000..19b78e2
 + * whatever the device wrote there.
 + */
 +static void unmap_single(struct device *hwdev, dma_addr_t dev_addr,
-+			 size_t size, int dir)
++			 size_t size, enum dma_data_direction dir)
 +{
 +	char *dma_addr = xen_swiotlb_bus_to_virt(hwdev, dev_addr);
 +
 +	BUG_ON(dir == DMA_NONE);
 +
-+	if (is_xen_swiotlb_buffer(dma_addr)) {
++ 	if (is_xen_swiotlb_buffer(dev_addr)) {
 +		do_unmap_single(hwdev, dma_addr, size, dir);
 +		return;
 +	}
@@ -5588,7 +5627,7 @@ index 0000000..19b78e2
 +
 +	BUG_ON(dir == DMA_NONE);
 +
-+	if (is_xen_swiotlb_buffer(dma_addr)) {
++	if (is_xen_swiotlb_buffer(dev_addr)) {
 +		sync_single(hwdev, dma_addr, size, dir, target);
 +		return;
 +	}
@@ -5821,20 +5860,13 @@ index 0000000..19b78e2
 +	.dma_supported = NULL,
 +};
 +
-+int __init xen_swiotlb_init(void)
-+{
-+	if (xen_pv_domain() && xen_initial_domain()) {
-+		iommu_detected = 1;
-+		return 0;
-+	}
-+	return -ENODEV;
-+}
-+void __init xen_swiotlb_init_alloc(void)
++void __init xen_swiotlb_init(void)
 +{
-+	if (xen_pv_domain() && xen_initial_domain()) {
++	if (xen_initial_domain()) {
 +		printk(KERN_INFO "PCI-DMA: Using Xen software bounce buffering for IO (Xen-SWIOTLB)\n");
 +		xen_swiotlb_init_with_default_size(64 * (1<<20));	/* default to 64MB */
 +		dma_ops = &xen_swiotlb_dma_ops;
++		iommu_detected = 1;
 +	}
 +}
 diff --git a/arch/x86/xen/pci.c b/arch/x86/xen/pci.c
@@ -5955,36 +5987,94 @@ index 0000000..44d91ad
 +}
 +#endif
 diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
-index ad0047f..2439456 100644
+index ad0047f..5eeeedb 100644
 --- a/arch/x86/xen/setup.c
 +++ b/arch/x86/xen/setup.c
-@@ -19,6 +19,7 @@
+@@ -19,7 +19,9 @@
  
  #include <xen/page.h>
  #include <xen/interface/callback.h>
 +#include <xen/interface/memory.h>
  #include <xen/interface/physdev.h>
++#include <xen/interface/memory.h>
  #include <xen/features.h>
  
-@@ -36,21 +37,62 @@ extern void xen_syscall32_target(void);
+ #include "xen-ops.h"
+@@ -32,25 +34,121 @@ extern void xen_sysenter_target(void);
+ extern void xen_syscall_target(void);
+ extern void xen_syscall32_target(void);
+ 
++static unsigned long __init xen_release_chunk(phys_addr_t start_addr, phys_addr_t end_addr)
++{
++	struct xen_memory_reservation reservation = {
++		.address_bits = 0,
++		.extent_order = 0,
++		.domid        = DOMID_SELF
++	};
++	unsigned long start, end;
++	unsigned long len = 0;
++	unsigned long pfn;
++	int ret;
++
++	start = PFN_UP(start_addr);
++	end = PFN_DOWN(end_addr);
++
++	if (end <= start)
++		return 0;
++
++	printk(KERN_INFO "xen_release_chunk: looking at area pfn %lx-%lx\n", start, end);
++	for(pfn = start; pfn < end; pfn++) {
++		unsigned long mfn = pfn_to_mfn(mfn);
++
++		/* Make sure pfn exists to start with */
++		if (mfn == INVALID_P2M_ENTRY || mfn_to_pfn(mfn) != pfn)
++			continue;
++
++		set_xen_guest_handle(reservation.extent_start, &mfn);
++		reservation.nr_extents = 1;
++
++		ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation);
++		WARN(ret != 1, "Failed to release memory %lx-%lx err=%d\n",
++		     start, end, ret);
++		if (ret == 1) {
++			set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
++			len++;
++		}
++	}
++
++	return len;
++}
++
++static unsigned long __init xen_return_unused_memory(const struct e820map *e820)
++{
++	unsigned long last_end = 0;
++	unsigned long released = 0;
++	int i;
++
++	for (i = 0; i < e820->nr_map; i++) {
++		released += xen_release_chunk(last_end, e820->map[i].addr);
++		last_end = e820->map[i].addr + e820->map[i].size;
++	}
++
++	released += xen_release_chunk(last_end, PFN_PHYS(xen_start_info->nr_pages));
++
++	printk(KERN_INFO "released %ld pages of unused memory\n", released);
++	return released;
++}
+ 
  /**
   * machine_specific_memory_setup - Hook for machine specific memory setup.
   **/
 -
  char * __init xen_memory_setup(void)
  {
++	static __initdata struct e820entry map[E820MAX];
++
  	unsigned long max_pfn = xen_start_info->nr_pages;
++	struct xen_memory_map memmap;
 +	unsigned long long mem_end;
++	int op;
 +	int rc;
-+	struct xen_memory_map memmap;
-+	/*
-+	 * This is rather large for a stack variable but this early in
-+	 * the boot process we know we have plenty slack space.
-+	 */
-+	struct e820entry map[E820MAX];
-+	int op = xen_initial_domain() ?
-+		XENMEM_machine_memory_map :
-+		XENMEM_memory_map;
 +	int i;
  
  	max_pfn = min(MAX_DOMAIN_PAGES, max_pfn);
@@ -5993,6 +6083,9 @@ index ad0047f..2439456 100644
 +	memmap.nr_entries = E820MAX;
 +	set_xen_guest_handle(memmap.buffer, map);
 +
++	op = xen_initial_domain() ?
++		XENMEM_machine_memory_map :
++		XENMEM_memory_map;
 +	rc = HYPERVISOR_memory_op(op, &memmap);
 +	if (rc == -ENOSYS) {
 +		memmap.nr_entries = 1;
@@ -6032,7 +6125,16 @@ index ad0047f..2439456 100644
  	 */
  	e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
  			E820_RESERVED);
-@@ -188,7 +230,5 @@ void __init xen_arch_setup(void)
+@@ -67,6 +165,8 @@ char * __init xen_memory_setup(void)
+ 
+ 	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+ 
++	xen_return_unused_memory(&e820);
++
+ 	return "Xen";
+ }
+ 
+@@ -188,7 +288,5 @@ void __init xen_arch_setup(void)
  
  	pm_idle = xen_idle;
  
@@ -6829,6 +6931,29 @@ index 1ebd6b4..3590082 100644
  obj-$(CONFIG_INTR_REMAP) += dmar.o intr_remapping.o
  
  obj-$(CONFIG_PCI_IOV) += iov.o
+diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
+index d986afb..b40c6d0 100644
+--- a/drivers/pci/msi.c
++++ b/drivers/pci/msi.c
+@@ -20,6 +20,8 @@
+ #include <asm/errno.h>
+ #include <asm/io.h>
+ 
++#include <asm/xen/hypervisor.h>
++
+ #include "pci.h"
+ #include "msi.h"
+ 
+@@ -269,7 +271,8 @@ void write_msi_msg(unsigned int irq, struct msi_msg *msg)
+ {
+ 	struct irq_desc *desc = irq_to_desc(irq);
+ 
+-	write_msi_msg_desc(desc, msg);
++	if (!xen_initial_domain())
++		write_msi_msg_desc(desc, msg);
+ }
+ 
+ static int msi_free_irqs(struct pci_dev* dev);
 diff --git a/drivers/pci/xen-iommu.c b/drivers/pci/xen-iommu.c
 new file mode 100644
 index 0000000..9ba63b1
@@ -8017,7 +8142,7 @@ index 0000000..8bab63d
 +blkbk-y	:= blkback.o xenbus.o interface.o vbd.o
 diff --git a/drivers/xen/blkback/blkback.c b/drivers/xen/blkback/blkback.c
 new file mode 100644
-index 0000000..31458bd
+index 0000000..e9e3de1
 --- /dev/null
 +++ b/drivers/xen/blkback/blkback.c
 @@ -0,0 +1,657 @@
@@ -8063,6 +8188,7 @@ index 0000000..31458bd
 +#include <linux/list.h>
 +#include <linux/delay.h>
 +#include <linux/freezer.h>
++
 +#include <xen/balloon.h>
 +#include <xen/events.h>
 +#include <xen/page.h>
@@ -8406,7 +8532,6 @@ index 0000000..31458bd
 +				 struct blkif_request *req,
 +				 pending_req_t *pending_req)
 +{
-+	extern void ll_rw_block(int rw, int nr, struct buffer_head * bhs[]);
 +	struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST];
 +	struct phys_req preq;
 +	struct {

xen.pvops.post.patch:
 b/arch/x86/include/asm/paravirt_types.h |    3 +++
 b/arch/x86/kernel/process_32.c          |    2 ++
 b/arch/x86/pci/common.c                 |   16 ++++++++++++++++
 b/include/linux/swiotlb.h               |    1 +
 drivers/pci/pci.h                       |    2 ++
 5 files changed, 24 insertions(+)

Index: xen.pvops.post.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/Attic/xen.pvops.post.patch,v
retrieving revision 1.1.2.27
retrieving revision 1.1.2.28
diff -u -p -r1.1.2.27 -r1.1.2.28
--- xen.pvops.post.patch	15 Sep 2009 23:03:23 -0000	1.1.2.27
+++ xen.pvops.post.patch	19 Sep 2009 16:47:33 -0000	1.1.2.28
@@ -80,43 +80,3 @@ index cb1a663..f4ebffb 100644
  
  struct device;
  struct dma_attrs;
-diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
-index 72bb3a2..0088329 100644
---- a/arch/x86/mm/Makefile
-+++ b/arch/x86/mm/Makefile
-@@ -4,6 +4,7 @@ obj-y	:=  init.o init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \
- # Make sure __phys_addr has no stackprotector
- nostackp := $(call cc-option, -fno-stack-protector)
- CFLAGS_physaddr.o		:= $(nostackp)
-+CFLAGS_init.o			:= $(nostackp)
- 
- obj-$(CONFIG_SMP)		+= tlb.o
- 
-diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
-index 03644f9..5b55c92 100644
---- a/arch/x86/xen/enlighten.c
-+++ b/arch/x86/xen/enlighten.c
-@@ -1092,6 +1092,11 @@ asmlinkage void __init xen_start_kernel(void)
- 
- 	__supported_pte_mask |= _PAGE_IOMAP;
- 
-+#ifdef CONFIG_X86_64
-+	/* Work out if we support NX */
-+	check_efer();
-+#endif
-+
- 	xen_setup_features();
- 
- 	/* Get mfn list */
-@@ -1132,11 +1137,6 @@ asmlinkage void __init xen_start_kernel(void)
- 
- 	pgd = (pgd_t *)xen_start_info->pt_base;
- 
--#ifdef CONFIG_X86_64
--	/* Work out if we support NX */
--	check_efer();
--#endif
--
- 	/* Don't do the full vcpu_info placement stuff until we have a
- 	   possible map and a non-dummy shared_info. */
- 	per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];


--- drm-page-flip.patch DELETED ---


--- linux-2.6-mac80211-age-scan-results-on-resume.patch DELETED ---


--- linux-2.6-rt2x00-asus-leds.patch DELETED ---




More information about the fedora-extras-commits mailing list