rpms/kernel/devel linux-2.6-aic9400-adp94xx-updates.patch, NONE, 1.1.2.1 linux-2.6-squashfs-s390-dirty-memory-fix.patch, NONE, 1.1.2.1 linux-2.6-x86-allow-hotplug-memory-and-suspend.patch, NONE, 1.1.2.1 kernel-2.6.spec, 1.2519.4.21, 1.2519.4.22 linux-2.6-x86-relocatable.patch, 1.1.2.3, 1.1.2.4

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Sep 8 02:46:17 UTC 2006


Author: dzickus

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv24858

Modified Files:
      Tag: kernel-2_6_17-1_2519_el5_beta1
	kernel-2.6.spec linux-2.6-x86-relocatable.patch 
Added Files:
      Tag: kernel-2_6_17-1_2519_el5_beta1
	linux-2.6-aic9400-adp94xx-updates.patch 
	linux-2.6-squashfs-s390-dirty-memory-fix.patch 
	linux-2.6-x86-allow-hotplug-memory-and-suspend.patch 
Log Message:
adding new patches to the beta1 respin



linux-2.6-aic9400-adp94xx-updates.patch:
 Documentation/scsi/libsas.txt                |  484 +++++
 drivers/message/fusion/mptsas.c              |   11 
 drivers/scsi/Kconfig                         |    5 
 drivers/scsi/Makefile                        |    2 
 drivers/scsi/aic94xx/Kconfig                 |   41 
 drivers/scsi/aic94xx/Makefile                |   39 
 drivers/scsi/aic94xx/aic94xx.h               |  114 +
 drivers/scsi/aic94xx/aic94xx_dev.c           |  353 +++
 drivers/scsi/aic94xx/aic94xx_dump.c          |  959 ++++++++++
 drivers/scsi/aic94xx/aic94xx_dump.h          |   52 
 drivers/scsi/aic94xx/aic94xx_hwi.c           | 1376 +++++++++++++++
 drivers/scsi/aic94xx/aic94xx_hwi.h           |  397 ++++
 drivers/scsi/aic94xx/aic94xx_init.c          |  862 +++++++++
 drivers/scsi/aic94xx/aic94xx_reg.c           |  332 +++
 drivers/scsi/aic94xx/aic94xx_reg.h           |  302 +++
 drivers/scsi/aic94xx/aic94xx_reg_def.h       | 2398 +++++++++++++++++++++++++++
 drivers/scsi/aic94xx/aic94xx_sas.h           |  785 ++++++++
 drivers/scsi/aic94xx/aic94xx_scb.c           |  732 ++++++++
 drivers/scsi/aic94xx/aic94xx_sds.c           | 1154 ++++++++++++
 drivers/scsi/aic94xx/aic94xx_seq.c           | 1318 ++++++++++++++
 drivers/scsi/aic94xx/aic94xx_seq.h           |   39 
 drivers/scsi/aic94xx/aic94xx_seq_microcode.c | 1467 ++++++++++++++++
 drivers/scsi/aic94xx/aic94xx_task.c          |  642 +++++++
 drivers/scsi/aic94xx/aic94xx_tmf.c           |  636 +++++++
 drivers/scsi/libsas/Kconfig                  |   39 
 drivers/scsi/libsas/Makefile                 |   36 
 drivers/scsi/libsas/sas_discover.c           |  749 ++++++++
 drivers/scsi/libsas/sas_dump.c               |   76 
 drivers/scsi/libsas/sas_dump.h               |   42 
 drivers/scsi/libsas/sas_event.c              |   75 
 drivers/scsi/libsas/sas_expander.c           | 1862 ++++++++++++++++++++
 drivers/scsi/libsas/sas_init.c               |  227 ++
 drivers/scsi/libsas/sas_internal.h           |  146 +
 drivers/scsi/libsas/sas_phy.c                |  157 +
 drivers/scsi/libsas/sas_port.c               |  279 +++
 drivers/scsi/libsas/sas_scsi_host.c          |  786 ++++++++
 drivers/scsi/scsi_transport_sas.c            |   10 
 include/scsi/libsas.h                        |  627 +++++++
 include/scsi/sas.h                           |  644 +++++++
 include/scsi/scsi.h                          |    6 
 include/scsi/scsi_transport_sas.h            |    5 
 41 files changed, 20251 insertions(+), 15 deletions(-)

--- NEW FILE linux-2.6-aic9400-adp94xx-updates.patch ---
diff -uNr linux-2.6.17.noarch.orig/Documentation/scsi/libsas.txt linux-2.6.17.noarch/Documentation/scsi/libsas.txt
--- linux-2.6.17.noarch.orig/Documentation/scsi/libsas.txt	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.17.noarch/Documentation/scsi/libsas.txt	2006-09-06 12:55:13.000000000 -0400
@@ -0,0 +1,484 @@
+SAS Layer
+---------
+
+The SAS Layer is a management infrastructure which manages
+SAS LLDDs.  It sits between SCSI Core and SAS LLDDs.  The
+layout is as follows: while SCSI Core is concerned with
+SAM/SPC issues, and a SAS LLDD+sequencer is concerned with
+phy/OOB/link management, the SAS layer is concerned with:
+
+      * SAS Phy/Port/HA event management (LLDD generates,
+        SAS Layer processes),
+      * SAS Port management (creation/destruction),
+      * SAS Domain discovery and revalidation,
+      * SAS Domain device management,
+      * SCSI Host registration/unregistration,
+      * Device registration with SCSI Core (SAS) or libata
+        (SATA), and
+      * Expander management and exporting expander control
+        to user space.
+
+A SAS LLDD is a PCI device driver.  It is concerned with
+phy/OOB management, and vendor specific tasks and generates
+events to the SAS layer.
+
+The SAS Layer does most SAS tasks as outlined in the SAS 1.1
+spec.
+
+The sas_ha_struct describes the SAS LLDD to the SAS layer.
+Most of it is used by the SAS Layer but a few fields need to
+be initialized by the LLDDs.
+
+After initializing your hardware, from the probe() function
+you call sas_register_ha(). It will register your LLDD with
+the SCSI subsystem, creating a SCSI host and it will
+register your SAS driver with the sysfs SAS tree it creates.
+It will then return.  Then you enable your phys to actually
+start OOB (at which point your driver will start calling the
+notify_* event callbacks).
+
+Structure descriptions:
+
+struct sas_phy --------------------
+Normally this is statically embedded to your driver's
+phy structure:
+	struct my_phy {
+	       blah;
+	       struct sas_phy sas_phy;
+	       bleh;
+	};
+And then all the phys are an array of my_phy in your HA
+struct (shown below).
+
+Then as you go along and initialize your phys you also
+initialize the sas_phy struct, along with your own
+phy structure.
+
+In general, the phys are managed by the LLDD and the ports
+are managed by the SAS layer.  So the phys are initialized
+and updated by the LLDD and the ports are initialized and
+updated by the SAS layer.
+
+There is a scheme where the LLDD can RW certain fields,
+and the SAS layer can only read such ones, and vice versa.
+The idea is to avoid unnecessary locking.
+
+enabled -- must be set (0/1)
+id -- must be set [0,MAX_PHYS)
+class, proto, type, role, oob_mode, linkrate -- must be set
+oob_mode --  you set this when OOB has finished and then notify
+the SAS Layer.
+
+sas_addr -- this normally points to an array holding the sas
+address of the phy, possibly somewhere in your my_phy
+struct.
+
+attached_sas_addr -- set this when you (LLDD) receive an
+IDENTIFY frame or a FIS frame, _before_ notifying the SAS
+layer.  The idea is that sometimes the LLDD may want to fake
+or provide a different SAS address on that phy/port and this
+allows it to do this.  At best you should copy the sas
+address from the IDENTIFY frame or maybe generate a SAS
+address for SATA directly attached devices.  The Discover
+process may later change this.
+
+frame_rcvd -- this is where you copy the IDENTIFY/FIS frame
+when you get it; you lock, copy, set frame_rcvd_size and
+unlock the lock, and then call the event.  It is a pointer
+since there's no way to know your hw frame size _exactly_,
+so you define the actual array in your phy struct and let
+this pointer point to it.  You copy the frame from your
+DMAable memory to that area holding the lock.
+
+sas_prim -- this is where primitives go when they're
+received.  See sas.h. Grab the lock, set the primitive,
+release the lock, notify.
+
+port -- this points to the sas_port if the phy belongs
+to a port -- the LLDD only reads this. It points to the
+sas_port this phy is part of.  Set by the SAS Layer.
+
+ha -- may be set; the SAS layer sets it anyway.
+
+lldd_phy -- you should set this to point to your phy so you
+can find your way around faster when the SAS layer calls one
+of your callbacks and passes you a phy.  If the sas_phy is
+embedded you can also use container_of -- whatever you
+prefer.
+
+
+struct sas_port --------------------
+The LLDD doesn't set any fields of this struct -- it only
+reads them.  They should be self explanatory.
+
+phy_mask is 32 bit, this should be enough for now, as I
+haven't heard of a HA having more than 8 phys.
+
+lldd_port -- I haven't found use for that -- maybe other
+LLDD who wish to have internal port representation can make
+use of this.
+
+
+struct sas_ha_struct --------------------
+It normally is statically declared in your own LLDD
+structure describing your adapter:
+struct my_sas_ha {
+       blah;
+       struct sas_ha_struct sas_ha;
+       struct my_phy phys[MAX_PHYS];
+       struct sas_port sas_ports[MAX_PHYS]; /* (1) */
+       bleh;
+};
+
+(1) If your LLDD doesn't have its own port representation.
+
+What needs to be initialized (sample function given below).
+
+pcidev
+sas_addr -- since the SAS layer doesn't want to mess with
+	 memory allocation, etc, this points to statically
+	 allocated array somewhere (say in your host adapter
+	 structure) and holds the SAS address of the host
+	 adapter as given by you or the manufacturer, etc.
+sas_port
+sas_phy -- an array of pointers to structures. (see
+	note above on sas_addr).
+	These must be set.  See more notes below.
+num_phys -- the number of phys present in the sas_phy array,
+	 and the number of ports present in the sas_port
+	 array.  There can be a maximum num_phys ports (one per
+	 port) so we drop the num_ports, and only use
+	 num_phys.
+
+The event interface:
+
+	/* LLDD calls these to notify the class of an event. */
+	void (*notify_ha_event)(struct sas_ha_struct *, enum ha_event);
+	void (*notify_port_event)(struct sas_phy *, enum port_event);
+	void (*notify_phy_event)(struct sas_phy *, enum phy_event);
+
+When sas_register_ha() returns, those are set and can be
+called by the LLDD to notify the SAS layer of such events
+the SAS layer.
+
+The port notification:
+
+	/* The class calls these to notify the LLDD of an event. */
+	void (*lldd_port_formed)(struct sas_phy *);
+	void (*lldd_port_deformed)(struct sas_phy *);
+
+If the LLDD wants notification when a port has been formed
+or deformed it sets those to a function satisfying the type.
+
+A SAS LLDD should also implement at least one of the Task
+Management Functions (TMFs) described in SAM:
+
+	/* Task Management Functions. Must be called from process context. */
+	int (*lldd_abort_task)(struct sas_task *);
+	int (*lldd_abort_task_set)(struct domain_device *, u8 *lun);
+	int (*lldd_clear_aca)(struct domain_device *, u8 *lun);
+	int (*lldd_clear_task_set)(struct domain_device *, u8 *lun);
+	int (*lldd_I_T_nexus_reset)(struct domain_device *);
+	int (*lldd_lu_reset)(struct domain_device *, u8 *lun);
+	int (*lldd_query_task)(struct sas_task *);
+
+For more information please read SAM from T10.org.
+
+Port and Adapter management:
+
+	/* Port and Adapter management */
+	int (*lldd_clear_nexus_port)(struct sas_port *);
+	int (*lldd_clear_nexus_ha)(struct sas_ha_struct *);
+
+A SAS LLDD should implement at least one of those.
+
+Phy management:
[...20126 lines suppressed...]
+			u8 smp_tport:1;
+			u8 _un30:1;
+		};
+		u8 target_bits;
+	};
+
+	/* Byte 4 - 11 */
+	u8 _un4_11[8];
+
+	/* Byte 12 - 19 */
+	u8 sas_addr[SAS_ADDR_SIZE];
+
+	/* Byte 20 */
+	u8 phy_id;
+
+	u8 _un21_27[7];
+
+	__be32 crc;
+} __attribute__ ((packed));
+
+struct ssp_frame_hdr {
+	u8     frame_type;
+	u8     hashed_dest_addr[HASHED_SAS_ADDR_SIZE];
+	u8     _r_a;
+	u8     hashed_src_addr[HASHED_SAS_ADDR_SIZE];
+	__be16 _r_b;
+
+	u8     _r_c:5;
+	u8     retry_data_frames:1;
+	u8     retransmit:1;
+	u8     changing_data_ptr:1;
+
+	u8     _r_d:6;
+	u8     num_fill_bytes:2;
+
+	u32    _r_e;
+	__be16 tag;
+	__be16 tptt;
+	__be32 data_offs;
+} __attribute__ ((packed));
+
+struct ssp_response_iu {
+	u8     _r_a[10];
+
+	u8     _r_b:6;
+	u8     datapres:2;
+
+	u8     status;
+
+	u32    _r_c;
+
+	__be32 sense_data_len;
+	__be32 response_data_len;
+
+	u8     resp_data[0];
+	u8     sense_data[0];
+} __attribute__ ((packed));
+
+/* ---------- SMP ---------- */
+
+struct report_general_resp {
+	__be16  change_count;
+	__be16  route_indexes;
+	u8      _r_a;
+	u8      num_phys;
+
+	u8      _r_b:6;
+	u8      configuring:1;
+	u8      conf_route_table:1;
+
+	u8      _r_c;
+
+	u8      enclosure_logical_id[8];
+
+	u8      _r_d[12];
+} __attribute__ ((packed));
+
+struct discover_resp {
+	u8    _r_a[5];
+
+	u8    phy_id;
+	__be16 _r_b;
+
+	u8    _r_d:1;
+	u8    attached_dev_type:3;
+	u8    _r_c:4;
+
+	u8    _r_e:4;
+	u8    linkrate:4;
+
+	u8    _r_f:4;
+	u8    iproto:3;
+	u8    attached_sata_host:1;
+
+	u8    attached_sata_ps:1;
+	u8    _r_g:3;
+	u8    tproto:3;
+	u8    attached_sata_dev:1;
+
+	u8    sas_addr[8];
+	u8    attached_sas_addr[8];
+	u8    attached_phy_id;
+
+	u8    _r_h[7];
+
+	u8    pmin_linkrate:4;
+	u8    hmin_linkrate:4;
+	u8    pmax_linkrate:4;
+	u8    hmax_linkrate:4;
+
+	u8    change_count;
+
+	u8    virtual:1;
+	u8    _r_i:3;
+	u8    pptv:4;
+
+	u8    _r_j:4;
+	u8    routing_attr:4;
+
+	u8    conn_type;
+	u8    conn_el_index;
+	u8    conn_phy_link;
+
+	u8    _r_k[8];
+} __attribute__ ((packed));
+
+struct report_phy_sata_resp {
+	u8    _r_a[5];
+
+	u8    phy_id;
+	u8    _r_b;
+
+	u8    _r_c:6;
+	u8    affil_supp:1;
+	u8    affil_valid:1;
+
+	u32   _r_d;
+
+	u8    stp_sas_addr[8];
+
+	struct dev_to_host_fis fis;
+
+	u32   _r_e;
+
+	u8    affil_stp_ini_addr[8];
+
+	__be32 crc;
+} __attribute__ ((packed));
+
+struct smp_resp {
+	u8    frame_type;
+	u8    function;
+	u8    result;
+	u8    reserved;
+	union {
+		struct report_general_resp  rg;
+		struct discover_resp        disc;
+		struct report_phy_sata_resp rps;
+	};
+} __attribute__ ((packed));
+
+#else
+#error "Bitfield order not defined!"
+#endif
+
+#endif /* _SAS_H_ */
diff -uNr linux-2.6.17.noarch.orig/include/scsi/scsi.h linux-2.6.17.noarch/include/scsi/scsi.h
--- linux-2.6.17.noarch.orig/include/scsi/scsi.h	2006-09-06 12:53:48.000000000 -0400
+++ linux-2.6.17.noarch/include/scsi/scsi.h	2006-09-06 12:55:14.000000000 -0400
@@ -433,4 +433,10 @@
 /* Used to obtain the PCI location of a device */
 #define SCSI_IOCTL_GET_PCI		0x5387
 
+/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */
+static inline u32 scsi_to_u32(u8 *ptr)
+{
+	return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3];
+}
+
 #endif /* _SCSI_SCSI_H */
diff -uNr linux-2.6.17.noarch.orig/include/scsi/scsi_transport_sas.h linux-2.6.17.noarch/include/scsi/scsi_transport_sas.h
--- linux-2.6.17.noarch.orig/include/scsi/scsi_transport_sas.h	2006-09-06 12:53:48.000000000 -0400
+++ linux-2.6.17.noarch/include/scsi/scsi_transport_sas.h	2006-09-06 12:55:14.000000000 -0400
@@ -57,9 +57,6 @@
 	enum sas_linkrate	maximum_linkrate_hw;
 	enum sas_linkrate	maximum_linkrate;
 
-	/* internal state */
-	unsigned int		local_attached : 1;
-
 	/* link error statistics */
 	u32			invalid_dword_count;
 	u32			running_disparity_error_count;
@@ -196,4 +193,6 @@
 		rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE;
 }
 
+#define scsi_is_sas_phy_local(phy)	scsi_is_host_device((phy)->dev.parent)
+
 #endif /* SCSI_TRANSPORT_SAS_H */

linux-2.6-squashfs-s390-dirty-memory-fix.patch:
 inode.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

--- NEW FILE linux-2.6-squashfs-s390-dirty-memory-fix.patch ---
This patch fixes oops for bz#202962, bz#198698, bz#141703.

On s390, pages mapped by kernel get dirty when kernel stores into them.
SetPageUptodate() clears the dirty bit, but only if the page was not
up to date before. Thus, when it is called twice on the same page,
the dirty bit is not cleared the second time around. This produces
a erroneous dirty page and an oops.

There's a more detailed explanation here:
 http://marc.theaimsgroup.com/?t=115725548100001&r=1&w=2
As always, Bugzilla has all the materials too.

I tested this patch to fix the problem. I did not test squashfs to
continue to work on all other platforms though... It seems like working.

Squashfs is not upstream in Linus or Andrew's trees. We use it because
of need (I asked Jeremy). The upstream maintainer (Phillip Lougher) liked
the patch, but there was no "upstream" testing yet.

Please review and ack. Especially I'm looking at those who knows what
SetPageUptodate() and grab_cache_page_nowait() are.

-- Pete

diff -urp -X dontdiff linux-2.6.17-1.2519.4.5.el5/fs/squashfs/inode.c linux-2.6.17-1.2519.4.5.el5.z1/fs/squashfs/inode.c
--- linux-2.6.17-1.2519.4.5.el5/fs/squashfs/inode.c	2006-08-25 01:44:10.000000000 -0400
+++ linux-2.6.17-1.2519.4.5.el5.z1/fs/squashfs/inode.c	2006-09-01 22:33:24.000000000 -0400
@@ -1554,8 +1554,15 @@ static int squashfs_readpage(struct file
 			flush_dcache_page(page);
 			SetPageUptodate(page);
 			unlock_page(page);
-		} else if ((push_page =
-				grab_cache_page_nowait(page->mapping, i))) {
+		} else {
+			push_page = grab_cache_page_nowait(page->mapping, i);
+			if (!push_page)
+				continue;
+			if (PageUptodate(push_page)) {
+				unlock_page(push_page);
+				page_cache_release(push_page);
+				continue;
+			}
  			pageaddr = kmap_atomic(push_page, KM_USER0);
 
 			memcpy(pageaddr, data_ptr + byte_offset,

linux-2.6-x86-allow-hotplug-memory-and-suspend.patch:
 arch/x86_64/Kconfig            |    4 ++
 arch/x86_64/mm/init.c          |   52 +++++++++++++++++----------------
 arch/x86_64/mm/init.c.orig     |    3 +
 arch/x86_64/mm/srat.c          |   64 ++++++++++++++++++++++++++---------------
 drivers/acpi/acpi_memhotplug.c |    2 +
 drivers/acpi/motherboard.c     |    8 ++++-
 mm/Kconfig                     |    7 +++-
 7 files changed, 91 insertions(+), 49 deletions(-)

--- NEW FILE linux-2.6-x86-allow-hotplug-memory-and-suspend.patch ---

diff -uNr linux-2.6.17.x86_64.orig/arch/x86_64/Kconfig linux-2.6.17.x86_64/arch/x86_64/Kconfig
--- linux-2.6.17.x86_64.orig/arch/x86_64/Kconfig	2006-09-07 16:07:01.000000000 -0400
+++ linux-2.6.17.x86_64/arch/x86_64/Kconfig	2006-09-07 16:42:12.000000000 -0400
@@ -375,6 +375,10 @@
 
 source "mm/Kconfig"
 
+config MEMORY_HOTPLUG_RESERVE
+	def_bool y
+	depends on (MEMORY_HOTPLUG && DISCONTIGMEM)
+
 config HAVE_ARCH_EARLY_PFN_TO_NID
 	def_bool y
 	depends on NUMA
diff -uNr linux-2.6.17.x86_64.orig/arch/x86_64/mm/init.c linux-2.6.17.x86_64/arch/x86_64/mm/init.c
--- linux-2.6.17.x86_64.orig/arch/x86_64/mm/init.c	2006-09-07 16:07:01.000000000 -0400
+++ linux-2.6.17.x86_64/arch/x86_64/mm/init.c	2006-09-07 16:43:44.000000000 -0400
@@ -251,12 +251,13 @@
 }
 
 static void __meminit
-phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end)
+phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end)
 {
-	int i;
+	int i = pmd_index(address);
 
-	for (i = 0; i < PTRS_PER_PMD; pmd++, i++, address += PMD_SIZE) {
+	for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) {
 		unsigned long entry;
+		pmd_t *pmd = pmd_page + pmd_index(address);
 
 		if (address >= end) {
 			if (!after_bootmem)
@@ -264,6 +265,11 @@
 					set_pmd(pmd, __pmd(0));
 			break;
 		}
+		
+		if (pmd_val(*pmd)) {
+			printk (KERN_ERR "%s trying to trample pte entry \
+				%lx@%lx\n",__func__,pmd_val(*pmd),address);
+		}
 		entry = _PAGE_NX|_PAGE_PSE|_KERNPG_TABLE|_PAGE_GLOBAL|address;
 		entry &= __supported_pte_mask;
 		set_pmd(pmd, __pmd(entry));
@@ -273,45 +279,41 @@
 static void __meminit
 phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end)
 {
-	pmd_t *pmd = pmd_offset(pud, (unsigned long)__va(address));
-
-	if (pmd_none(*pmd)) {
-		spin_lock(&init_mm.page_table_lock);
-		phys_pmd_init(pmd, address, end);
-		spin_unlock(&init_mm.page_table_lock);
-		__flush_tlb_all();
-	}
+	pmd_t *pmd = pmd_offset(pud,0);
+	spin_lock(&init_mm.page_table_lock);
+	phys_pmd_init(pmd, address, end);
+	spin_unlock(&init_mm.page_table_lock);
+	__flush_tlb_all();
 }
 
-static void __meminit phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
+static void __meminit phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end)
 { 
-	long i = pud_index(address);
+	int i = pud_index(addr);
 
-	pud = pud + i;
 
-	if (after_bootmem && pud_val(*pud)) {
-		phys_pmd_update(pud, address, end);
-		return;
-	}
-
-	for (; i < PTRS_PER_PUD; pud++, i++) {
+	for (; i < PTRS_PER_PUD; i++, addr = (addr & PUD_MASK) + PUD_SIZE ) {
 		int map; 
-		unsigned long paddr, pmd_phys;
+		unsigned long pmd_phys;
+		pud_t *pud = pud_page + pud_index(addr);
 		pmd_t *pmd;
 
-		paddr = (address & PGDIR_MASK) + i*PUD_SIZE;
-		if (paddr >= end)
+		if (addr >= end)
 			break;
 
-		if (!after_bootmem && !e820_any_mapped(paddr, paddr+PUD_SIZE, 0)) {
+		if (!after_bootmem && !e820_any_mapped(addr,addr+PUD_SIZE,0)) {
 			set_pud(pud, __pud(0)); 
 			continue;
 		} 
 
+		if (pud_val(*pud)) {
+			phys_pmd_update(pud, addr, end);
+			continue;
+		}
+
 		pmd = alloc_low_page(&map, &pmd_phys);
 		spin_lock(&init_mm.page_table_lock);
 		set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE));
-		phys_pmd_init(pmd, paddr, end);
+		phys_pmd_init(pmd, addr, end);
 		spin_unlock(&init_mm.page_table_lock);
 		unmap_low_page(map);
 	}
diff -uNr linux-2.6.17.x86_64.orig/arch/x86_64/mm/init.c.orig linux-2.6.17.x86_64/arch/x86_64/mm/init.c.orig
--- linux-2.6.17.x86_64.orig/arch/x86_64/mm/init.c.orig	2006-09-07 16:07:01.000000000 -0400
+++ linux-2.6.17.x86_64/arch/x86_64/mm/init.c.orig	2006-09-07 16:41:35.000000000 -0400
@@ -6,6 +6,7 @@
  *  Copyright (C) 2002,2003 Andi Kleen <ak at suse.de>
  */
 
+#include <linux/module.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -630,6 +631,8 @@
 }
 
 
+EXPORT_SYMBOL_GPL(page_is_ram);
+
 static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
 			 kcore_vsyscall;
 
diff -uNr linux-2.6.17.x86_64.orig/arch/x86_64/mm/srat.c linux-2.6.17.x86_64/arch/x86_64/mm/srat.c
--- linux-2.6.17.x86_64.orig/arch/x86_64/mm/srat.c	2006-09-07 16:07:01.000000000 -0400
+++ linux-2.6.17.x86_64/arch/x86_64/mm/srat.c	2006-09-07 16:42:12.000000000 -0400
@@ -21,22 +21,13 @@
 #include <asm/numa.h>
 #include <asm/e820.h>
 
-#if (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \
-	defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) \
-		&& !defined(CONFIG_MEMORY_HOTPLUG)
-#define RESERVE_HOTADD 1
-#endif
-
 static struct acpi_table_slit *acpi_slit;
 
 static nodemask_t nodes_parsed __initdata;
 static struct bootnode nodes[MAX_NUMNODES] __initdata;
-static struct bootnode nodes_add[MAX_NUMNODES] __initdata;
+static struct bootnode nodes_add[MAX_NUMNODES];
 static int found_add_area __initdata;
 int hotadd_percent __initdata = 0;
-#ifndef RESERVE_HOTADD
-#define hotadd_percent 0	/* Ignore all settings */
-#endif
 
 /* Too small nodes confuse the VM badly. Usually they result
    from BIOS bugs. */
@@ -157,7 +148,7 @@
 	       pxm, pa->apic_id, node);
 }
 
-#ifdef RESERVE_HOTADD
+#ifdef CONFIG_HOTPLUG_MEMORY_RESERVE
 /*
  * Protect against too large hotadd areas that would fill up memory.
  */
@@ -200,15 +191,37 @@
 	return 1;
 }
 
+static int update_end_of_memory(unsigned long end)
+{
+	found_add_area = 1;
+	if ((end >> PAGE_SHIFT) > end_pfn)
+		end_pfn = end >> PAGE_SHIFT;
+	return 1;
+}
+
+static inline int save_add_info(void)
+{
+	return hotadd_percent > 0;
+}
+#else
+int update_end_of_memory(unsigned long end) {return 0;}
+static int hotadd_enough_memory(struct bootnode *nd) {return 1;}
+#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
+static inline int save_add_info(void) {return 1;}
+#else
+static inline int save_add_info(void) {return 0;}
+#endif 
+#endif 
 /*
- * It is fine to add this area to the nodes data it will be used later
+ * Update nodes_add and decide if to include add are in the zone.  
+ * Both SPARSE and RESERVE need nodes_add infomation.
  * This code supports one contigious hot add area per node.
  */
 static int reserve_hotadd(int node, unsigned long start, unsigned long end)
 {
 	unsigned long s_pfn = start >> PAGE_SHIFT;
 	unsigned long e_pfn = end >> PAGE_SHIFT;
-	int changed = 0;
+	int ret = 0, changed = 0;
 	struct bootnode *nd = &nodes_add[node];
 
 	/* I had some trouble with strange memory hotadd regions breaking
@@ -235,7 +248,6 @@
 
 	/* Looks good */
 
- 	found_add_area = 1;
 	if (nd->start == nd->end) {
  		nd->start = start;
  		nd->end = end;
@@ -253,14 +265,12 @@
 			printk(KERN_ERR "SRAT: Hotplug zone not continuous. Partly ignored\n");
  	}
 
- 	if ((nd->end >> PAGE_SHIFT) > end_pfn)
- 		end_pfn = nd->end >> PAGE_SHIFT;
+	ret = update_end_of_memory(nd->end);
 
 	if (changed)
 	 	printk(KERN_INFO "SRAT: hot plug zone found %Lx - %Lx\n", nd->start, nd->end);
 	return 0;
 }
-#endif
 
 /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
 void __init
@@ -279,7 +289,7 @@
 	}
 	if (ma->flags.enabled == 0)
 		return;
- 	if (ma->flags.hot_pluggable && hotadd_percent == 0)
+ 	if (ma->flags.hot_pluggable && !save_add_info())
 		return;
 	start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32);
 	end = start + (ma->length_lo | ((u64)ma->length_hi << 32));
@@ -318,15 +328,13 @@
 	printk(KERN_INFO "SRAT: Node %u PXM %u %Lx-%Lx\n", node, pxm,
 	       nd->start, nd->end);
 
-#ifdef RESERVE_HOTADD
- 	if (ma->flags.hot_pluggable && reserve_hotadd(node, start, end) < 0) {
+ 	if (ma->flags.hot_pluggable && !reserve_hotadd(node, start, end) < 0) {
 		/* Ignore hotadd region. Undo damage */
 		printk(KERN_NOTICE "SRAT: Hotplug region ignored\n");
 		*nd = oldnode;
 		if ((nd->start | nd->end) == 0)
 			node_clear(node, nodes_parsed);
 	}
-#endif
 }
 
 /* Sanity check to catch more bad SRATs (they are amazingly common).
@@ -342,7 +350,6 @@
 		unsigned long e = nodes[i].end >> PAGE_SHIFT;
 		pxmram += e - s;
 		pxmram -= e820_hole_size(s, e);
-		pxmram -= nodes_add[i].end - nodes_add[i].start;
 		if ((long)pxmram < 0)
 			pxmram = 0;
 	}
@@ -450,3 +457,16 @@
 }
 
 EXPORT_SYMBOL(__node_distance);
+
+int memory_add_physaddr_to_nid(u64 start)
+{
+	int i, ret = 0;
+	
+	for_each_node(i) 
+		if (nodes_add[i].start <= start && nodes_add[i].end > start)
+			ret = i;
+
+	return ret;
+}
+
+EXPORT_SYMBOL(memory_add_physaddr_to_nid);
diff -uNr linux-2.6.17.x86_64.orig/drivers/acpi/acpi_memhotplug.c linux-2.6.17.x86_64/drivers/acpi/acpi_memhotplug.c
--- linux-2.6.17.x86_64.orig/drivers/acpi/acpi_memhotplug.c	2006-09-07 16:07:42.000000000 -0400
+++ linux-2.6.17.x86_64/drivers/acpi/acpi_memhotplug.c	2006-09-07 16:43:01.000000000 -0400
@@ -240,6 +240,8 @@
 			num_enabled++;
 			continue;
 		}
+		if (node < 0)
+			node=  memory_add_physaddr_to_nid(info->start_addr);
 
 		result = add_memory(node, info->start_addr, info->length);
 		if (result)
diff -uNr linux-2.6.17.x86_64.orig/drivers/acpi/motherboard.c linux-2.6.17.x86_64/drivers/acpi/motherboard.c
--- linux-2.6.17.x86_64.orig/drivers/acpi/motherboard.c	2006-09-07 16:07:42.000000000 -0400
+++ linux-2.6.17.x86_64/drivers/acpi/motherboard.c	2006-09-07 16:42:12.000000000 -0400
@@ -87,6 +87,7 @@
 		}
 	} else {
 		/* Memory mapped IO? */
+		 return -EINVAL;
 	}
 
 	if (requested_res)
@@ -96,11 +97,16 @@
 
 static int acpi_motherboard_add(struct acpi_device *device)
 {
+	acpi_status status;
 	if (!device)
 		return -EINVAL;
-	acpi_walk_resources(device->handle, METHOD_NAME__CRS,
+
+	status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
 			    acpi_reserve_io_ranges, NULL);
 
+	if (ACPI_FAILURE(status)) 
+		return -ENODEV;
+	
 	return 0;
 }
 
diff -uNr linux-2.6.17.x86_64.orig/mm/Kconfig linux-2.6.17.x86_64/mm/Kconfig
--- linux-2.6.17.x86_64.orig/mm/Kconfig	2006-09-07 16:08:10.000000000 -0400
+++ linux-2.6.17.x86_64/mm/Kconfig	2006-09-07 16:42:12.000000000 -0400
@@ -115,12 +115,17 @@
 # eventually, we can have this option just 'select SPARSEMEM'
 config MEMORY_HOTPLUG
 	bool "Allow for memory hot-add"
-	depends on SPARSEMEM && HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG
+	depends on SPARSEMEM || X86_64_ACPI_NUMA 
+	depends on HOTPLUG  && ARCH_ENABLE_MEMORY_HOTPLUG
 	depends on (IA64 || X86 || PPC64)
 
 comment "Memory hotplug is currently incompatible with Software Suspend"
 	depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND
 
+config MEMORY_HOTPLUG_SPARSE
+	def_bool y
+	depends on SPARSEMEM && MEMORY_HOTPLUG
+
 # Heavily threaded applications may benefit from splitting the mm-wide
 # page_table_lock, so that faults on different parts of the user address
 # space can be handled with less contention: split it at this NR_CPUS.
-- 
Konrad Rzeszutek 1-(978)-392-3903 or 1-(617)-693-1718
IBM on-site partner.


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.2519.4.21
retrieving revision 1.2519.4.22
diff -u -r1.2519.4.21 -r1.2519.4.22
--- kernel-2.6.spec	30 Aug 2006 21:35:13 -0000	1.2519.4.21
+++ kernel-2.6.spec	8 Sep 2006 02:46:15 -0000	1.2519.4.22
@@ -31,7 +31,7 @@
 %define sublevel 17
 %define kversion 2.6.%{sublevel}
 %define rpmversion 2.6.%{sublevel}
-%define release %(R="$Revision$"; RR="${R##: }"; echo ${RR%%?})%{?dist}
+%define release %(R="$Revision$"; RR="${R##: }"; echo ${RR%%?})%{?dist}.f2.opt
 %define signmodules 0
 %define xen_hv_cset 10730
 %define make_target bzImage
@@ -298,6 +298,7 @@
 Patch208: linux-2.6-x86_64-add-ppoll-pselect.patch
 Patch209: linux-2.6-x86_64-opterons-synchronize-p-state-using-TSC.patch
 Patch210: linux-2.6-x86-relocatable.patch
+Patch211: linux-2.6-x86-allow-hotplug-memory-and-suspend.patch
 
 # 300 - 399   ppc(64)
 Patch304: linux-2.6-ppc-fix-irq-mapping.patch
@@ -381,6 +382,7 @@
 Patch1102: linux-2.6-scsi-advansys-pcitable.patch
 Patch1103: linux-2.6-iscsi-update-to-2-6-18-rc2.upstream.patch
 Patch1104: linux-2.6-iscsi-add-qla4xxx2.patch
+Patch1105: linux-2.6-aic9400-adp94xx-updates.patch
 
 # NFS bits.
 Patch1200: linux-2.6-NFSD-non-null-getxattr.patch
@@ -395,6 +397,8 @@
 # Filesystem stuff.
 # Squashfs
 Patch1400: linux-2.6-squashfs.patch
+Patch1401: linux-2.6-squashfs-s390-dirty-memory-fix.patch
+
 # GFS/DLM
 Patch1410: linux-2.6-gfs2-dlm.patch
 Patch1411: linux-2.6-gfs2-tux.patch
@@ -788,6 +792,7 @@
 %patch208 -p1
 # fix opteron timer scaling
 %patch209 -p1
+%patch211 -p1
 %if 0%{?rhel}
 #add in support for x86 and x86_64 relocatable kernels
 %patch210 -p1
@@ -934,6 +939,7 @@
 %patch1103 -p1
 # add support for qla4xxx
 %patch1104 -p1
+%patch1105 -p1
 
 #
 # Various upstream NFS/NFSD fixes.
@@ -953,6 +959,8 @@
 # Filesystem patches.
 # Squashfs
 %patch1400 -p1
+%patch1401 -p1
+
 # GFS2/DLM
 %patch1410 -p1
 %patch1411 -p1
@@ -1794,6 +1802,11 @@
 %endif
 
 %changelog
+* Thu Sep 07 2006 Don Zickus <dzickus at redhat.com>
+- added #202962/198698 - s390 anaconda fails to install (Pete Zaitcev)
+- added #184837 - aic9400/adp94xx updates (Konrad Rzeszutek)
+- added #181552 - x86_64 hotplug memory support (Konrad Rzeszutek)
+
 * Wed Aug 29 2006 Don Zickus <dzickus at redhat.com>
 - added #199756 - include latest Infiniband SDP support (Doug Ledford)
 

linux-2.6-x86-relocatable.patch:
 arch/x86_64/mm/init.c                                            |  317 ++---
 b/arch/i386/Kconfig                                              |   13 
 b/arch/i386/Makefile                                             |    2 
 b/arch/i386/boot/Makefile                                        |    2 
 b/arch/i386/boot/bootsect.S                                      |   97 +
 b/arch/i386/boot/compressed/Makefile                             |   22 
 b/arch/i386/boot/compressed/head.S                               |  184 ++-
 b/arch/i386/boot/compressed/misc.c                               |  513 ++++++---
 b/arch/i386/boot/compressed/relocs.c                             |  563 ++++++++++
 b/arch/i386/boot/compressed/vmlinux.lds                          |   40 
 b/arch/i386/boot/compressed/vmlinux.scr                          |    3 
 b/arch/i386/boot/setup.S                                         |   29 
 b/arch/i386/boot/tools/build.c                                   |  214 +++
 b/arch/i386/kernel/alternative.c                                 |    8 
 b/arch/i386/kernel/setup.c                                       |    4 
 b/arch/i386/kernel/vmlinux.lds.S                                 |  114 +-
 b/arch/i386/mm/init.c                                            |   15 
 b/arch/x86_64/Kconfig                                            |   19 
 b/arch/x86_64/boot/Makefile                                      |    2 
 b/arch/x86_64/boot/bootsect.S                                    |   93 +
 b/arch/x86_64/boot/compressed/Makefile                           |   13 
 b/arch/x86_64/boot/compressed/head.S                             |  301 +++--
 b/arch/x86_64/boot/compressed/misc.c                             |  500 ++++++--
 b/arch/x86_64/boot/compressed/vmlinux.lds                        |   44 
 b/arch/x86_64/boot/compressed/vmlinux.scr                        |    5 
 b/arch/x86_64/boot/tools/build.c                                 |  232 +++-
 b/arch/x86_64/defconfig                                          |    1 
 b/arch/x86_64/kernel/acpi/sleep.c                                |   19 
 b/arch/x86_64/kernel/acpi/wakeup.S                               |  325 ++---
 b/arch/x86_64/kernel/e820.c                                      |   13 
 b/arch/x86_64/kernel/early_printk.c                              |    3 
 b/arch/x86_64/kernel/head.S                                      |  326 ++---
 b/arch/x86_64/kernel/head64.c                                    |   35 
 b/arch/x86_64/kernel/setup.c                                     |   29 
 b/arch/x86_64/kernel/setup64.c                                   |    1 
 b/arch/x86_64/kernel/smp.c                                       |    2 
 b/arch/x86_64/kernel/suspend.c                                   |    3 
 b/arch/x86_64/kernel/trampoline.S                                |  168 ++
 b/arch/x86_64/kernel/vmlinux.lds.S                               |    2 
 b/arch/x86_64/kernel/vsyscall.c                                  |   10 
 b/arch/x86_64/mm/fault.c                                         |    4 
 b/arch/x86_64/mm/pageattr.c                                      |   20 
 b/include/asm-generic/vmlinux.lds.h                              |    2 
 b/include/asm-i386/page.h                                        |    4 
 b/include/asm-x86_64/const.h                                     |   20 
 b/include/asm-x86_64/page.h                                      |   44 
 b/include/asm-x86_64/pgtable.h                                   |   39 
 b/include/asm-x86_64/proto.h                                     |    2 
 b/include/asm-x86_64/segment.h                                   |    4 
 b/include/asm-x86_64/suspend.h                                   |   13 
 b/include/linux/elf.h                                            |   27 
 b/include/linux/elf_boot.h                                       |   19 
 b/include/linux/screen_info.h                                    |    3 
 b/scripts/kallsyms.c                                             |   30 
 linux-2.6.17.noarch/arch/x86_64/mm/init.c                        |    2 
 linux-2.6.18-rc3-1M-root/arch/i386/Kconfig                       |   34 
 linux-2.6.18-rc3-1M-root/arch/i386/boot/bootsect.S               |    8 
 linux-2.6.18-rc3-1M-root/arch/i386/boot/compressed/head.S        |   28 
 linux-2.6.18-rc3-1M-root/arch/i386/boot/compressed/misc.c        |    7 
 linux-2.6.18-rc3-1M-root/arch/i386/boot/compressed/vmlinux.lds   |    3 
 linux-2.6.18-rc3-1M-root/arch/i386/kernel/vmlinux.lds.S          |    5 
 linux-2.6.18-rc3-1M-root/arch/powerpc/kernel/vmlinux.lds.S       |    1 
 linux-2.6.18-rc3-1M-root/arch/x86_64/boot/Makefile               |    3 
 linux-2.6.18-rc3-1M-root/arch/x86_64/boot/compressed/vmlinux.lds |    2 
 linux-2.6.18-rc3-1M-root/arch/x86_64/boot/tools/build.c          |  129 +-
 linux-2.6.18-rc3-1M-root/include/asm-i386/boot.h                 |    6 
 66 files changed, 3416 insertions(+), 1329 deletions(-)

Index: linux-2.6-x86-relocatable.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-x86-relocatable.patch,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- linux-2.6-x86-relocatable.patch	29 Aug 2006 20:15:55 -0000	1.1.2.3
+++ linux-2.6-x86-relocatable.patch	8 Sep 2006 02:46:15 -0000	1.1.2.4
@@ -1,3 +1,4 @@
+
 diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
 index daa75ce..a0707d7 100644
 --- a/arch/i386/Kconfig
@@ -5490,11 +5491,9 @@
  }
  
  static int __init enable_pagefaulttrace(char *str)
-diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
-index d14fb2d..5db93b9 100644
---- a/arch/x86_64/mm/init.c
-+++ b/arch/x86_64/mm/init.c
-@@ -167,89 +167,60 @@ __set_fixmap (enum fixed_addresses idx, 
+--- linux-2.6.17.x86_64.work-mem/arch/x86_64/mm/init.c	2006-09-07 17:44:05.000000000 -0400
++++ linux-2.6.17.x86_64.final2/arch/x86_64/mm/init.c	2006-09-07 18:39:17.000000000 -0400
+@@ -168,154 +168,101 @@ __set_fixmap (enum fixed_addresses idx, 
  
  unsigned long __initdata table_start, table_end; 
  
@@ -5523,8 +5522,8 @@
 -		*phys = __pa(adr);
 -		return adr;
 -	}
+-
 +	unsigned long pfn = table_end++;
- 
  	if (pfn >= end_pfn) 
  		panic("alloc_low_page: ran out of memory"); 
 -	for (i = 0; temp_mappings[i].allocated; i++) {
@@ -5553,8 +5552,9 @@
 -	ti = &temp_mappings[i];
 -	set_pmd(ti->pmd, __pmd(0));
 -	ti->allocated = 0; 
+-} 
 +	return pfn << PAGE_SHIFT;
- } 
++}
  
  /* Must run before zap_low_mappings */
  __init void *early_ioremap(unsigned long addr, unsigned long size)
@@ -5616,12 +5616,17 @@
  }
  
 -static void __meminit
+-phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end)
 +static void __init
- phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end)
++phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end)
  {
- 	int i;
-@@ -258,9 +229,8 @@ phys_pmd_init(pmd_t *pmd, unsigned long 
+-	int i = pmd_index(address);
++	int i;
+ 
+-	for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) {
++	for (i = 0; i < PTRS_PER_PMD; pmd++, i++, address += PMD_SIZE) {
  		unsigned long entry;
+-		pmd_t *pmd = pmd_page + pmd_index(address);
  
  		if (address >= end) {
 -			if (!after_bootmem)
@@ -5631,64 +5636,73 @@
 +				set_pmd(pmd, __pmd(0));
  			break;
  		}
+-		
+-		if (pmd_val(*pmd)) {
+-			printk (KERN_ERR "%s trying to trample pte entry \
+-				%lx@%lx\n",__func__,pmd_val(*pmd),address);
+-		}
  		entry = _PAGE_NX|_PAGE_PSE|_KERNPG_TABLE|_PAGE_GLOBAL|address;
-@@ -269,32 +239,13 @@ phys_pmd_init(pmd_t *pmd, unsigned long 
+ 		entry &= __supported_pte_mask;
+ 		set_pmd(pmd, __pmd(entry));
  	}
  }
  
 -static void __meminit
 -phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end)
 -{
--	pmd_t *pmd = pmd_offset(pud, (unsigned long)__va(address));
--
--	if (pmd_none(*pmd)) {
--		spin_lock(&init_mm.page_table_lock);
--		phys_pmd_init(pmd, address, end);
--		spin_unlock(&init_mm.page_table_lock);
--		__flush_tlb_all();
--	}
+-	pmd_t *pmd = pmd_offset(pud,0);
+-	spin_lock(&init_mm.page_table_lock);
+-	phys_pmd_init(pmd, address, end);
+-	spin_unlock(&init_mm.page_table_lock);
+-	__flush_tlb_all();
 -}
 -
--static void __meminit phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
+-static void __meminit phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end)
 +static void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
  { 
- 	long i = pud_index(address);
+-	int i = pud_index(addr);
++	long i = pud_index(address);
  
- 	pud = pud + i;
++	pud = pud + i;
  
--	if (after_bootmem && pud_val(*pud)) {
--		phys_pmd_update(pud, address, end);
--		return;
--	}
--
- 	for (; i < PTRS_PER_PUD; pud++, i++) {
+-	for (; i < PTRS_PER_PUD; i++, addr = (addr & PUD_MASK) + PUD_SIZE ) {
 -		int map; 
- 		unsigned long paddr, pmd_phys;
+-		unsigned long pmd_phys;
+-		pud_t *pud = pud_page + pud_index(addr);
++	for (; i < PTRS_PER_PUD; pud++, i++) {
++		unsigned long paddr, pmd_phys;
  		pmd_t *pmd;
  
-@@ -302,17 +253,16 @@ static void __meminit phys_pud_init(pud_
- 		if (paddr >= end)
+-		if (addr >= end)
++		paddr = (address & PGDIR_MASK) + i*PUD_SIZE;
++		if (paddr >= end)
  			break;
  
--		if (!after_bootmem && !e820_any_mapped(paddr, paddr+PUD_SIZE, 0)) {
+-		if (!after_bootmem && !e820_any_mapped(addr,addr+PUD_SIZE,0)) {
 +		if (!e820_any_mapped(paddr, paddr+PUD_SIZE, 0)) {
  			set_pud(pud, __pud(0)); 
  			continue;
  		} 
  
+-		if (pud_val(*pud)) {
+-			phys_pmd_update(pud, addr, end);
+-			continue;
+-		}
+-
 -		pmd = alloc_low_page(&map, &pmd_phys);
 -		spin_lock(&init_mm.page_table_lock);
 +		pmd_phys = alloc_low_page();
 +		pmd = early_ioremap(pmd_phys, PAGE_SIZE);
  		set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE));
- 		phys_pmd_init(pmd, paddr, end);
+-		phys_pmd_init(pmd, addr, end);
 -		spin_unlock(&init_mm.page_table_lock);
 -		unmap_low_page(map);
++		phys_pmd_init(pmd, paddr, end);
 +		early_iounmap(pmd, PAGE_SIZE);
  	}
  	__flush_tlb();
  } 
-@@ -345,7 +295,7 @@ static void __init find_early_table_spac
+@@ -348,7 +295,7 @@ static void __init find_early_table_spac
  /* Setup the direct mapping of the physical memory at PAGE_OFFSET.
     This runs before bootmem is initialized and gets pages directly from the 
     physical memory. To access them they are temporarily mapped. */
@@ -5697,7 +5711,7 @@
  { 
  	unsigned long next; 
  
-@@ -357,49 +307,28 @@ void __meminit init_memory_mapping(unsig
+@@ -360,49 +307,28 @@ void __meminit init_memory_mapping(unsig
  	 * mapped.  Unfortunately this is done currently before the nodes are 
  	 * discovered.
  	 */
@@ -5753,67 +5767,77 @@
  	__flush_tlb_all();
  }
  
-@@ -529,6 +458,91 @@ int memory_add_physaddr_to_nid(u64 start
+@@ -548,11 +474,100 @@ void online_page(struct page *page)
+  *	node id. So, return 0 as node id at this time.
+  */
+ #ifdef CONFIG_NUMA
++#ifndef CONFIG_ACPI_NUMA
+ int memory_add_physaddr_to_nid(u64 start)
+ {
+ 	return 0;
  }
  #endif
- 
-+static void
-+late_phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end)
++#endif
++
++static void 
++late_phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end)
 +{
-+	int i;
++	int i = pmd_index(address);
 +
-+	for (i = 0; i < PTRS_PER_PMD; pmd++, i++, address += PMD_SIZE) {
++	for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) {
 +		unsigned long entry;
++		pmd_t *pmd = pmd_page + pmd_index(address);
 +
-+		if (address >= end)
++		if (address >= end) 
 +			break;
++		
++		if (pmd_val(*pmd)) {
++			printk (KERN_ERR "%s trying to trample pte entry \
++				%lx@%lx\n",__func__,pmd_val(*pmd),address);
++		}
 +		entry = _PAGE_NX|_PAGE_PSE|_KERNPG_TABLE|_PAGE_GLOBAL|address;
 +		entry &= __supported_pte_mask;
 +		set_pmd(pmd, __pmd(entry));
 +	}
 +}
-+
-+static void
++static void 
 +late_phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end)
 +{
-+	pmd_t *pmd = pmd_offset(pud, (unsigned long)__va(address));
-+
-+	if (pmd_none(*pmd)) {
-+		spin_lock(&init_mm.page_table_lock);
-+		late_phys_pmd_init(pmd, address, end);
-+		spin_unlock(&init_mm.page_table_lock);
-+		__flush_tlb_all();
-+	}
++	pmd_t *pmd = pmd_offset(pud,0);
++	spin_lock(&init_mm.page_table_lock);
++	late_phys_pmd_init(pmd, address, end);
++	spin_unlock(&init_mm.page_table_lock);
++	__flush_tlb_all();
 +}
 +
-+static void late_phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
-+{
-+	long i = pud_index(address);
++static void  late_phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end)
++{ 
++	int i = pud_index(addr);
 +
-+	pud = pud + i;
-+
-+	if (pud_val(*pud)) {
-+		late_phys_pmd_update(pud, address, end);
-+		return;
-+	}
 +
-+	for (; i < PTR_PER_PUD; pud++, i++) {
-+		unsigned long paddr, pmd_phys;
++	for (; i < PTRS_PER_PUD; i++, addr = (addr & PUD_MASK) + PUD_SIZE ) {
++		int map; 
++		unsigned long pmd_phys;
++		pud_t *pud = pud_page + pud_index(addr);
 +		pmd_t *pmd;
 +
-+		paddr = (address & PGDIR_MASK) + i*PUD_SIZE;
-+		if (paddr >= end)
++		if (addr >= end)
 +			break;
 +
++		if (pud_val(*pud)) {
++			late_phys_pmd_update(pud, addr, end);
++			continue;
++		}
++
 +		pmd = (pmd_t *)get_zeroed_page(GFP_ATOMIC);
-+		phys_pmd = __pa(pmd);
++		pmd_phys = __pa(pmd);
 +
 +		spin_lock(&init_mm.page_table_lock);
 +		set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE));
-+		late_phys_pmd_init(pmd, paddr, end);
++		late_phys_pmd_init(pmd, addr, end);
 +		spin_unlock(&init_mm.page_table_lock);
 +	}
-+}
++} 
 +
 +/* Setup the direct mapping of the physical memory at PAGE_OFFSET.
 + * This runs after bootmem is initialized and gets pages normally.
@@ -5841,11 +5865,10 @@
 +	}
 +	__flush_tlb_all();
 +}
-+
+ 
  /*
   * Memory is added always to NORMAL zone. This means you will never get
-  * additional DMA/DMA32 memory.
-@@ -545,7 +559,7 @@ int arch_add_memory(int nid, u64 start, 
+@@ -570,7 +585,7 @@ int arch_add_memory(int nid, u64 start, 
  	if (ret)
  		goto error;
  
@@ -5854,7 +5877,7 @@
  
  	return ret;
  error:
-@@ -638,15 +652,6 @@ #endif
+@@ -685,15 +700,6 @@ void __init mem_init(void)
  		reservedpages << (PAGE_SHIFT-10),
  		datasize >> 10,
  		initsize >> 10);
@@ -5870,7 +5893,7 @@
  }
  
  void free_init_pages(char *what, unsigned long begin, unsigned long end)
-@@ -658,11 +663,11 @@ void free_init_pages(char *what, unsigne
+@@ -705,11 +711,11 @@ void free_init_pages(char *what, unsigne
  
  	printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
  	for (addr = begin; addr < end; addr += PAGE_SIZE) {
@@ -5887,7 +5910,7 @@
  		totalram_pages++;
  	}
  }
-@@ -672,17 +677,18 @@ void free_initmem(void)
+@@ -719,17 +725,18 @@ void free_initmem(void)
  	memset(__initdata_begin, POISON_FREE_INITDATA,
  		__initdata_end - __initdata_begin);
  	free_init_pages("unused kernel memory",
@@ -5910,7 +5933,7 @@
  		change_page_attr_addr(addr, 1, PAGE_KERNEL_RO);
  
  	printk ("Write protecting the kernel read-only data: %luk\n",
-@@ -701,7 +707,7 @@ #endif
+@@ -748,7 +755,7 @@ void mark_rodata_ro(void)
  #ifdef CONFIG_BLK_DEV_INITRD
  void free_initrd_mem(unsigned long start, unsigned long end)
  {
@@ -7127,3 +7150,6 @@
  		SCHED_TEXT
  		LOCK_TEXT
 _
+-- 
+Konrad Rzeszutek 1-(978)-392-3903 or 1-(617)-693-1718
+IBM on-site partner.




More information about the fedora-cvs-commits mailing list