-
Notifications
You must be signed in to change notification settings - Fork 67
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
Intel Arc A770: Kernel panic on kldload i915kms.ko #315
Comments
My bad, I didn't see about the "Intel DG2 GUC/HUC support" not being implemented yet from PR #283.
I'm reopening this to have it serve as a milestone issue. I figured why have it be closed anyway since the issue is still valid and my reporting could be useful? |
You may start with adding dg2_dmc_ver2_08.bin to firmwares |
But I doubt that it will help |
I'll try that out and report back. I also updated my bug description to be more specific. |
And you're right, it didn't. After trying a couple more ideas, I spent a good amount of time re-learning how to create a new core dump of the kernel panic with the firmware(s) loaded. Sorry for the delay. |
After taking a look at the code around faulted line, I have got an impression that it can happen due to missing vmap_pfn() implementation. |
It seems you're correct about the missing What I did was created this custom patch to put into my --- drivers/gpu/drm/i915/gem/i915_gem_pages.c.orig
+++ drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -329,7 +329,7 @@ static void *i915_gem_object_map_pfn(struct drm_i915_gem_object *obj,
{
#ifdef __FreeBSD__
// BSDFIXME: Need vmap_pfn() implementation.
- return NULL;
+ panic("oops");
#else
resource_size_t iomap = obj->mm.region->iomap.base -
obj->mm.region->region.start; And rebuilt and reinstalled the package of my derived port. Then I did my usual testing and grabbed a new core dump which shows the "oops" panic. Yay! \o/ |
You may try following patches (only compile-tested). It is just quick conversion of vmap() implementation to vmap_pfn() through replacement Incomplete patch deleted. See patch three messages below and drm-kmod: diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pages.c b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
index 931e7f46733..0ba955611df 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pages.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pages.c
@@ -327,10 +327,6 @@ static void *i915_gem_object_map_page(struct drm_i915_gem_object *obj,
static void *i915_gem_object_map_pfn(struct drm_i915_gem_object *obj,
enum i915_map_type type)
{
-#ifdef __FreeBSD__
- // BSDFIXME: Need vmap_pfn() implementation.
- return NULL;
-#else
resource_size_t iomap = obj->mm.region->iomap.base -
obj->mm.region->region.start;
unsigned long n_pfn = obj->base.size >> PAGE_SHIFT;
@@ -356,7 +352,6 @@ static void *i915_gem_object_map_pfn(struct drm_i915_gem_object *obj,
kvfree(pfns);
return vaddr ?: ERR_PTR(-ENOMEM);
-#endif
}
/* get, pin, and map the pages of the object into kernel space */ |
I guess I should note that after doing a lot of experimentation, there was one time I was "lucky" enough at random to get
But that only happened once and it wasn't reproducible. Also, I don't know if I need to get another coredump by using the following in
because I changed the first tunable to But right now, I need some rest, because I was doing on like +20 kernel-panic reboots of experiments. |
Next version of FreeBSD patch: diff --git a/sys/compat/linuxkpi/common/include/linux/vmalloc.h b/sys/compat/linuxkpi/common/include/linux/vmalloc.h
index 00650a2df9b..30f7e0e6297 100644
--- a/sys/compat/linuxkpi/common/include/linux/vmalloc.h
+++ b/sys/compat/linuxkpi/common/include/linux/vmalloc.h
@@ -35,8 +35,11 @@
#define VM_MAP 0x0000
#define PAGE_KERNEL 0x0000
+#define vmap_pfn(...) lkpi_vmap_pfn(__VA_ARGS__)
+
void *vmap(struct page **pages, unsigned int count, unsigned long flags,
int prot);
+void *lkpi_vmap_pfn(unsigned long *pfns, unsigned int count, int prot);
void vunmap(void *addr);
#endif /* _LINUXKPI_LINUX_VMALLOC_H_ */
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 81d24603d1d..bce3af61516 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -60,6 +60,9 @@
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
+#include <vm/uma.h>
+#include <vm/uma_int.h>
+
#include <machine/stdarg.h>
#if defined(__i386__) || defined(__amd64__)
@@ -1804,6 +1807,24 @@ vmmap_remove(void *addr)
return (vmmap);
}
+int
+is_vmalloc_addr(const void *addr)
+{
+ struct vmmap *vmmap;
+ uintptr_t p = (uintptr_t)addr;
+
+ mtx_lock(&vmmaplock);
+ LIST_FOREACH(vmmap, &vmmaphead[VM_HASH(addr)], vm_next)
+ if (p >= trunc_page(vmmap->vm_addr) &&
+ p < round_page((char *)vmmap->vm_addr + vmmap->vm_size))
+ break;
+ mtx_unlock(&vmmaplock);
+ if (vmmap != NULL)
+ return(1);
+
+ return (vtoslab((vm_offset_t)addr & ~UMA_SLAB_MASK) != NULL);
+}
+
#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) || defined(__riscv)
void *
_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr)
@@ -1849,6 +1870,58 @@ vmap(struct page **pages, unsigned int count, unsigned long flags, int prot)
return ((void *)off);
}
+#ifdef __amd64__
+static void
+_lkpi_pmap_qenter_pfn(vm_offset_t sva, vm_pindex_t *pi, int count,
+ vm_memattr_t mode)
+{
+ pt_entry_t *endpte, oldpte, pa, *pte;
+ vm_pindex_t p;
+ int cache_bits;
+ pt_entry_t pg_g;
+
+ pg_g = pti ? 0 : X86_PG_G;
+ oldpte = 0;
+ pte = vtopte(sva);
+ endpte = pte + count;
+ cache_bits = pmap_cache_bits(kernel_pmap, mode, false);
+ while (pte < endpte) {
+ p = *pi++;
+ pa = IDX_TO_OFF(p) | cache_bits;
+ if ((*pte & (PG_FRAME | X86_PG_PTE_CACHE)) != pa) {
+ oldpte |= *pte;
+ pte_store(pte, pa | pg_g | pg_nx | X86_PG_A |
+ X86_PG_M | X86_PG_RW | X86_PG_V);
+ }
+ pte++;
+ }
+ if (__predict_false((oldpte & X86_PG_V) != 0))
+ pmap_invalidate_range(kernel_pmap, sva, sva + count *
+ PAGE_SIZE);
+}
+#endif
+
+void *
+lkpi_vmap_pfn(unsigned long *pfns, unsigned int count, int prot)
+{
+#ifdef __amd64__
+ vm_offset_t off;
+ size_t size;
+
+ size = count * PAGE_SIZE;
+ off = kva_alloc(size);
+ if (off == 0)
+ return (NULL);
+ vmmap_add((void *)off, size);
+ _lkpi_pmap_qenter_pfn(off, pfns, count, pgprot2cachemode(prot));
+
+ return ((void *)off);
+#else
+ panic("vmap_pfn is not implemented");
+ return (NULL);
+#endif
+}
+
void
vunmap(void *addr)
{
diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c
index 25243382f9e..1ed8b99cdf3 100644
--- a/sys/compat/linuxkpi/common/src/linux_page.c
+++ b/sys/compat/linuxkpi/common/src/linux_page.c
@@ -53,9 +53,6 @@
#include <vm/vm_reserv.h>
#include <vm/vm_extern.h>
-#include <vm/uma.h>
-#include <vm/uma_int.h>
-
#include <linux/gfp.h>
#include <linux/mm.h>
#include <linux/preempt.h>
@@ -287,12 +284,6 @@ lkpi_get_user_pages(unsigned long start, unsigned long nr_pages,
!!(gup_flags & FOLL_WRITE), pages));
}
-int
-is_vmalloc_addr(const void *addr)
-{
- return (vtoslab((vm_offset_t)addr & ~UMA_SLAB_MASK) != NULL);
-}
-
vm_fault_t
lkpi_vmf_insert_pfn_prot_locked(struct vm_area_struct *vma, unsigned long addr,
unsigned long pfn, pgprot_t prot) |
Will get on it, thanks! 😎 |
It is strange. This panic looks like no patches have peen applied. Did you apply drm-kmod patch? |
I still kept that same patch in the files directory of my drm-kmod port like last time. But I rebuilt the package in an updated poudriere jail using a non-clean build with your latest patch. I might want to try this over again with a clean FreeBSD build and redo my steps with more care. |
Actually, you were spot on. I was moving the patch around outside of the files directory and it didn't get applied for the second round. My apologies. Gonna do a clean build anyway. 😄 |
This time with interesting |
Firmware loaded successfully this time. But unfortunately I have no idea how to debug GPU hangs. |
Understood. And I appreciate all of your help here regardless. Thanks for working on those patches. |
Okay, I got good news and bad news. Good news:
Bad news:
It's crucial to be able to use |
GUC/HUC is not supported by drm-kmod on DG2 yet. It requires porting of MEI and PXP drivers |
Ah, yeah, that's right. Thanks for the reminder there. |
Describe the bug
From using a drm-kmod build from efd9167, the i915kms driver kernel panics when using an (Acer Predator BiFrost) Intel Arc A770 graphics card. And the kernel panic still persists even when using an Intel onboard GPU with the same graphics card installed.
FreeBSD version
DRM KMOD version
My own "custom derived"
graphics/drm-66-kmod
port withGH_TAGNAME
pointing to efd9167.Also git-clone(1) from linux-firmware and copied all of the
i915/dg2_*
firmware bins to /boot/modules and renamed them appropriately to match the filename style there.To Reproduce
Boot into the system with either
i915kms
usingkld_list
inside/etc/rc.conf
orkldload
it manually.Additional context
core.txt.0 dump
The text was updated successfully, but these errors were encountered: