Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
X session fails with ATI Radeon HD 4670 - KMS /radeon driver
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4  Next  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54266
Location: 56N 3W

PostPosted: Mon Jul 20, 2020 9:57 pm    Post subject: Reply with quote

Pums,

There are lots of ways of keeping the build box and clients in sync and sharing and installing the binaries once you have them.
You can share the repo(s) and binaries over NFS.
Set up some form of server.
Sync using rsync ... which is what portage uses to update the local copy of the repo.

As you say, its all in the guide that you linked.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Tue Jul 21, 2020 4:07 pm    Post subject: Reply with quote

EDIT: Actually, it's easy to summarize it all, no real need to read more: radeon's module is the culprit. If I blacklist it at boot (modprobe.blacklist=radeon), I can have a console, log in, run commands... But X doesn't work. With radeon, black screen, no visible console, no visible prompt, I can startx but can't see anything and twm is "defunct". Shouldn't I try to build it (EDIT: ie. radeon) in along with the firmwares?

The following is useless umho...
-----
I did several trials (I did not use nomodeset boot kernel parameter) . I think 2) is the really interesting one, so maybe read it first:

1) A minimalistic kernel (-v3), based on one that I have working fine on the powerful computer, I've only tried to make changes for it to handle the mac's hardware config (specially radeon graphic driver and network devices).

On boot, screen is completely black (no "loading iniramfs", no prompt, nothing; with previous kernels, screen used to turn black after displaying openrc's "Checking local filesystems"). Like with previous kernels, though I can't see anything at all on the screen, I can log in on a tty and startx. sshd works and I could check that X seemed to start, with a defunct twm process, as it happened already.

* zcat /proc/config.gz
* dmesg (the first line shows "(root@sed2)", sed2 is the powerful computer that made the kernels; Mac's hostname is "mac". I did not change conf.d/hostname nor /etc/host in the chroot tree, it still has the default "localhost". I don't know whether it can be a problem and I'd rather change that.)
* lspci -nnk
* lsmod
* Xorg.0.org

2) I used a genkernel's default config kernel (-v5), but I forgot to copy the corresponding modules in /lib/modules. For the first time ever, I could boot Linux without nomodeset parameter and display was right, regular console prompt, I could log in, run commands. But, logically, no network, plenty of errors and startx fails immediately.

* zcat /proc/config.gz (but modules were not used !)
* dmesg
* lsmod
* lspci -nnk
* Xorg.0.org

3) If I use the same kernel and add the forgotten modules for this kernel in /lib/modules, it seems like it used to be with older kernels: screen turns black after displaying some openrc messages, no prompt, nothing. startx results just like with the minimalistic kernel: twm defunct, screen empty since boot time.

Config is the same as -v5, but modules were usable.

*dmesg
*lsmod
*lspci -nnk
*Xorg.0.log

I've used this xorg.conf:

Code:
Section "Device"
    Identifier  "OnBoard Radeon"
    Driver      "modesetting"
#    BusID  "pci:bus:dev:func"
EndSection


With default genkernel without modules I've tried to change "modesetting" for "vesa" and comment/uncomment BusId line, but it did not seem to change anything.


Last edited by Pums on Tue Jul 21, 2020 10:09 pm; edited 2 times in total
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Tue Jul 21, 2020 8:41 pm    Post subject: Reply with quote

I've made a new kernel (v6) with minimalistic configuration, with built-in radeon driver and firmware:

Code:

$ zcat /proc/config.gz |grep -i radeon
CONFIG_LOCALVERSION="-x86_64-v6radeonBuiltIn"
CONFIG_EXTRA_FIRMWARE="radeon/R700_rlc.bin radeon/RV730_smc.bin radeon/RV710_uvd.bin radeon/RV730_me.bin radeon/RV730_pfp.bin"
CONFIG_DRM_RADEON=y
CONFIG_DRM_RADEON_USERPTR=y
# CONFIG_FB_RADEON is not set



> Complete config

At boot, I can hardly see the few first messages (not even "openrc"), the screen becomes black quickly, and as usual, no visible prompt, no visible console. Though I can't see anything, I can log in in a tty and startx, twm <defunct> once again.

* dmesg
* lsmod
* Xorg.0.log

If my understanding is correct, built-in radeon is loaded sooner, and so the screen turns black sooner...
Back to top
View user's profile Send private message
theotherjoe
Guru
Guru


Joined: 22 Nov 2003
Posts: 393

PostPosted: Wed Jul 22, 2020 9:13 am    Post subject: Reply with quote

Pums,

from dmesg in 2) one can see that there is no display problem as long as the system
only plays with the efifb VGA console.

Now, I have been through the dmesg ouput in your last post and from what I see there
is no indication of problems with the radeondrmfb.

I have a hunch but since I dont have much experience with apple hardware I might
be on a wrong track.
My suspicion is that there is nothing wrong with the radeon driver. The backlight driver
simply turns off the backlight, hence you cant see anything on the screen once
radeon driver has taken over.
I wonder what would happen if you would compile the apple backlight driver into the kernel
(just like the radeon driver) instead of having it as a module?
Code:
Graphics support  --->  Backlight & LCD device support  --->  [*]   Apple Backlight Driver
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Wed Jul 22, 2020 3:51 pm    Post subject: Reply with quote

theotherjoe,

Although I don't understand much (see personal note below), I've made a new kernel (-v7) retrieving the previous config (-v6) only with the change you've suggested (CONFIG_BACKLIGHT_APPLE=y).

I could not see any difference with -v6 kernel : some messages displayed very quickly, and screen turns black even before openrc shows anything, no visible prompt, no visible console; from that moment screen remains empty, if I startx "blindly" from a tty, "ps -A" shows a "defunct" twm process.

Code:
$ zcat /proc/config.gz |grep -i 'radeon\|backlight_apple'
CONFIG_LOCALVERSION="-x86_64-v7radeon+backlightBuiltIn"
CONFIG_EXTRA_FIRMWARE="radeon/R700_rlc.bin radeon/RV730_smc.bin radeon/RV710_uvd.bin radeon/RV730_me.bin radeon/RV730_pfp.bin"
CONFIG_DRM_RADEON=y
CONFIG_DRM_RADEON_USERPTR=y
# CONFIG_FB_RADEON is not set
CONFIG_BACKLIGHT_APPLE=y


* Config
* dmesg
* Xorg.0.log


Personal note: I have a technical and hardware knowledge very limited, and my English is quite poor, which doesn't help. While configuring kernels I've been wondering what could be the purpose of all the "backlight" options and I figured out it had to be the control of extra lighting like one can find for example on some keyboards, and had nothing to do with the display on the screen's computer; so I thought I had no hardware using backlight. I was wrong and your suggestion that the problem would be a backlight one rather than a driver's one is interesting and may be a/the track to follow.

Edit: All that makes me think a lot and realize that, for example, if I try to compare the black screen I'm getting on boot time with the black screen I can get when, using "nomodeset" so to have a console working, the computer eventually hangs or when the screensaver is activated, there's a difference: in the first case I have no... backlight. It seems like the screen is completely switched off, whereas when the mac hangs one still can see a sort of "glow".


Last edited by Pums on Wed Jul 22, 2020 4:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
Child_of_Sun_24
Guru
Guru


Joined: 28 Jul 2004
Posts: 578

PostPosted: Wed Jul 22, 2020 4:19 pm    Post subject: Reply with quote

Do you have CONFIG_DRM_FBDEV_EMULATION enabled in your kernel config ?

It's under Device Drivers -> Graphics support -> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) -> Enable legacy fbdev support for your modesetting driver

Maybe it helps.
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Wed Jul 22, 2020 4:34 pm    Post subject: Reply with quote

Child_of_Sun_24 wrote:
Do you have CONFIG_DRM_FBDEV_EMULATION enabled in your kernel config ?


I do:

Code:
$ zcat /proc/config.gz |grep FBDEV
CONFIG_DRM_FBDEV_EMULATION=y
CONFIG_DRM_FBDEV_OVERALLOC=100
CONFIG_XEN_FBDEV_FRONTEND=y
Back to top
View user's profile Send private message
theotherjoe
Guru
Guru


Joined: 22 Nov 2003
Posts: 393

PostPosted: Thu Jul 23, 2020 7:19 am    Post subject: Reply with quote

well, Pums,
as I said, I might be wrong there :(
Mrs Google also didnt come up with a solution but it seems to be
a known problem. Found a thread from ubuntuforums about iMac with radeon.
describing the same problem with the console and without any solution.
Best bet would probably be to disable framebuffer console altogether and
go with plain VGA console:
Graphics support --> Console display driver support -->
Framebuffer Console support
That leaves the problem around Xorg. You probably will have to play
with the two options for the radeon driver, compiled into kernel or as module

edit: tried without framebuffer console on my system. but that clashes with
kernel mode setting :( that reduces your options even furher.

edit2: found this article about Macs EFI and Linux, maybe
you can get some clues from it
http://refit.sourceforge.net/myths/
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Thu Jul 23, 2020 11:17 pm    Post subject: Reply with quote

Thank you very much,

I need to understand better how Linux handles graphic hardware . I have tracks to explore and I will run tests in the next few days. I'll tell you more if needed.

Eventually, we may find or not a solution, but anyway I'll have learnt a lot thanks to the help I've received!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54266
Location: 56N 3W

PostPosted: Fri Jul 24, 2020 6:29 pm    Post subject: Reply with quote

Pums,

When you prevent the radeon kernel module loading, you get a console with some other console driver.

The xorg radeon driver depends on the kernel radeon modesetting driver.
You can have Xorg but only with the vesa or fb xorg drivers.

Radeon and the modesetting driver both depend on kernel modesetting, which as you rightly conclude, is the source of your problem.
http://refit.sourceforge.net/myths/ wrote:

Fact: You need BIOS compatibility for 2D/3D accelleration

If you want good graphics support in Linux, you must boot it using BIOS compatibility mode. This also means using LILO or GRUB, and having a MBR partition table (either hybrid GPT/MBR or plain MBR).


Can you select BIOS or legacy mode for booting?
With care, and a little luck, its possible to change the partition table type under the install.

It appears your video card makes BIOS calls during startup. In EFI mode, there is no BIOS to support them.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Fri Jul 24, 2020 10:40 pm    Post subject: Reply with quote

Well, I had missed that... And it seems the key problem.

I've been looking around about it. I think I have to make a hybrid MBR/GPT partition table on my hard drive. By default it's pure UEFI, I don't think I can boot in legacy mode on this computer, there's no system setup menu like with traditional UEFI or old BIOS style. Actually, it seems the way Apple handles UEFI is strange. According to what I could see, macOS doesn't really use the EFI partition, it boots "directly". For example, even I lose access to macOS on boot after installing grub/grub2 (it doesn't recognize macOS), I can still boot on it by typing "alt" on boot (and then I can choose between launching macOS, macOS recovery mode, or booting on an external media in case there is a bootable one). The EFI partition is here but seems inactive until you install an external bootmanager on it.

See : https://support.apple.com/en-qa/HT201255

I need to back up my datas and then try to do that.

Thanks again!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54266
Location: 56N 3W

PostPosted: Sat Jul 25, 2020 9:49 am    Post subject: Reply with quote

Pums,

Without some BIOS code the graphics card will not initialise.

When the BIOS (not EFI) starts, at the end of its startup, before it loads the MBR, it calls the initialisation routines on all the peripherals that it detected.
The peripherals can assume the presence of BIOS and call subroutines provided by the BIOS ROM.
It gets worse ... I think that the BIOS is 16 bit real mode code, so you need the CPU in real mode.

The EFI Firmware is 32 bit protected mode and that won't run 16 bit real mode.

The kernel can execute 16 bit real mode code. That's required for some emulators, but it has no supporting BIOS code.

You need some actual BIOS code and a way to run it, like BIOS booting.
It has to run before the kernel sets up its DRM so that the hardware is in the state the kernel expects.

Changing the partition table on it own won't help.

What's required is reverse engineering the graphics card setup routines and working out what they do, then writing new code to achieve the same thing that runs as a part of the kernel before DRM is started. That's hard. Its been done once but not maintained.
MacOS must do it ... but its not open source.

-- Edit --
Very long hacky work around ... maybe.
Do a very minimal install on the Mac hardware to set it up as a Virtual Machine host. That's all it will do.
No Xorg, No user apps ...
Pass the video card through to the the guest. This means that the bare metal host will have no video at all. It will be serial console if there is a serial port, or ssh or even VNC.
The video pass though can be a boot time option. You would need two kernels.

Set up a guest that does BIOS booting. As it uses BIOS, it will correctly initalise the Graphics card.
This is your user install.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Sat Jul 25, 2020 7:27 pm    Post subject: Reply with quote

NeddySeagoon,

About the first part of your last post, reverse engineering... writing new code... All that is light years away from my current capacities. I'm just a very very basic Gnu/Linux end-user that has been trying out Gentoo for over three months. I love it, I've learnt a lot (I didn't even know what a chroot is... and actually I believe it's still not clear for me how it really works...), I like keeping on learning, I'm not afraid of spending time on that but there are many things I can't realisticly do. My code skills do not go much beyond "hello world".

About the second part, well, it's a bit the same... My experience in virtualization has been limited to toying around with Vmware or Virtualbox (nothing to do...), and installing once a host-0 Xen kernel on Debian (I guess it's rather the kind of thing you're talking about ?), and boot on it just to see, though I actually never used it.

In brief, to do that I would need to be almost guided step by step, and I can't guarantee I won't do things wrong. If you're ready to try it, well I could never thank you enaugh for that, but of course, feel free to do it or not. If I can use ssh I think it's ok not to have video at all (no serial port on the mac), that's more or less what I've been doing lately...

So, tell me if I'm wrong, the first step with what you suggest would be reinstalling gentoo from scratch using a single stable profile? And... set it as a Virtual Machine host, across Xen eg?


Last edited by Pums on Sat Jul 25, 2020 8:41 pm; edited 1 time in total
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6098
Location: Dallas area

PostPosted: Sat Jul 25, 2020 8:23 pm    Post subject: Reply with quote

I haven't followed every post, but does the mac have a display port connection and have you tried it to see if it shows a difference?
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Sat Jul 25, 2020 8:40 pm    Post subject: Reply with quote

Anon-E-moose wrote:
does the mac have a display port connection and have you tried it to see if it shows a difference?


It has a "Mini DisplayPort output with support for DVI, VGA, and dual-link DVI" (see model on support.apple.com), but I never used it (I have no correct cable). I may be wrong but I don't think it could work since the problem is the GPU cannot be handled by the kernel in "normal" conditions.
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Sun Jul 26, 2020 6:06 pm    Post subject: Reply with quote

NeddySeagoon,

I've been looking around about virtualization, reading and rereading your last post and I think I figure out the solution you consider.

As you suggest, I'm going to make a new basic install for a Xen domain-0 following Gentoo's Xen wiki's page, to begin. I'll tell more if needed.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54266
Location: 56N 3W

PostPosted: Sun Jul 26, 2020 8:52 pm    Post subject: Reply with quote

Pums,

I would use a KVM because that's what I'm used to for bare metal installs on systems that will only host Virtual Machines.
I use Virtual Box too, for quick setups, where I only need the guest for a short time.

I have never used Xen. Well, once, a long time ago, I rented a Xen virtual machine but that was it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Mon Jul 27, 2020 10:54 am    Post subject: Reply with quote

Ok, so it'll be the first time I use qemu.

I made a new minimalistic install from scratch, tried to follow only the handbook and the kernel instructions for qemu, though I have doubts since it seems several config options of the wiki's qemu installation page do not match with the current stable kernel version.

I included in the new kernel the hardware modules matching with the mac, radeon driver included (I had doubt about the "pass the video card through to the the guest" point). Logically screen turns black at boot time... ssh is ok. No video (as you said) meant no radeon driver I guess (now). Should I make a new kernel without radeon driver? It's easy to do it with the fast computer.

I included KVM for Intel processors support as a module:

Code:
# zcat /proc/config.gz |grep -i kvm
CONFIG_LOCALVERSION="-x86_64-v1kvm0"
CONFIG_KVM_GUEST=y
# CONFIG_KVM_DEBUG_FS is not set
CONFIG_HAVE_KVM=y
CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_HAVE_KVM_IRQFD=y
CONFIG_HAVE_KVM_IRQ_ROUTING=y
CONFIG_HAVE_KVM_EVENTFD=y
CONFIG_KVM_MMIO=y
CONFIG_KVM_ASYNC_PF=y
CONFIG_HAVE_KVM_MSI=y
CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y
CONFIG_KVM_VFIO=y
CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y
CONFIG_KVM_COMPAT=y
CONFIG_HAVE_KVM_IRQ_BYPASS=y
CONFIG_HAVE_KVM_NO_POLL=y
CONFIG_KVM=m
CONFIG_KVM_INTEL=m
# CONFIG_KVM_AMD is not set
CONFIG_KVM_MMU_AUDIT=y
# CONFIG_PTP_1588_CLOCK_KVM is not set


I had doubt about setting on the "dangerous" CONFIG_DRM_LEGACY support (I left the defauilt option "not set").

Complete Kernel config is there.

I was not sure about the use flags for qemu, currently:

Code:
 eix -I qemu
[I] acct-group/qemu
     Available versions:  0{tbz2}
     Installed versions:  0{tbz2}(02:50:23 AM 07/27/2020)
     Description:         System group: qemu

[I] app-emulation/qemu
     Available versions:  5.0.0-r1^t{tbz2} ~5.0.0-r2^t **9999*l^t {accessibility +aio alsa bzip2 +caps capstone +curl debug doc +fdt +filecaps glusterfs gnutls gtk infiniband io-uring iscsi jemalloc +jpeg lzo multipath ncurses nfs nls numa opengl +oss +pin-upstream-blobs plugins +png pulseaudio python rbd sasl sdl sdl-image +seccomp selinux +slirp smartcard snappy spice ssh static static-user systemtap tci test usb usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen xfs +xkb zstd KERNEL="FreeBSD linux" PYTHON_TARGETS="python3_6 python3_7 python3_8" QEMU_SOFTMMU_TARGETS="aarch64 alpha arm avr cris hppa i386 lm32 m68k microblaze microblazeel mips mips64 mips64el mipsel moxie nios2 or1k ppc ppc64 riscv32 riscv64 rx s390x sh4 sh4eb sparc sparc64 tricore unicore32 x86_64 xtensa xtensaeb" QEMU_USER_TARGETS="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze microblazeel mips mips64 mips64el mipsel mipsn32 mipsn32el nios2 or1k ppc ppc64 ppc64abi32 ppc64le riscv32 riscv64 s390x sh4 sh4eb sparc sparc32plus sparc64 tilegx x86_64 xtensa xtensaeb"}
     Installed versions:  5.0.0-r1^t{tbz2}(03:04:52 AM 07/27/2020)(aio alsa bzip2 caps curl doc fdt filecaps jpeg ncurses nls oss pin-upstream-blobs png python seccomp ssh vde vhost-net vhost-user-fs vnc xattr xkb -accessibility -capstone -debug -glusterfs -gnutls -gtk -infiniband -io-uring -iscsi -jemalloc -lzo -multipath -nfs -numa -opengl -plugins -pulseaudio -rbd -sasl -sdl -sdl-image -selinux -smartcard -snappy -spice -static -static-user -systemtap -tci -test -usb -usbredir -virgl -virtfs -vte -xen -xfs -zstd KERNEL="linux -FreeBSD" PYTHON_TARGETS="python3_7 -python3_6 -python3_8" QEMU_SOFTMMU_TARGETS="x86_64 -aarch64 -alpha -arm -cris -hppa -i386 -lm32 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -moxie -nios2 -or1k -ppc -ppc64 -riscv32 -riscv64 -rx -s390x -sh4 -sh4eb -sparc -sparc64 -tricore -unicore32 -xtensa -xtensaeb" QEMU_USER_TARGETS="x86_64 -aarch64 -aarch64_be -alpha -arm -armeb -cris -hppa -i386 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -mipsn32 -mipsn32el -nios2 -or1k -ppc -ppc64 -ppc64abi32 -ppc64le -riscv32 -riscv64 -s390x -sh4 -sh4eb -sparc -sparc32plus -sparc64 -tilegx -xtensa -xtensaeb")
     Homepage:            http://www.qemu.org http://www.linux-kvm.org
     Description:         QEMU + Kernel-based Virtual Machine userland tools


For the moment, /var/lib/portage/world only includes this:

Code:
app-admin/sysklogd
app-arch/lz4
app-editors/vim
app-emulation/qemu
app-portage/eix
app-text/wgetpaste
app-vim/screen
dev-libs/lzo
net-fs/sshfs
net-misc/dhcpcd
net-misc/netifrc
net-wireless/iw
net-wireless/wpa_supplicant
sys-apps/mlocate
sys-apps/pcmciautils
sys-boot/grub
sys-boot/os-prober
sys-boot/refind
sys-fs/btrfs-progs
sys-fs/dosfstools
sys-fs/mtools
sys-kernel/genkernel
sys-kernel/gentoo-sources
sys-process/cronie


About the next step... Make a new kernel without radeon driver? Follow QEMU/Linux guest?

I have IPV6, I wonder if QEMU/KVM IPv6 Support is needed for me.

(By the way, I made a new chroot environment on the fast computer and I could use it to make binaries for the mac's world update, the kernel and the other few packages; it works perfectly, now I'll only need to find a nice way to sync or share binaries; I'm considering to share the binpkg folder over nfs, it but seems easy to set up and will save some space disk. Again, thanks a lot for that!)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54266
Location: 56N 3W

PostPosted: Mon Jul 27, 2020 3:03 pm    Post subject: Reply with quote

Pums,

You need the PCI_STUB option in the host kernel
Code:
  ┌─────────────────────────── PCI Stub driver ────────────────────────────┐
  │ CONFIG_PCI_STUB:                                                       │ 
  │                                                                        │ 
  │ Say Y or M here if you want be able to reserve a PCI device            │ 
  │ when it is going to be assigned to a guest operating system.           │ 
  │                                                                        │ 
  │ When in doubt, say N.                                                  │ 
  │                                                                        │ 
  │ Symbol: PCI_STUB [=n]                                                  │ 
  │ Type  : tristate                                                       │ 
  │ Defined at drivers/pci/Kconfig:89                                      │ 
  │   Prompt: PCI Stub driver                                              │ 
  │   Depends on: PCI [=y]                                                 │ 
  │   Location:                                                            │ 
  │     -> Device Drivers                                                  │ 
  │       -> PCI support (PCI [=y])                   
as that supports PCI passthrough.

You won't have a video card at all in the host install so you can turn off all the video card support options to start with.
I suggest that you make two kernels for the host. One with a working console, that you can boot into for debugging the host and one to support the video card passthrough.

If you will use QEMU-KVM, you don't have it do everything blind. Read about app-emulation/libvirt. That will let you set up VMs remotely and show their console.
You will need that in case the passthrough does not work first time.

The Guest install must use BIOS booting. You need the BIOS to initialise the graphics card in the guest.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Thu Jul 30, 2020 9:23 pm    Post subject: Reply with quote

I've tried to search and read many things, it's quite hard and many stuff seems outdated.

I think my host kernel is ok. I've followed this GEntoo's wiki page about Qemu.

Edit: About libvirt to control a VM remotely (though I'm not sure it's so important now), did you think of virt-manager for example ? (it's the only available on Gentoo I could find)

I also tried to follow this page about GPU passthrough with libvirt qemu kvm on Gentoo's wiki and this similar page (this last one is the only I could find that gave explicitly an option to boot on old BIOS mode):

Code:
$ dmesg | grep 'IOMMU enabled'
[    0.284735] DMAR: IOMMU enabled


Seems ok. But

Code:
$ for d in /sys/kernel/iommu_groups/*/devices/*; do n=${d#*/iommu_groups/*}; n=${n%%/*}; printf 'IOMMU Group %s ' "$n"; lspci -nns "${d##*/}"; done;
IOMMU Group * 00:00.0 Host bridge [0600]: Intel Corporation Core Processor DRAM Controller [8086:0040] (rev 18)
00:01.0 PCI bridge [0604]: Intel Corporation Core Processor PCI Express x16 Root Port [8086:0041] (rev 18)
00:1a.0 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB Universal Host Controller [8086:3b3b] (rev 06)
00:1a.7 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller [8086:3b3c] (rev 06)
00:1b.0 Audio device [0403]: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio [8086:3b56] (rev 06)
00:1c.0 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 [8086:3b42] (rev 06)
00:1c.1 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 [8086:3b44] (rev 06)
00:1c.2 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 3 [8086:3b46] (rev 06)
00:1d.0 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB Universal Host Controller [8086:3b36] (rev 06)
00:1d.7 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller [8086:3b34] (rev 06)
00:1e.0 PCI bridge [0604]: Intel Corporation 82801 PCI Bridge [8086:244e] (rev a6)
00:1f.0 ISA bridge [0601]: Intel Corporation P55 Chipset LPC Interface Controller [8086:3b02] (rev 06)
00:1f.2 SATA controller [0106]: Intel Corporation 5 Series/3400 Series Chipset 6 port SATA AHCI Controller [8086:3b22] (rev 06)
00:1f.3 SMBus [0c05]: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller [8086:3b30] (rev 06)
00:1f.6 Signal processing controller [1180]: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem [8086:3b32] (rev 06)
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] RV730/M96-XT [Mobility Radeon HD 4670] [1002:9488]
01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] RV710/730 HDMI Audio [Radeon HD 4000 series] [1002:aa38]
02:00.0 Ethernet controller [0200]: Broadcom Inc. and subsidiaries NetXtreme BCM5764M Gigabit Ethernet PCIe [14e4:1684] (rev 10)
03:00.0 Network controller [0280]: Qualcomm Atheros AR928X Wireless Network Adapter (PCI-Express) [168c:002a] (rev 01)
04:00.0 PCI bridge [0604]: Texas Instruments XIO2213A/B/XIO2221 PCI Express to PCI Bridge [Cheetah Express] [104c:823e] (rev 01)
05:00.0 FireWire (IEEE 1394) [0c00]: Texas Instruments XIO2213A/B/XIO2221 IEEE-1394b OHCI Controller [Cheetah Express] [104c:823f] (rev 01)
ff:00.0 Host bridge [0600]: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers [8086:2c61] (rev 05)
ff:00.1 Host bridge [0600]: Intel Corporation Core Processor QuickPath Architecture System Address Decoder [8086:2d01] (rev 05)
ff:02.0 Host bridge [0600]: Intel Corporation Core Processor QPI Link 0 [8086:2d10] (rev 05)
ff:02.1 Host bridge [0600]: Intel Corporation 1st Generation Core i3/5/7 Processor QPI Physical 0 [8086:2d11] (rev 05)
ff:02.2 Host bridge [0600]: Intel Corporation 1st Generation Core i3/5/7 Processor Reserved [8086:2d12] (rev 05)
ff:02.3 Host bridge [0600]: Intel Corporation 1st Generation Core i3/5/7 Processor Reserved [8086:2d13] (rev 05)


and
Code:
for iommu_group in $(find /sys/kernel/iommu_groups/ -maxdepth 1 -mindepth 1 -type d); do echo "IOMMU group $(basename "$iommu_group")"; for device in $(ls -1 "$iommu_group"/devices/); do echo -n $'\t'; lspci -nns "$device"; done; done


Returns nothing.

I don't see any group like on the example given on the wiki (/sys/kernel/iommu_groups/ exists but is empty).


I tried to adapt the settings for the VM to my case and I get this error message :
Code:
no iommu_group found: No such file or directory



From GPU_passthrough_with_libvirt_qemu_kvm, if I launch the MinimalPassthrough.sh script or the GentooPassthrough.sh script I get this error :

Code:

QEMU 5.0.0 monitor - type 'help for more information
(qemu) qemu-system-x86_65: -device vfio-pci,host=09:0.0,x-vga=on,multifunction=on: vfio /sys/bus/pci/devices/0000:09:00.0: no such host device: No such file or directory.


This script nor the explanations on the wiki are not clear at all to me, I don't know how I could tweak that.

If I try to launch regularly the virtual machine following QEMU/Linux guest , I need to use the headless script to have the Cd image booted, I get this:

Code:
SeaBIOS (version ?-20190711_202441-buildvm-armv7-10.arm.fedoraproject.org-2.fc31
)


iPXE (http://ipxe.org) 00:03.0 C980 PCI2.10 PnP PMM+1FF92030+1FEF2030 C980
                                                                               


Booting from DVD/CD...

ISOLINUX 6.04 6.04-pre1 ETCD Copyright (C) 1994-2015 H. Peter Anvin et al
Gentoo Linux Installation LiveCD                         http://www.gentoo.org/
Enter to boot; F1 for kernels  F2 for options.
Press any key in the next 15 seconds or we'll try to boot from disk.
boot:
Loading /boot/gentoo... ok
Loading /boot/gentoo.igz...ok
ATI9


and it doesn't do anything more.

One thing I'd like to make clear: when you say I'd need two kernels on the host, do you mean two different kernels (if so, what would be the difference?) or only different boot options? I've found this page about PCI passthrough, that recommends to use "ommu=on intel_iommu=on". Is that what you refer to? I've tried to use this option but it doesn't change anything.

Edit: Here yo can find the VM configs I've tried : https://dpaste.com/FACDAZRNS
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54266
Location: 56N 3W

PostPosted: Sat Aug 01, 2020 8:13 pm    Post subject: Reply with quote

Pums,

From
lspci:
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] RV730/M96-XT [Mobility Radeon HD 4670] [1002:9488]


This looks wrong.
Code:
qemu-system-x86_65: -device vfio-pci,host=09:0.0,x-vga=on,multifunction=on: vfio /sys/bus/pci/devices/0000:09:00.0: no such host device: No such file or directory.

I would expect the 09:00.0 to be 01:00.0 as that comes from the bus/device/function.

Code:
ls /sys/bus/pci/devices/ -l
will show a lot of symlinks. Find the one for your video card 0000:01:00.0 -> and follow it to check.

I had in mind
Code:
app-emulation/libvirt
app-emulation/virt-manager


virt-manager is a GUI. On the Mac you need app-emulation/libvirt to manage your KVM.
On a remote system, install app-emulation/virt-manager.

If you install both on the same system, you can create KVMs locally.
Make a KVM work before adding video pass through.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Tue Aug 04, 2020 10:23 pm    Post subject: Reply with quote

I don' know how to make KVM work.

It seems there's a problem with libvirtd:

Code:

# rc-service libvirtd status
 * status: crashed
# rc-service libvirtd restart
 * Stopping libvirtd ...
 * start-stop-daemon: no matching processes found                                                                        [ ok ]
 * Starting libvirtd ...                   
# rc-service libvirtd status
 * status: crashed
# virt-host-validate
  QEMU: Checking for hardware virtualization                                 : PASS
  QEMU: Checking if device /dev/kvm exists                                   : PASS
  QEMU: Checking if device /dev/kvm is accessible                            : PASS
  QEMU: Checking if device /dev/vhost-net exists                             : PASS
  QEMU: Checking if device /dev/net/tun exists                               : PASS
  QEMU: Checking for cgroup 'cpu' controller support                         : PASS
  QEMU: Checking for cgroup 'cpuacct' controller support                     : PASS
  QEMU: Checking for cgroup 'cpuset' controller support                      : PASS
  QEMU: Checking for cgroup 'memory' controller support                      : PASS
  QEMU: Checking for cgroup 'devices' controller support                     : PASS
  QEMU: Checking for cgroup 'blkio' controller support                       : PASS
  QEMU: Checking for device assignment IOMMU support                         : WARN (No ACPI DMAR table found, IOMMU either disabled in BIOS or not supported by this hardware platform)


Edit: I really don't know what to do (I understand livirtd has nothing to do with lauching a VM). I have no experience with qemu/KVM. On the host I ran tests and qemu VM works easily with the default configuration from the wiki's Qemu guest page, and does the same as on the mac for the headless script (stops after ATI9...).
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Wed Aug 05, 2020 6:08 pm    Post subject: Reply with quote

Pums wrote:
I don' know how to make KVM work.

It seems there's a problem with libvirtd:

Code:

# rc-service libvirtd status
 * status: crashed
# rc-service libvirtd restart
 * Stopping libvirtd ...
 * start-stop-daemon: no matching processes found                                                                        [ ok ]
 * Starting libvirtd ...                   
# rc-service libvirtd status
 * status: crashed
# virt-host-validate
  QEMU: Checking for hardware virtualization                                 : PASS
  QEMU: Checking if device /dev/kvm exists                                   : PASS
  QEMU: Checking if device /dev/kvm is accessible                            : PASS
  QEMU: Checking if device /dev/vhost-net exists                             : PASS
  QEMU: Checking if device /dev/net/tun exists                               : PASS
  QEMU: Checking for cgroup 'cpu' controller support                         : PASS
  QEMU: Checking for cgroup 'cpuacct' controller support                     : PASS
  QEMU: Checking for cgroup 'cpuset' controller support                      : PASS
  QEMU: Checking for cgroup 'memory' controller support                      : PASS
  QEMU: Checking for cgroup 'devices' controller support                     : PASS
  QEMU: Checking for cgroup 'blkio' controller support                       : PASS
  QEMU: Checking for device assignment IOMMU support                         : WARN (No ACPI DMAR table found, IOMMU either disabled in BIOS or not supported by this hardware platform)


Edit: I really don't know what to do (I understand livirtd has nothing to do with lauching a VM). I have no experience with qemu/KVM. On the host I ran tests and qemu VM works easily with the default configuration from the wiki's Qemu guest page, and does the same as on the mac for the headless script (stops after ATI9...).


is that related to this topic_ if not. please open a new one
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Pums
n00b
n00b


Joined: 03 Jun 2020
Posts: 52

PostPosted: Wed Aug 05, 2020 9:11 pm    Post subject: Reply with quote

It is, since I'm actually just trying to have X session / KMS working with the mentionned GPU, and it seems the only solution would be to make a GPU passthrough to a virtual machine.
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Thu Aug 06, 2020 5:12 pm    Post subject: Reply with quote

Pums wrote:
It is, since I'm actually just trying to have X session / KMS working with the mentionned GPU, and it seems the only solution would be to make a GPU passthrough to a virtual machine.

what other way is there? if you want to use a specific gpu in the vm, you must passthrough.
if you have an intel igp, you can use vgpu which allows to to split the physical gpu to virtual ones. then you can have actual gpus for the host and the guest
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum