mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aditya Garg <gargaditya08@live.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: Ard Biesheuvel <ardb@kernel.org>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Kerem Karabay <kekrby@gmail.com>,
	Orlando Chamberlain <orlandoch.dev@gmail.com>,
	"sharpenedblade@proton.me" <sharpenedblade@proton.me>
Subject: Re: [PATCH v3 0/2] efi/x86: Call set_os() protocol on dual GPU Macs
Date: Wed, 24 Jul 2024 16:26:58 +0000	[thread overview]
Message-ID: <MA0P287MB021789D73CAD62C16BCF0306B8AA2@MA0P287MB0217.INDP287.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <ZqElRH38f_XV3fKK@wunner.de>



> On 24 Jul 2024, at 9:31 PM, Lukas Wunner <lukas@wunner.de> wrote:
> 
> On Tue, Jul 23, 2024 at 04:25:19PM +0000, Aditya Garg wrote:
>>> On Wed, Jul 17, 2024 at 04:35:15PM +0000, Aditya Garg wrote:
>>> For the Macs having a single GPU, in case a person uses an eGPU,
>>> they still need this apple-set-os quirk for hybrid graphics.
>> 
>> Sending this message again as for some reason it got sent only to Lukas:
>> 
>> Full model name: Mac mini (2018) (Macmini8,1)
>> 
>> The drive link below has the logs:
>> 
>> https://drive.google.com/file/d/1P3-GlksU6WppvzvWC0A-nAoTZh7oPPxk/view?usp=drive_link
> 
> Some observations:
> 
> * dmesg-with-egpu.txt:  It seems the system was actually booted *without*
>  an eGPU, so the filename appears to be a misnomer.
> 
> * The two files in the with_apple_set_os_efi directory only contain
>  incomplete dmesg output.  Boot with log_buf_len=16M to solve this.
>  Fortunately the truncated log is sufficient to see what's going on.
> 
> * If the apple_set_os protocol is not used, the attached eGPU is not
>  enumerated by the kernel on boot and a rescan is required.
>  So neither the iGPU nor the eGPU are working.  The reason is BIOS
>  sets up incorrect bridge windows for the Thunderbolt host controller:
>  Its two downstream ports' 64-bit windows overlap.  The 32-bit windows
>  do not overlap.  If apple_set_os is used, the eGPU is using the
>  (non-overlapping) 32-bit window.  If apple_set_os is not used,
>  the attached eGPU is using the (overlapping, hence broken) 64-bit window.  
> 
>  So not only is apple_set_os needed to keep the iGPU enabled,
>  but also to ensure BIOS sets up bridge windows in a manner that is
>  only halfway broken and not totally broken.
> 
>  Below, 0000:06:01.0 and 0000:06:04.0 are the downstream ports on the
>  Thunderbolt host controller and 0000:09:00.0 is the upstream port of
>  the attached eGPU.
> 
>  iGPU enabled, no eGPU attached (dmesg.txt):
>  pci 0000:06:01.0:   bridge window [mem 0x81900000-0x888fffff]
>  pci 0000:06:01.0:   bridge window [mem 0xb1400000-0xb83fffff 64bit pref]
>  pci 0000:06:04.0:   bridge window [mem 0x88900000-0x8f8fffff]
>  pci 0000:06:04.0:   bridge window [mem 0xb8400000-0xbf3fffff 64bit pref]
> 
>  iGPU disabled, eGPU attached, apple_set_os not used (journalctl.txt):
>  pci 0000:06:01.0:   bridge window [mem 0x81900000-0x888fffff]
>  pci 0000:06:01.0:   bridge window [mem 0xb1400000-0xc6ffffff 64bit pref]
>  pci 0000:06:04.0:   bridge window [mem 0x88900000-0x8f8fffff]
>  pci 0000:06:04.0:   bridge window [mem 0xb8400000-0xbf3fffff 64bit pref]
>  pci 0000:06:04.0: bridge window [mem 0xb8400000-0xbf3fffff 64bit pref]: can't claim; address conflict with PCI Bus 0000:09 [mem 0xb1400000-0xbf3fffff 64bit pref]
> 
>  iGPU enabled, eGPU attached, apple_set_os used (working-journalctl.txt):
>  pci 0000:06:01.0:   bridge window [mem 0x81900000-0x888fffff]
>  pci 0000:06:01.0:   bridge window [mem 0xb1400000-0xc6ffffff 64bit pref]
>  pci 0000:06:04.0:   bridge window [mem 0x88900000-0x8f8fffff]
>  pci 0000:06:04.0:   bridge window [mem 0xb8400000-0xbf3fffff 64bit pref]
>  pci 0000:09:00.0:   bridge window [mem 0x81900000-0x81cfffff]
> 
> * As to how we can solve this and keep using apple_set_os only when
>  necessary:
> 
>  I note that on x86, the efistub walks over all PCI devices in the system
>  (see setup_efi_pci() in drivers/firmware/efi/libstub/x86-stub.c) and
>  retrieves the Device ID and Vendor ID.  We could additionally retrieve
>  the Class Code and count the number of GPUs in the system by checking
>  whether the Class Code matches PCI_BASE_CLASS_DISPLAY.  If there's
>  at least 2 GPUs in the system, invoke apple_set_os.

This also looks like a good idea, but I'm not well aware of the pci quirks in the Linux kernel. So, would consider it a bug report for the maintainers to fix.
> 
>  The question is whether this is needed on *all* Apple products or only
>  on newer ones.  I suspect that the eGPU issue may be specific to
>  recent products.  Ideally we'd find someone with a Haswell or Ivy Bridge
>  era Mac Mini and an eGPU who could verify whether apple_set_os is needed
>  on older models as well.
> 
>  We could constrain apple_set_os to newer models by checking for
>  presence of the T2 PCI device [106b:1802].  Alternatively, we could
>  use the BIOS date (DMI_BIOS_DATE in SMBIOS data) to enforce a
>  cut-off such that only machines with a recent BIOS use apple_set_os.
> 
> Thanks,
> 
> Lukas

  parent reply	other threads:[~2024-07-24 16:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01 14:09 Ard Biesheuvel
2024-07-01 14:09 ` [PATCH v3 1/2] efistub/x86: Enable SMBIOS protocol handling for x86 Ard Biesheuvel
2024-07-01 14:09 ` [PATCH v3 2/2] x86/efistub: Call Apple set_os protocol on dual GPU Intel Macs Ard Biesheuvel
2024-07-01 14:17 ` [PATCH v3 0/2] efi/x86: Call set_os() protocol on dual GPU Macs Lukas Wunner
2024-07-01 19:42 ` Aditya Garg
2024-07-17 16:35   ` Aditya Garg
2024-07-17 16:46     ` Ard Biesheuvel
2024-07-17 16:52       ` Aditya Garg
2024-07-17 18:27         ` Sharpened Blade
2024-07-17 18:58     ` Lukas Wunner
2024-07-23 16:25       ` Aditya Garg
2024-07-23 16:26         ` Aditya Garg
2024-07-24 16:01         ` Lukas Wunner
2024-07-24 16:21           ` Aditya Garg
2024-07-24 16:28             ` Lukas Wunner
2024-07-24 16:30               ` Aditya Garg
2024-07-24 16:26           ` Aditya Garg [this message]
2024-07-24 16:31             ` Lukas Wunner
2024-07-24 16:34               ` Aditya Garg
2024-07-25 12:42               ` Ard Biesheuvel
2024-07-25 12:58                 ` Aditya Garg
2024-07-25 12:39             ` Ard Biesheuvel
2024-07-25 12:55               ` Aditya Garg
2024-07-28 12:03           ` Orlando Chamberlain
2024-07-29  7:27             ` Ard Biesheuvel
2024-07-29  7:46               ` Aditya Garg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MA0P287MB021789D73CAD62C16BCF0306B8AA2@MA0P287MB0217.INDP287.PROD.OUTLOOK.COM \
    --to=gargaditya08@live.com \
    --cc=ardb@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=kekrby@gmail.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=orlandoch.dev@gmail.com \
    --cc=sharpenedblade@proton.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®