[Hotplug_sig] acpi emulation for memory hotplug. [0/3] README

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 6 Jun 2006 18:25:27 -0700
Bryce Harrington <bryce at osdl.org> wrote:

> Could you point us at docs for using acpi for doing the hotplug mem add?
> 

I'll post my emulation patches and README in reply to this mail.
I know my illustration skill is not good enough to write long description.
please ask if something is unclear.

[0/3]  illustration, how to use
[1/3]  acpi_sci_emulation patch
[2/3]  acpi_memoryhotplug_emulation patch
[3/3]  hide system ram patch

Thanks,
-Kame

README
==

1. How to make the kernel for ACPI emulation

For acpi emulation, you have to write acpi's AML by yourself.
see also http://acpi.sourceforge.net/ , there are misc useful information.

1-1 download tools
you need acpi compiler tools

download ACPI CA - Unix Build Environment (.TAR.GZ 819KB)
from http://www.intel.com/technology/iapc/acpi/downloads.htm
 
 [kamezawa at casares src]$ tar xpzf acpica-unix-20060512.tar.gz
 [kamezawa at casares src]$ cd acpica-unix-20060512
 [kamezawa at casares acpica-unix-20060512]$ cd compiler/
 [kamezawa at casares compiler]$ make
 
you get 'iasl'
 
1-2 get your machine's original acpi DSDT information

 [kamezawa at casares compiler]$ su
 Password:
 [root at casares compiler]# cat /proc/acpi/dsdt  > dsdt.org

1-3 Because dsdt.org is binary, you have to decompile it.

 [kamezawa at casares compiler]$ iasl -d dsdt.org

 you get dsdt.dsl. this is human readble.
 
1-4 modify dsdt as you want
 modify dsdt.dsl by hand (how to modify will be described later.)
 
1-5 compile your dsdt
 
 [kamezawa at casares compiler]$ iasl -tc dsdt.dsl
 'dsdt.hex' is generated.
 You have to include this dsdt.hex to linux kernel at compile.
 
1-6 apply patches to before compiling your kernel 
 You can't do acpi-sci-emulation without patch.
 apply attached patches to your kernel.

[1] acpi_sci_emulation.patch  -- emulate notify
[2] acpi_memhotplug_emu.patch -- emulate power switch of memory
[3] hide-system-ram-resource.patch -- hide system ram information 
                                      for avoiding conflicts

1-7 configure your custom kernel

At first, say N (remove check) here:

 Device Drivers  ---> 
 	Generic Driver Options  --->
 		[ ] Select only drivers that don't need compile-time external firmware

Then, you can include your custom firmware.

Check this: 
 Power management and ACPI  --->
 	ACPI (Advanced Configuration and Power Interface) Support  --->
 		 [ ]   Include Custom DSDT (NEW)

Then, 

 () Custom DSDT Table file to include (NEW)

will appear. give the name of your custom 'dsdt.hex' file created in 1-5.
 
And check this:
  []   ACPI SCI Event Emulation Support 

1-8 make your kernel



2. How to edit DSDT for acpi memory hotplug.

For details, please read acpi spec.
This is test case for my environment.

I know my hardware(tiger4)'s memory is organized as
 0-2G
 4-8G
 10-12G.

But, be careful to efi's real memory map. 
you can get it from /proc/iomem (of unmodified kernel)

==
[kamezawa at casares linux-2.6.17-rc5-mm2]$ cat /proc/iomem | grep System
00000000-00000fff : System RAM
00001000-00006fff : System RAM
00007000-00008fff : System RAM
00009000-00081fff : System RAM
00084000-00084fff : System RAM
00085000-0009ffff : System RAM
00100000-03ffffff : System RAM
04000000-04a83fff : System RAM
04a84000-0ff7ffff : System RAM
0ff80000-0fffffff : System RAM
10000000-7d8fffff : System RAM
7d900000-7f97ffff : System RAM
7f980000-7f9fffff : System RAM
7fe96000-7ff39fff : System RAM
7ff3a000-7ff41fff : System RAM
100000000-1ffffdfff : System RAM
280000000-2fedf3fff : System RAM
2fedf4000-2fedf9fff : System RAM
2fedfa000-2fedfafff : System RAM
2fedfb000-2fef59fff : System RAM
2fef5a000-2fefb1fff : System RAM
2fefb2000-2fefb9fff : System RAM
2fefba000-2feffffff : System RAM
2ff000000-2ff453fff : System RAM
2ff454000-2ff800fff : System RAM
2ff801000-2ff8c5fff : System RAM
2ff8c6000-2ff8c7fff : System RAM
2ff8c8000-2ff8c9fff : System RAM
2ff8ca000-2ff9fbfff : System RAM
2ff9fc000-2ff9fcfff : System RAM
2ff9fd000-2ff9fffff : System RAM
2ffa00000-2ffd85fff : System RAM
2ffd86000-2ffdfffff : System RAM
2ffe00000-2ffe13fff : System RAM
2ffe80000-2fffb9fff : System RAM
==

How many small regions there are! ;)

it looks 4G-7G memory is contiguous. I'd like to add 3 of 1G memory 
modules at 4G-7G to original DSDT.


1. avoid confliction
If your original DSDT has memory object, remove it. it will confilcts.

2. Write Memory object.

Memory object is a device of Name(_HID,EISAID("PNP0C80")
This is example of hot-pluggable DSDT memory object.
put this under _SB object.
please see acpi spec for detail.

==
	Scope (\_SB)
    {
	<snip>
        Device(MEM1) {
                Name(_HID,EISAID("PNP0C80"))
                Name(_UID, 0)
                Name (L1st,0)
                Method(_PXM) {
                        return (0x0)
                }
                Method(_STA,0,NotSerialized) {
                        If ( LEqual(L1st,1) ) {
                                Return (0x0f)
                        } else {
                                Return (0x00)
                        }
                }
                Method(_PS0, 0, NotSerialized) {
                        Store(1,L1st)
                }
                Method(_CRS) {
                        Name(RT0,ResourceTemplate() {
                                QWordMemory(ResourceProducer,
                                        PosDecode,
                                        MinNotFixed,
                                        MaxNotFixed,
                                        Cacheable,
                                        ReadWrite,
                                        0,
                                        0x100000000,
                                        0x13fffffff,
                                        0,
                                        0x40000000,
                                        ,
                                        ,
                                        HP30)
                                })
                        Return (RT0)
                }
        }

==
Above one is an object for  memory 4G-5G, MEM1.


3. hot-add-test

we want to add 4G- memory fot test. Then, we need to hide 4G- memory from
the kernel. boot kernel with max_addr=2G

Then,
 [kamezawa at casares ~]$ cat /proc/meminfo
 MemTotal:      1925040 kB
 MemFree:       1529264 kB
 Buffers:         31712 kB
 Cached:         181488 kB
 SwapCached:          0 kB
 Active:         162400 kB
 Inactive:       170032 kB

Add MEM1 I added to my custom DSDT.
==
[root at casares kamezawa]# echo MEM1 1 > /proc/acpi/sci/notify
[root at casares kamezawa]# ls /sys/devices/system/memory/
block_size_bytes  memory0  memory1  memory4

memory4 is added.

[root at casares kamezawa]# echo online > /sys/devices/system/memory/memory4/state
[root at casares kamezawa]# cat /proc/meminfo
MemTotal:      2973616 kB
MemFree:       2561712 kB
Buffers:         31632 kB
Cached:         181568 kB
SwapCached:          0 kB
....
[root at casares kamezawa]#
==
Memory increased :)






[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux