Skip to content

General Discussion #7

Open
Open

Description

@qzed

Issue for general discussions.

Activity

  1. added
    A: MetaArea: Project organization etc.
    on Jun 7, 2022
  2. pinned this issue on Jun 7, 2022
  3. jhaxhiaj commented on Jun 7, 2022

    @jhaxhiaj

    I spent some effort to enable KVM for Linux on Surface Pro X but didn't succeed so far.
    Maybe this deserves its own issue.

    By default Linux boots in Exception Level 1 (Supervisor Level).
    In order to enable KVM, Linux must execute in Exception Level 2 (Hypervisor Level).
    My guess is that the UEFI Firmware is configured to boot every image (Windows Bootloader, USB Media, etc) in exception level 1.
    However Windows for ARM includes a functional Hyper-V (which requires execution in EL2).
    There must be a channel to unlock instruction execution in EL2.

    The boot procedure on Surface Pro X looks similar to x86_64.
    UEFI FIRWMARE -> bootmgrfw.efi -> winload.efi​ -> hvloader.dll ...
    _xeroxz describes it here https://git.back.engineering/_xeroxz/Voyager

    There is a lot of assumption below:
    The first method to execute arbitrary code in EL2 would to via a synchronous exception call to EL2 (HVC). Instruction address can be passed via general purpose register. This require a specific exception handler at EL2 which branches to the instruction address.

    The second method is similar to the first but via the secure monitor in EL3 (hvc)

    I see a lot of hvc and smc calls from hvloader.dll in Ghidra however Windows does not provide public symbols for hvloader.dll, which complicate its reverse engineering .
    UEFI firmware

    Edit: A good starting point would be to dump the content of the exception tables in EL3 and EL2.
    However this can not be done from EL1 because VBAR_EL2,3 can't be accessed from EL1.
    I will see if this can be extracted from a UEFI firmware update and analyze them offline

  4. qzed commented on Jun 7, 2022

    @qzed
    MemberAuthor

    Feel free to open a new issue for that! Unfortunately, this is something I know practically nothing about. But having KVM support would be awesome.

  5. liuyishengalan commented on Jun 12, 2022

    @liuyishengalan

    Thanks for your contribution to making Linux usable on SPX.
    I have no experience in making Adreno GPU work in Linux, can you provide more detailed steps to guide us.
    Currently, I installed the xf86-video-freedreno package in Arch Linux ARM and face a problem:
    Xorg.0.log:
    NO msm DRM/KMS, fallingback to fbdev/kgsl
    GUI can show up without freedreno -> no GPU acceleration.
    The kernel was compiled using spx/next-20220607 branch/ and boot up with DT.

  6. qzed commented on Jun 12, 2022

    @qzed
    MemberAuthor

    Can you post a full dmesg log? Also what's the putput of ls -l /sys/class/drm?

    In terms of user-space software, I only explicitly installed mesa (next to gnome on Arch, which may have pulled in some other dependencies). I haven't tried with xorg yet (only Wayland), but that shouldn't really make a difference.

  7. liuyishengalan commented on Jun 12, 2022

    @liuyishengalan

    There are no files under /sys/class/drm directory. My SPX cannot connect to the internet via a USB ethernet port, that's a bit hard to post the log. I will try to use mesa driver to see if anything will work.

  8. qzed commented on Jun 13, 2022

    @qzed
    MemberAuthor

    In that case, I don't think mesa will work either. Does /sys/bus/platform/devices/2c00000.gpu exist?

  9. liuyishengalan commented on Jun 13, 2022

    @liuyishengalan

    2c00000.gpu does exist.

  10. qzed commented on Jun 13, 2022

    @qzed
    MemberAuthor

    Do you have an SQ1 or SQ2? Also at this point I think we need a dmesg log.

  11. liuyishengalan commented on Jun 13, 2022

    @liuyishengalan
  12. qzed commented on Jun 13, 2022

    @qzed
    MemberAuthor

    Okay, so might be a difference between SQ1 and SQ2. What about cat /sys/kernel/debug/devices_deferred?

  13. liuyishengalan commented on Jun 13, 2022

    @liuyishengalan

    /sys/kernel/debug/devices_deferred is a blank file

  14. qzed commented on Jun 13, 2022

    @qzed
    MemberAuthor

    That means that no devices (that have drivers) wait on other drivers to load. I can't seem to find any reference to pretty much anything GPU related in your dmesg log. Can you post your kernel config?

  15. liuyishengalan commented on Jun 13, 2022

    @liuyishengalan

    The config I used is spx-5.19.rc1-arch.config

  16. 24 remaining items

  17. matterhorn103 commented on Jan 16, 2024

    @matterhorn103

    Ah, that does seem like a quite a lot of hoops still yeah...

  18. superxkooda commented on Mar 11, 2025

    @superxkooda

    Set this up yesterday, finished setting up hyprland today. This rocks man! A few things still not working but this is to be expected with what is ultimately a niche device to want to have Linux on. Never mind the the hoops to get everything that is working working! Thank you, this breaths new life into my little machine.

    The last thing to do to make this perfect is to figure out how to get iptsd to start via a udev rule. I applied the one from the repo, along with the unit file. Udev rules are a bit of a mystery for me, I tend to get them working and it isn't an issue until I have to setup a new system. I have to be missing something silly.

    cat /etc/udev/rules.d/50-iptsd.rules 
    SUBSYSTEM=="hidraw", ACTION=="add", TAG+="systemd", \
    	PROGRAM="/usr/bin/iptsd-check-device --quiet $env{DEVNAME}", \
    	PROGRAM="/bin/systemd-escape --path $env{DEVNAME}", \
    	ENV{SYSTEMD_WANTS}+="iptsd@$result.service"
    

    and the unit file looks like the following:

    cat /etc/systemd/system/iptsd\@.service 
    [Unit]
    Description=Intel Precise Touch & Stylus Daemon
    Documentation=https://github.com/linux-surface/iptsd
    StopWhenUnneeded=yes
    BindsTo=%i.device
    
    [Service]
    Type=simple
    ExecStart=@bindir@/iptsd /%I
    

    I am able to get this to run manually by simply using this run line sudo iptsd $( sudo iptsd-find-hidraw) and it works as you would expect. Alas the udev rules do not run, and I am not entirely sure why just yet.

    If you have an idea, thanks! If you need more info, no problem. If you are unable to help, also ok, I will update if I figure it out.

  19. qzed commented on Mar 11, 2025

    @qzed
    MemberAuthor

    Does running iptsd-check-device manually work? I guess if iptsd-find-hidraw works it should...

  20. superxkooda commented on Mar 12, 2025

    @superxkooda

    iptsd-find-hidraw appears to be depreciated.

    $ sudo iptsd-find-hidraw
    [10:16:55.752] [warning] iptsd-find-hidraw is deprecated, please use iptsd-foreach
    /dev/hidraw0
    

    To the udev rule.
    iptsd-check-device exits with a 0 if the device is the hidraw we are after and a 1 if not. The udev rule appears to be checking every single hidraw${N} in /dev/ and should only attempting to start the service for a good device.
    eg via journalctl

    hidraw4: Process '/usr/bin/iptsd-check-device --quiet /dev/hidraw4' failed with exit code 1.
    

    The provided udev rule appears to be trying and failing to find the device before launching hyprland. I do not have it booting into a graphical login.

    hidraw0: Process '/usr/bin/iptsd-check-device --quiet /dev/hidraw0' failed with exit code 1.
    

    If ran manually after starting a wayland session, in this case hyprland, it looks like it should have worked just fine.

    $ sudo /usr/bin/iptsd-check-device --quiet /dev/hidraw0
    $ echo $?
    0
    

    without the quiet option

    /dev/hidraw0 is an IPTS device!
    $ sudo /usr/bin/iptsd-check-device  /dev/hidraw0
    [10:24:01.548] [info] Loading config /etc/iptsd.conf.
    [10:24:01.548] [info] Connected to device 045E:0C21
    [10:24:01.548] [info] Running in Touchscreen mode
    [10:24:01.548] [info] /dev/hidraw0 is an IPTS device!
    
    # Another hidraw device for good measure.
    
    $ sudo /usr/bin/iptsd-check-device  /dev/hidraw4
    [10:24:04.209] [error] ipts: /dev/hidraw4 is not an IPTS device!
    

    I expect the issue may be with when the rule is triggered, because the command will exit with an error if I try it from a tty. Going to play with attempt to adjust how it is triggered, and see if it can be triggered when wayland starts.

    On a side note about the unit file. I have tried manually running the unit file but was finding it would kill the process immediately. I had started to remove parts to see if any particular setting was an issue. Removing the BindTo directive in the unit file seems to keep it running. Not sure why yet as the device exists. The %i is the escaped device path eg dev-hidraw0 in this case, and my understanding is that should be correct.

  21. qzed commented on Mar 12, 2025

    @qzed
    MemberAuthor

    The provided udev rule appears to be trying and failing to find the device before launching hyprland. I do not have it booting into a graphical login.

    Can you try removing --quiet option? Any chance it could be a permission error (e.g., udev not running iptsd-check-device as root)?

  22. superxkooda commented on Mar 13, 2025

    @superxkooda

    I am an idiot, the rule was never triggering unless I manually ran udevadm trigger manually, and had mistaken the few instances in journalctl's output as had happened during boot.

    Will have to tackle the triggering issue later. For now going to trigger via udevadm.

    To your point, good idea. I cannot output to standard out because the output is used as the value for $result. Redirecting the output to a file is the way here. I modified the udev rule to be the following

    SUBSYSTEM=="hidraw", ACTION=="add", TAG+="systemd", \
    	PROGRAM="/bin/bash -c 'echo $env{DEVNAME} >> /tmp/iptsd.rule.out; /usr/bin/iptsd-check-device $env{DEVNAME} 2>&1 >> /tmp/iptsd.rule.out' && exit 0 || exit 1", \
    	PROGRAM="/bin/systemd-escape --path $env{DEVNAME}", \
    	ENV{SYSTEMD_WANTS}+="iptsd@$result.service"
    

    The output in /tmp/iptsd.rule.out

    /dev/hidraw0
    [20:12:17.358] [error] core: linux: IOCTL 3229108231 failed: No such device
    /dev/hidraw2
    /dev/hidraw1
    [23:59:26.861] [error] ipts: /dev/hidraw2 is not an IPTS device!
    [23:59:26.861] [error] ipts: /dev/hidraw1 is not an IPTS device!
    /dev/hidraw3
    [23:59:26.872] [error] ipts: /dev/hidraw3 is not an IPTS device!
    /dev/hidraw4
    [23:59:26.971] [error] ipts: /dev/hidraw4 is not an IPTS device!
    /dev/hidraw4
    [23:59:27.024] [error] ipts: /dev/hidraw4 is not an IPTS device!
    

    Interesting result, it appears hidraw0 is not found at all when ran by a udev rule. Has to be a funky permission issue. Ultimately also may be why the job is not triggering. Going to shove a whoami into that and see if it isn't root tomorrow.

    Thanks again, I think you have me pointed in the correct direction here.

    :edit: The rules are running as root, guess it is not a permissions issue. Will continue to dig.

  23. qzed commented on Mar 13, 2025

    @qzed
    MemberAuthor

    Hmm, if triggering it manually late after boot still doesn't work then it shouldn't be a driver initialization issue. Maybe you can ask on the IPTSd repo directly, @StollD might have a better idea about what could be going wrong.

  24. superxkooda commented on Mar 18, 2025

    @superxkooda

    Thank you, I will to do that. Much appreciated.

  25. almenscorner commented on Jul 27, 2025

    @almenscorner

    Hi, this is fantastic! I managed to get arch running smoothly on my SPX but there is one thing I just cannot get working which is Bluetooth. I've followed the wiki and have all firmware installed. Using bluetoothctl I'm not able to see the controller. Any pointers as to what else I need to do?

  26. denysvitali commented on Jul 27, 2025

    @denysvitali

    Hi, this is fantastic! I managed to get arch running smoothly on my SPX but there is one thing I just cannot get working which is Bluetooth. I've followed the wiki and have all firmware installed. Using bluetoothctl I'm not able to see the controller. Any pointers as to what else I need to do?

    See #47

  27. jglathe commented on Jul 27, 2025

    @jglathe

    Hmm on sc8280xp I have a default MAC address set by the dt to avoid issues bringing up the BT host controller.

    &uart2 {
    	pinctrl-0 = <&uart2_default>;
    	pinctrl-names = "default";
    
    	status = "okay";
    
    	bluetooth {
    		compatible = "qcom,wcn6855-bt";
    
    		vddrfacmn-supply = <&vreg_pmu_rfa_cmn_0p8>;
    		vddaon-supply = <&vreg_pmu_aon_0p8>;
    		vddwlcx-supply = <&vreg_pmu_wlcx_0p8>;
    		vddwlmx-supply = <&vreg_pmu_wlmx_0p8>;
    		vddbtcmx-supply = <&vreg_pmu_btcmx_0p8>;
    		vddrfa0p8-supply = <&vreg_pmu_rfa_0p8>;
    		vddrfa1p2-supply = <&vreg_pmu_rfa_1p2>;
    		vddrfa1p8-supply = <&vreg_pmu_rfa_1p7>;
    
    		max-speed = <3200000>;
    
    		local-bd-address = [ 8d fd f0 00 5a ad ];
    	};
    }
    

    Maybe something similar?

  28. denysvitali commented on Jul 27, 2025

    @denysvitali

    Yes, it's the same issue

  29. almenscorner commented on Jul 28, 2025

    @almenscorner

    I just reinstalled firmware and it popped up in bluez without issues. Maybe I poked around to much

  30. gibfesta commented on Nov 20, 2025

    @gibfesta

    hi there, after a long and frustrating month i managed to install arch onto my spq1!

    however, i am having issues with the sound and bluetooth. i get dummy output for sound and for bluetooth even though i see it i cant get it to connect.

    it also appears as though i have problems with the graphics card as with some apps i get the scrambled colours.

    any thoughts on this?

    thanks

  31. McGeoMetro0045 commented on Feb 21, 2026

    @McGeoMetro0045

    Hello there.. is it at all possible for someone to give me an image they made or build me a working image to use.. while arch is not my first choice i would very much enjoy using linux on my device with the current state of windows and cannot find any images on the internet, i do not wish to build my own if possible

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A: MetaArea: Project organization etc.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions