Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bbswitch cannot find acpi handle for MSI GT60 20C laptop's GTX 770M #72

Closed
RayfenWindspear opened this issue Oct 19, 2013 · 5 comments
Closed

Comments

@RayfenWindspear
Copy link

I have done everything I can think possible and have spent many hours trying to troubleshoot this issue, to no avail. I have whittled the issue down to what I believe to be the problem, but I am not sure where to go from here. Please assist!

I assume the problem to be thus:

[   21.445295] bbswitch: cannot find ACPI handle for VGA device 0000:01:00.0

cat /proc/acpi/dump_info 
0000:00:00.0 060000 
0000:00:01.0 060400 \_SB_.PCI0.P0P2
0000:00:02.0 030000 \_SB_.PCI0.GFX0
0000:00:14.0 0c0330 \_SB_.PCI0.XHC_
0000:00:16.0 078000 
0000:00:1a.0 0c0320 \_SB_.PCI0.EHC2
0000:00:1b.0 040300 \_SB_.PCI0.HDEF
0000:00:1c.0 060400 \_SB_.PCI0.RP01
0000:00:1c.2 060400 \_SB_.PCI0.RP03
0000:00:1c.3 060400 \_SB_.PCI0.RP04
0000:00:1c.4 060400 \_SB_.PCI0.RP05
0000:00:1d.0 0c0320 \_SB_.PCI0.EHC1
0000:00:1f.0 060100 \_SB_.PCI0.LPCB
0000:00:1f.2 010601 \_SB_.PCI0.SAT0
0000:00:1f.3 0c0500 \_SB_.PCI0.SBUS
0000:01:00.0 030000 
0000:03:00.0 020000 \_SB_.PCI0.RP03.PXSX
0000:04:00.0 028000 \_SB_.PCI0.RP04.PXSX
0000:05:00.0 ff0000 \_SB_.PCI0.RP05.PXSX

As you can see, my system does not report an acpi handle for my GPU.

I have done all the requested bug reporting stuff here:
https://bugs.launchpad.net/lpbugreporter/+bug/752542/comments/649

(Explained in the bug report) I can manually switch the GPU using the handles \_SB.PCI0.PEG0.PEGP._OFF and \_SB.PCI0.PEG0.PEGP._ON using acpi_call.

I wanted to try inserting these somewhere into the bbswitch code, but I don't know enough about how all this acpi stuff works to understand the code well enough.

Any assistance would be much appreciated.

EDIT: One interesting note is that using my manual method appears to be different than what happens when my system sleeps and wakes. Disabling the GPU manually using acpi_call, then sleep/wake cycling turns the GPU on, but I cannot use optirun/primusrun until I use acpi_call to turn it on, even though it IS on.

@RayfenWindspear
Copy link
Author

Here is my little acpi_call script:

#!/bin/sh

if ! lsmod | grep -q acpi_call; then
    insmod /usr/local/myscripts/acpi_call.ko
fi
acpi_call () {
    echo "$*" > /proc/acpi/call
    cat /proc/acpi/call
}


case "$1" in
off)
    echo $(acpi_call "\_SB.PCI0.PEG0.PEGP._OFF")
    echo "Turned off"
;;
on)
    echo $(acpi_call "\_SB.PCI0.PEG0.PEGP._ON")
    echo "Turned on"
;;
*)
    echo "Usage: $0 [on|off]"
esac

@Lekensteyn
Copy link
Member

_ON and _OFF are wrong, see https://github.com/Lekensteyn/acpi-stuff/blob/master/notes.txt.

Can you try kernel 3.12? There have been bugs like these in the past, such as #2 and #65. You can also try extending the acpi-handle-hack from the hack-lenovo branch for time time being. The handle for 01:00.0 should be \_SB.PCI0.PEG0.PEGP.

Can you also post your full dmesg somewhere? On https://gist.github.com or something, not here.

@RayfenWindspear
Copy link
Author

Thank you for your reply. Here is my dmesg
https://gist.github.com/RayfenWindspear/7059900

I modified my script to use the calls from the document you posted. These ones work after changing the acpi handle to match my _SB.PCI0.PEG0.PEGP

turning the nvidia card off

\_SB.PCI0.P0P2.PEGP._DSM {0xF8,0xD8,0x86,0xA4,0xDA,0x0B,0x1B,0x47,0xA7,0x2B,0x60,0x42,0xA6,0xB5,0xBE,0xE0} 0x100 0x1A {1,0,0,3}
\_SB.PCI0.P0P2.PEGP._PS3

turning the nvidia card on

\_SB.PCI0.P0P2.PEGP._PS0

As of now I am unable to try another kernel. I need this specific one for my AI class I am currently in.

As far as the acpi-handle-hack is concerned, I modified the need_acpi_handle_hack function to simply return true; but all I get is:
[ 13.131502] acpi_handle_hack: No ACPI handle found for discrete video card

If this issue will be completely resolved by using a a newer kernel, then I can wait until this semester is over and then update. The only reason I am attached to this kernel is for my AI class.

@Lekensteyn
Copy link
Member

Your specific laptop could use this hack (all safeguards are removed, do not use it on other laptops, it could crash your kernel):

diff --git a/acpi-handle-hack.c b/acpi-handle-hack.c
index af5f3cf..ed0a198 100644
--- a/acpi-handle-hack.c
+++ b/acpi-handle-hack.c
@@ -38,6 +38,7 @@ static bool __init need_acpi_handle_hack(void) {
        || (dmi_match(DMI_SYS_VENDOR, "LENOVO") && dmi_match(DMI_PRODUCT_NAME, "PIQY0")) /* Lenovo IdeaPad Y570 */
        || dmi_match(DMI_PRODUCT_NAME, "Aspire V5-573G")
        || dmi_match(DMI_PRODUCT_NAME, "Aspire V5-573PG")
+       || 1
        ;
 }

@@ -70,8 +71,7 @@ static void dev_set_acpi_handle(struct pci_dev *pdev, acpi_handle handle) {
 }

 static int __init hack_apply(void) {
-   acpi_handle tmp_handle, new_handle;
-   struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
+   acpi_handle new_handle;
    if (!need_acpi_handle_hack()) {
        pr_err("Machine does not need ACPI handle hack\n");
        return -ENODEV;
@@ -82,37 +82,14 @@ static int __init hack_apply(void) {
        return -ENODEV;
    }
    orig_handle = DEVICE_ACPI_HANDLE(&dis_dev->dev);
-   if (!orig_handle) {
-       pr_err("No ACPI handle found for discrete video card\n");
-       goto free_dev;
-   }
-   if (ACPI_FAILURE(acpi_get_name(orig_handle, ACPI_SINGLE_NAME, &buf))) {
-       pr_err("Could not acquire name for discrete video card\n");
-       goto free_dev;
-   }
-   if (strcmp((char *)buf.pointer, "PEGP") == 0) {
-       pr_err("Handle has already been changed to PEGP\n");
-       goto free_name;
-   }
-   /* \_SB.PCI0.PEG0.VGA_ -> \_SB.PCI0.PEG0.PEGP */
-   if (ACPI_FAILURE(acpi_get_parent(orig_handle, &tmp_handle))) {
-       pr_err("No parent device found for %s\n", (char *)buf.pointer);
-       goto free_name;
-   }
-   if (ACPI_FAILURE(acpi_get_handle(tmp_handle, "PEGP", &new_handle))) {
-       pr_err("No PEGP handle found on %s\n", (char *)buf.pointer);
-       goto free_name;
+   if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB.PCI0.PEG0.PEGP", &new_handle))) {
+       pr_err("No PEGP handle found\n");
+       return -ENODEV;
    }
    pr_info("Setting new ACPI handle for discrete video card\n");
    dev_set_acpi_handle(dis_dev, new_handle);
-   kfree(buf.pointer);
    pci_dev_put(dis_dev);
    return 0;
-free_name:
-   kfree(buf.pointer);
-free_dev:
-   pci_dev_put(dis_dev);
-   return -ENODEV;
 }

 static void __exit hack_undo(void) {

You can install a new kernel next to your current kernel, so why wait for so long? The packages you need are linux-headers-..._amd64.deb, linux-headers-..._all.deb, linux-image-....amd64.deb. Get them from http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.11.6-saucy/. If that does not work, try http://kernel.ubuntu.com/~kernel-ppa/mainline/daily/current/. If you still have issues, it is a new bug.

@RayfenWindspear
Copy link
Author

I forget that it is easy to manage kernels in linux. I got the new kernel and all appears to be well with bbswitch. It finds the handle and I can switch the gfx on and off. I guess the 3.8 kernel doesn't like my laptop. Thanks for all your help. I will permanently upgrade my kernel after this semester is over.

And yes, the hack you posted works too. Thanks again!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants