linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Linux script to enable ASPM / Documentation for ASPM
@ 2010-06-21 22:58 Luis R. Rodriguez
  2010-06-21 23:02 ` Luis R. Rodriguez
  0 siblings, 1 reply; 3+ messages in thread
From: Luis R. Rodriguez @ 2010-06-21 22:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-wireless, Martin Mares

ASPM was a dark magic when I first started looking at it. Some of it
is still dark but what I was able to understand with the help of
colleagues at work I've managed to stash here for now:

http://wireless.kernel.org/en/users/Documentation/ASPM

Then enabling ASPM was also quite a challenge and I always had to go
back and revisit the procedures, so to help with that instead I wrote
a script to do this for you correctly:

http://kernel.org/pub/linux/kernel/people/mcgrof/aspm/enable-aspm

Its sha1sum is: f5804fdab512065f219e55addf78c6654f1fc045

If any of that looks confusing refer to the documentation above.

There's a TODO there, so I'll get to the different items when I can
but if you like feel free to send me patches as well:

 TODO: patches are welcomed to me until we submit to to
       PCI Utilities upstream.

 This can be improved by in this order:

        * Accept arguments for endpoint and root complex address, and
          desired ASPM settings
        * Look for your ASPM capabilities by quering your
          LnkCap register first. Use these values to let you
          select whether you want to enable only L1 or L1 & L0s
        * Searching for your root complex for you
        * Search for your PCI device by using the driver
        * Disable your driver and ask to reboot ?
        * Rewrite in C
        * Write ncurses interface [ wishlist ]
        * Write GTK/QT interface [ wishlist ]
        * Submit upstream as aspm.c to the PCI Utilities, which are
          maintained by Martin Mares <mj@ucw.cz>

  Luis

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linux script to enable ASPM / Documentation for ASPM
  2010-06-21 22:58 Linux script to enable ASPM / Documentation for ASPM Luis R. Rodriguez
@ 2010-06-21 23:02 ` Luis R. Rodriguez
  2011-01-14  3:15   ` Luis R. Rodriguez
  0 siblings, 1 reply; 3+ messages in thread
From: Luis R. Rodriguez @ 2010-06-21 23:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-wireless, Martin Mares

On Mon, Jun 21, 2010 at 3:58 PM, Luis R. Rodriguez <mcgrof@gmail.com> wrote:
> ASPM was a dark magic when I first started looking at it. Some of it
> is still dark but what I was able to understand with the help of
> colleagues at work I've managed to stash here for now:
>
> http://wireless.kernel.org/en/users/Documentation/ASPM
>
> Then enabling ASPM was also quite a challenge and I always had to go
> back and revisit the procedures, so to help with that instead I wrote
> a script to do this for you correctly:
>
> http://kernel.org/pub/linux/kernel/people/mcgrof/aspm/enable-aspm
>
> Its sha1sum is: f5804fdab512065f219e55addf78c6654f1fc045
>
> If any of that looks confusing refer to the documentation above.
>
> There's a TODO there, so I'll get to the different items when I can
> but if you like feel free to send me patches as well:
>
>  TODO: patches are welcomed to me until we submit to to
>       PCI Utilities upstream.
>
>  This can be improved by in this order:
>
>        * Accept arguments for endpoint and root complex address, and
>          desired ASPM settings
>        * Look for your ASPM capabilities by quering your
>          LnkCap register first. Use these values to let you
>          select whether you want to enable only L1 or L1 & L0s
>        * Searching for your root complex for you
>        * Search for your PCI device by using the driver
>        * Disable your driver and ask to reboot ?
>        * Rewrite in C
>        * Write ncurses interface [ wishlist ]
>        * Write GTK/QT interface [ wishlist ]
>        * Submit upstream as aspm.c to the PCI Utilities, which are
>          maintained by Martin Mares <mj@ucw.cz>

Come to think of it, would this be welcomed upstream in the PCI utils
as is for now?

  Luis

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linux script to enable ASPM / Documentation for ASPM
  2010-06-21 23:02 ` Luis R. Rodriguez
@ 2011-01-14  3:15   ` Luis R. Rodriguez
  0 siblings, 0 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2011-01-14  3:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-wireless, Martin Mares

On Mon, Jun 21, 2010 at 4:02 PM, Luis R. Rodriguez <mcgrof@gmail.com> wrote:
> On Mon, Jun 21, 2010 at 3:58 PM, Luis R. Rodriguez <mcgrof@gmail.com> wrote:
>> ASPM was a dark magic when I first started looking at it. Some of it
>> is still dark but what I was able to understand with the help of
>> colleagues at work I've managed to stash here for now:
>>
>> http://wireless.kernel.org/en/users/Documentation/ASPM
>>
>> Then enabling ASPM was also quite a challenge and I always had to go
>> back and revisit the procedures, so to help with that instead I wrote
>> a script to do this for you correctly:
>>
>> http://kernel.org/pub/linux/kernel/people/mcgrof/aspm/enable-aspm
>>
>> Its sha1sum is: f5804fdab512065f219e55addf78c6654f1fc045
>>
>> If any of that looks confusing refer to the documentation above.
>>
>> There's a TODO there, so I'll get to the different items when I can
>> but if you like feel free to send me patches as well:
>>
>>  TODO: patches are welcomed to me until we submit to to
>>       PCI Utilities upstream.
>>
>>  This can be improved by in this order:
>>
>>        * Accept arguments for endpoint and root complex address, and
>>          desired ASPM settings
>>        * Look for your ASPM capabilities by quering your
>>          LnkCap register first. Use these values to let you
>>          select whether you want to enable only L1 or L1 & L0s
>>        * Searching for your root complex for you
>>        * Search for your PCI device by using the driver
>>        * Disable your driver and ask to reboot ?
>>        * Rewrite in C
>>        * Write ncurses interface [ wishlist ]
>>        * Write GTK/QT interface [ wishlist ]
>>        * Submit upstream as aspm.c to the PCI Utilities, which are
>>          maintained by Martin Mares <mj@ucw.cz>
>
> Come to think of it, would this be welcomed upstream in the PCI utils
> as is for now?

New version that'll work with new setpci.

http://kernel.org/pub/linux/kernel/people/mcgrof/aspm/enable-aspm
sha1sum:
f2e6e9a36ff7fe3b875229ee237f605d0695b18a

with this diff:

--- enable-aspm.old	2011-01-14 03:13:33.248428802 +0000
+++ enable-aspm	2011-01-14 03:12:51.711354522 +0000
@@ -161,11 +161,11 @@
 		exit
 	fi

-	SEARCH=$(setpci -s $1 34)
+	SEARCH=$(setpci -s $1 34.b)
 	# We know on the first search $SEARCH will not be
 	# 10 but this simplifies the implementation.
 	while [[ $SEARCH != 10 && $SEARCH_COUNT -le $MAX_SEARCH ]]; do
-		END_SEARCH=$(setpci -s $1 $SEARCH)
+		END_SEARCH=$(setpci -s $1 ${SEARCH}.b)

 		# Convert hex digits to uppercase for bc
 		SEARCH_UPPER=$(printf "%X" 0x${SEARCH})
@@ -176,7 +176,7 @@
 		fi

 		SEARCH=$(echo "obase=16; ibase=16; $SEARCH + 1" | bc)
-		SEARCH=$(setpci -s $1 $SEARCH)
+		SEARCH=$(setpci -s $1 ${SEARCH}.b)

 		let SEARCH_COUNT=$SEARCH_COUNT+1
 	done
@@ -200,7 +200,7 @@
 		return 1
 	fi

-	ASPM_BYTE_HEX=$(setpci -s $1 $ASPM_BYTE_ADDRESS)
+	ASPM_BYTE_HEX=$(setpci -s $1 ${ASPM_BYTE_ADDRESS}.b)
 	ASPM_BYTE_HEX=$(printf "%X" 0x${ASPM_BYTE_HEX})
 	# setpci doesn't support a mask on the query yet, only on the set,
 	# so to verify a setting on a mask we have no other optoin but
@@ -228,11 +228,11 @@
 	fi

 	# This only writes the last 3 bits
-	setpci -s $1 ${ASPM_BYTE_ADDRESS}=${ASPM_SETTING}:3
+	setpci -s $1 ${ASPM_BYTE_ADDRESS}.b=${ASPM_SETTING}:3

 	sleep 3

-	ACTUAL_ASPM_BYTE_HEX=$(setpci -s $1 ${ASPM_BYTE_ADDRESS})
+	ACTUAL_ASPM_BYTE_HEX=$(setpci -s $1 ${ASPM_BYTE_ADDRESS}.b)
 	ACTUAL_ASPM_BYTE_HEX=$(printf "%X" 0x${ACTUAL_ASPM_BYTE_HEX})

 	# Do not retry this if it failed, if it failed to set.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-14  3:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-21 22:58 Linux script to enable ASPM / Documentation for ASPM Luis R. Rodriguez
2010-06-21 23:02 ` Luis R. Rodriguez
2011-01-14  3:15   ` Luis R. Rodriguez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).