You are not logged in.

#1 2015-08-07 19:01:06

MrChefur
Member
Registered: 2015-08-06
Posts: 10

Stuck on using i915 patch for KVM passthrough

I posted this in the KVM passthrough thread, but it got closed.

I'm currently using kernel 4.1.4 and I can't get the kernel to patch with the i915 patch, should I be using the older version of the kernel?
I run the command

patch -p1 i915_2.patch

and it returns

(Stripping trailing CRs from patch; use --binary to disable.)
patching file drivers/gpu/drm/i915/i915_dma.c
Reversed (or previously applied) patch detected! Skipping patch.
2 out of 2 hunks ignored -- savings rejects to file drivers/gpu/drm/i915/i915_dma.c.rej
(Stripping trailing CRs from patch; use --binary to disable.)
can't find file to patch at input line 56
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------------------------
|diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
|index ec82f6b..f3908f6 00644
|--- a/drivers/gpu/drm/i915/i915_drv.h
|+++ b/drivers/gpu/drm/i915/i915_drv.h
-----------------------------------------
File to patch:

I'm using the patch from here

I redownloaded the kernel tar and patch, extracted the kernel and applied the patch in it's main directory using the same command as before and now it's sitting on a blank line with the cursor just refreshing (I forget the term).
I left it for 8+ hours and nothing happened.

Any help would be appreciated.

Offline

#2 2015-08-07 20:03:03

frank604
Member
From: BC, Canada
Registered: 2011-04-20
Posts: 1,219

Re: Stuck on using i915 patch for KVM passthrough

Could you show your rejects?  I'm relatively new to patching but the syntax I've used is

patch -p1 < filename.patch

Offline

#3 2015-08-07 20:05:23

MrChefur
Member
Registered: 2015-08-06
Posts: 10

Re: Stuck on using i915 patch for KVM passthrough

frank604 wrote:

Could you show your rejects?

How do I do that? A quick google search didn't turn up anything.

EDIT: I ran the command using your syntax and got this for my rejects:

--- include/linux/vgaarb.h
+++ include/linux/vgaarb.h
@@ -65,8 +65,15 @@ struct pci_dev;
   *       out of the arbitration process  (and can be safe to take 
   *       interrupts at any time.
   */
+#if defined(CONFIG_VGA_ARB)
  extern void vga_set_legacy_decoding(struct pci_dev *pdev.
                                                               unsigned int decodes);
+#else
+static inline void vga_set_legacy_decoding(struct pci_dev *pdev.
+                                                                     unsigned int decodes);
+{
+}
+#endif

 //**

Last edited by MrChefur (2015-08-07 20:13:14)

Offline

#4 2015-08-07 21:27:15

frank604
Member
From: BC, Canada
Registered: 2011-04-20
Posts: 1,219

Re: Stuck on using i915 patch for KVM passthrough

Have you tried to manually patch by hand?  good low level guide

Offline

#5 2015-08-07 21:41:05

MrChefur
Member
Registered: 2015-08-06
Posts: 10

Re: Stuck on using i915 patch for KVM passthrough

frank604 wrote:

Have you tried to manually patch by hand?  good low level guide

Following that guide, I'm kinda stuck at the

:split

command, because I am only running on the command line. My desktop environment stopped functioning halfway through this passthrough installation process.

Any suggestions?

Last edited by MrChefur (2015-08-07 21:41:22)

Offline

#6 2015-08-07 21:57:48

frank604
Member
From: BC, Canada
Registered: 2011-04-20
Posts: 1,219

Re: Stuck on using i915 patch for KVM passthrough

Just open two terminals if you cannot split view in one terminal.

Offline

#7 2015-08-09 04:38:21

MrChefur
Member
Registered: 2015-08-06
Posts: 10

Re: Stuck on using i915 patch for KVM passthrough

Alright, so I get three rejected files.
The first is

./include/linux/vgaarb.h.rej

which contains:

--- include/linux/vgaarb.h
+++ include/linux/vgaarb.h
@@ -65,8 +65,15 @@ struct pci_dev;
  *     out of the arbitration process (and can be safe to take
  *     interrupts at any time.
  */
+#if defined(CONFIG_VGA_ARB)
 extern void vga_set_legacy_decoding(struct pci_dev *pdev,

--- include/linux/vgaarb.h
+++ include/linux/vgaarb.h
@@ -65,8 +65,15 @@ struct pci_dev;
  *     out of the arbitration process (and can be safe to take
  *     interrupts at any time.
  */
+#if defined(CONFIG_VGA_ARB)
 extern void vga_set_legacy_decoding(struct pci_dev *pdev,
                                    unsigned int decodes);
+#else
+static inline void vga_set_legacy_decoding(struct pci_dev *pdev,
+                                          unsigned int decodes)
+{
+}
+#endif

 /**
                                    unsigned int decodes);
+#else
+static inline void vga_set_legacy_decoding(struct pci_dev *pdev,
+                                          unsigned int decodes)
+{
+}
+#endif

 /**

Should I post the original file as well? Also, should I be using spoilers or pastebin to avoid walls of text?

The other two are

./drivers/gpu/drm/i915/i915_drv.h.rej
./drivers/gpu/drm/i915/i915_params.c.rej

Last edited by MrChefur (2015-08-09 04:45:32)

Offline

#8 2015-08-09 04:44:43

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Stuck on using i915 patch for KVM passthrough

It seems you are digging the hole deeper.

Note the error message in your first post:

Reversed (or previously applied) patch detected! Skipping patch.

That is either because you reapplied the patch in a dirty directory, or the code is already inlcuded in the kernel. You need to work out which is the case.

After that, any rejects that you get can be hand patched (everything with a +/- prepending the line is either added or removed from the target file).


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#9 2015-08-09 04:47:51

MrChefur
Member
Registered: 2015-08-06
Posts: 10

Re: Stuck on using i915 patch for KVM passthrough

jasonwryan wrote:

It seems you are digging the hole deeper.
...

After each failed attempt I deleted the kernel and re extracted it as to not interfere.
I'll attempt to hand patch it. Thanks for all the help so far.

Offline

#10 2015-08-10 03:17:59

MrChefur
Member
Registered: 2015-08-06
Posts: 10

Re: Stuck on using i915 patch for KVM passthrough

Ok, so I found that the lines in the patch were wrong and fixing them got rid of two of the three errors. The third one is this:

[deepthought@deepthought linux-4.1.4]$ sudo patch -p1 < i915-mod.patch
(Stripping trailing CRs from patch; use --binary to disable.)
patching file drivers/gpu/drm/i915/i915_dma.c
Hunk #1 succeeded at 400 (offset -906 lines).
Hunk #2 succeeded at 454 with fuzz 2 (offset -925 lines).
(Stripping trailing CRs from patch; use --binary to disable.)
patching file drivers/gpu/drm/i915/i915_drv.h
patch: **** malformed patch at line 64: diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c

Here's the code in the patch from line 64 that I 'fixed' using the same method for the other two:

diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index d1d7980..64d96c6 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -56,27 +73,64 @@ struct i915_params i915 __read_mostly = {
        .invert_brightness = 0,
        .disable_display = 0,
        .enable_cmd_parser = 0,
+       .enable_hd_vgaarb = false,
 };

The only difference between the two is that the original file has .enable_cmd_parser set to 1, so I changed it to:

-        .enable_cmd_parser = 1,
+        .enable_cmd_parser = 0,

And I got the same error.


ANOTHER EDIT!

So I manually added the .enable_cmd_parser = 0 to drivers/gpu/drm/i915/i915_params.c and applied the patch and it seemed to work.
Now my problem is when I run

make

for the kernel it runs fine until it exits with:

drivers/gpu/drm/i915/i915_params.c:56:2: error: unknown field ‘enable_hd_vgaarb’ specified in initializer
  .enable_hd_vgaarb = false,
  ^
drivers/gpu/drm/i915/i915_params.c:56:22: warning: excess elements in struct initializer
  .enable_hd_vgaarb = false,
  ^
drivers/gpu/drm/i915/i915_params.c:56:22: note: (near initialization for ‘i915’)
scripts/Makefile.build:258: recipe for target 'drivers/gpu/drm/i915/i915_params.o' failed
make[4]: *** [drivers/gpu/drm/i915/i915_params.o] Error 1
scripts/Makefile.build:403: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:403: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:403: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:946: recipe for target 'drivers' failed
make: *** [drivers] Error 2

What now?

Last edited by MrChefur (2015-08-10 18:16:18)

Offline

#11 2015-08-13 02:27:13

MrChefur
Member
Registered: 2015-08-06
Posts: 10

Re: Stuck on using i915 patch for KVM passthrough

I've been trying to fix this for a while, can anyone point me in the right direction?

Offline

#12 2015-08-13 04:58:44

slis
Member
Registered: 2014-06-02
Posts: 127

Re: Stuck on using i915 patch for KVM passthrough

I think you are missing

--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2080,6 +2080,7 @@ struct i915_params {
        bool prefault_disable;
        bool reset;
        bool disable_display;
+       bool enable_hd_vgaarb;
 };

and I am not sure thats your only problem,

Hunk #2 succeeded at 454 with fuzz 2 (offset -925 lines).

I don't know what that fuzz 2 means, but doesn't look right smile

You can use patches without modification, then check files that failed with extension .rej, to see what failed and then add it manually.

/linux-3.19/drivers/gpu/drm/i915# cat i915_params.c.rej

--- drivers/gpu/drm/i915/i915_params.c
+++ drivers/gpu/drm/i915/i915_params.c
@@ -47,6 +47,7 @@
        .invert_brightness = 0,
        .disable_display = 0,
        .enable_cmd_parser = 0,
+       .enable_hd_vgaarb = false,
 };
 
 module_param_named(modeset, i915.modeset, int, 0400);
@@ -152,3 +153,7 @@
 module_param_named(enable_cmd_parser, i915.enable_cmd_parser, int, 0600);
 MODULE_PARM_DESC(enable_cmd_parser,
                 "Enable command parsing (1=enabled, 0=disabled [default])");
+
+module_param_named(enable_hd_vgaarb, i915.enable_hd_vgaarb, bool, 0444);
+MODULE_PARM_DESC(enable_hd_vgaarb,
+       "Enable support for VGA arbitration on Intel HD IGD. (default: false)");

You can see that lines with + are missing so you add them to  i915_params.c file.

Last edited by slis (2015-08-13 04:59:14)

Offline

#13 2015-08-19 15:09:33

mauorrizze
Member
Registered: 2014-08-22
Posts: 18

Re: Stuck on using i915 patch for KVM passthrough

Alternative: use the https://aur.archlinux.org/packages/linux-vfio/ kernel from AUR
You can install the whole Package (edit PKGBUILD and comment the ACS patch step, as you propably don't need that) , or use the included i915_317.patch. Maybe this is a newer patch than the one you're using. An older one also stopped working for me since 4.+ kernel.

Offline

#14 2015-08-19 21:57:44

MrChefur
Member
Registered: 2015-08-06
Posts: 10

Re: Stuck on using i915 patch for KVM passthrough

mauorrizze wrote:

Alternative: use the https://aur.archlinux.org/packages/linux-vfio/ kernel from AUR
You can install the whole Package (edit PKGBUILD and comment the ACS patch step, as you propably don't need that) , or use the included i915_317.patch. Maybe this is a newer patch than the one you're using. An older one also stopped working for me since 4.+ kernel.

I just successfully installed it, but how do I use the patch?

Offline

#15 2015-08-22 00:58:39

MrChefur
Member
Registered: 2015-08-06
Posts: 10

Re: Stuck on using i915 patch for KVM passthrough

Alright, I installed the patched kernel. Now, I added the boot parameters to grub, but

cat /proc/cmdline

returns

BOOT_IMAGE=/vmlinuz-linux-vfio root=UUID=313ad0a2-8b22-427a-80f2-df468696b6c9 rw rd.driver.pre=vfio-pci quiet

and all I've added to grub is

GRUB_CMDLINE_LINUX=intel_iommu=on
GRUB_CMDLINE_LINUX=iommu=pt

I'm using an Intel i5 4690k and my mobo supports both IOMMU and VT-d.

EDIT: For anyone else who sees this, I fixed it.
I used

GRUB_CMDLINE_LINUX_DEFAULT=

instead.

Last edited by MrChefur (2015-08-22 04:49:48)

Offline

Board footer

Powered by FluxBB