Skip to contentSkip to conversation

linux-next: build failure after merge of the pci tree

PATCH New Mark Brown 3 participants 6 messages Mar 27 – Mar 30

Subsystems (6)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

Hi all,

After merging the pci tree, today's linux-next build (x86_64 allmodconfig) failed like this:

/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:
In function 'intel_vga_disable':
/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:68:9: error:
ignoring return value of 'vga_get_uninterruptible' declared with attribute 'warn_unused_result' [-Werror=unused-result]

   68 |         vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:
In function 'intel_vga_reset_io_mem':
/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:93:9: error:
ignoring return value of 'vga_get_uninterruptible' declared with attribute 'warn_unused_result' [-Werror=unused-result]

   93 |         vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors make[7]:
*** [/tmp/next/build/scripts/Makefile.build:289:
drivers/gpu/drm/i915/display/intel_vga.o] Error
1 make[7]: *** Waiting for unfinished jobs.... /tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:
In function 'intel_vga_disable':
/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:68:9: error:
ignoring return value of 'vga_get_uninterruptible' declared with attribute 'warn_unused_result' [-Werror=unused-result]

   68 |         vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:
In function 'intel_vga_reset_io_mem':
/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:93:9: error:
ignoring return value of 'vga_get_uninterruptible' declared with attribute 'warn_unused_result' [-Werror=unused-result]

   93 |         vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors make[7]:
*** [/tmp/next/build/drivers/gpu/drm/xe/Makefile:207:
drivers/gpu/drm/xe/i915-display/intel_vga.o] Error 1 make[7]: *** Waiting for unfinished jobs.... make[6]: *** [/tmp/next/build/scripts/Makefile.build:548: drivers/gpu/drm/i915] Error 2 make[6]: *** Waiting for unfinished jobs.... make[6]: *** [/tmp/next/build/scripts/Makefile.build:548:
drivers/gpu/drm/xe] Error 2 make[5]: ***

Caused by commit

dc582b5ed4b749 (PCI/VGA: Mark vga_get() and wrappers as __must_check)

I have used the version from next-20260326 instead.

author maintainer
#1 lore raw
Quoted 4 lines · Mark Brown

Hi all,

After merging the pci tree, today's linux-next build (x86_64 allmodconfig) failed like this:

This is still present today.

#2 lore raw

Hi,

Quoted 10 lines · Mark Brown
Quoted 8 lines

After merging the pci tree, today's linux-next build (x86_64 allmodconfig) failed like this:

/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:
In function 'intel_vga_disable':
/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:68:9: error: ignoring return value of 'vga_get_uninterruptible' declared with attribute 'warn_unused_result' [-Werror=unused-result]

   68 |         vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is still present today.

The fix for that should have gone in through drm-next. The version where the warning occurs in line 68 is ancient however (that was changed[2] in December).

There's a backported fix[3] that applies to anything from 5.3 onwards. Will send as a patch as a reply to this mail.

Simon

[1] https://cgit.freedesktop.org/drm/drm/commit/?id=cda15ff39df82ef6842affeb8cf57d0090708227

[2] https://cgit.freedesktop.org/drm/drm/commit/?id=cc6ed470caa201b25e9e7e1ca21144e17914644c

[3] https://patchwork.freedesktop.org/patch/709684/?series=161721&rev=4

author maintainer
#3 lore raw
Quoted 10 lines · Simon Richter
Quoted 6 lines · Mark Brown
Quoted 6 lines

After merging the pci tree, today's linux-next build (x86_64 allmodconfig) failed like this:

/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:
In function 'intel_vga_disable':
/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:68:9: error:

ignoring return value of 'vga_get_uninterruptible' declared with attribute 'warn_unused_result' [-Werror=unused-result]

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
   68 |         vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is still present today.

The fix for that should have gone in through drm-next. The version where the warning occurs in line 68 is ancient however (that was changed[2] in December).

The DRM tree is merged into -next after the PCI tree so that's not going to work, and in any case your tree really should work independently.

#4 lore raw
Quoted 14 lines · Mark Brown
Quoted 12 lines · Simon Richter
Quoted 6 lines · Mark Brown
Quoted 6 lines

After merging the pci tree, today's linux-next build (x86_64 allmodconfig) failed like this:

/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:
In function 'intel_vga_disable':
/tmp/next/build/drivers/gpu/drm/i915/display/intel_vga.c:68:9: error:

ignoring return value of 'vga_get_uninterruptible' declared with attribute 'warn_unused_result' [-Werror=unused-result]

Quoted 2 lines
Quoted 2 lines
   68 |         vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This is still present today.

The fix for that should have gone in through drm-next. The version where the warning occurs in line 68 is ancient however (that was changed[2] in December).

The DRM tree is merged into -next after the PCI tree so that's not going to work, and in any case your tree really should work independently.

I dropped these these patches from the PCI tree for now, sorry for the trouble:

21b082bd2a45 ("PCI/VGA: Mark pci_set_vga_state() as __must_check") dc582b5ed4b7 ("PCI/VGA: Mark vga_get() and wrappers as __must_check")

For reference, I'm attaching the patches below. We can deal with them later.

commit 21b082bd2a45 ("PCI/VGA: Mark pci_set_vga_state() as __must_check")

Author: Simon Richter <[email protected]>
Date:   Sun Mar 8 02:35:38 2026 +0900

PCI/VGA: Mark pci_set_vga_state() as __must_check

pci_set_vga_state() can return an error, usually on non-x86 or virtualized environments, so mark it as __must_check.

The only caller so far is __vga_tryget() in vgaarb.

include/linux/pci.h +2 -2
index 1c270f1d5123..aa1451d402d1 100644
@@ -1720,8 +1720,8 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 #define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0)
 #define PCI_VGA_STATE_CHANGE_DECODES (1 << 1)
 
-int pci_set_vga_state(struct pci_dev *pdev, bool decode,
-		      unsigned int command_bits, u32 flags);
+int __must_check pci_set_vga_state(struct pci_dev *pdev, bool decode,
+				   unsigned int command_bits, u32 flags);
 
 /*
  * Virtual interrupts allow for more interrupts to be allocated

commit dc582b5ed4b7 ("PCI/VGA: Mark vga_get() and wrappers as __must_check")

Author: Simon Richter <[email protected]>
Date:   Sun Mar 8 02:35:36 2026 +0900

PCI/VGA: Mark vga_get() and wrappers as __must_check

The vga_get() function and the two wrappers vga_get_interruptible() and vga_get_uninterruptible() can return errors. As these are paired with vga_put(), which must only be called after vga_get() returned success, all callers need to check the return code.

include/linux/vgaarb.h +8 -7
index 97129a1bbb7d..eed524c67c22 100644
@@ -27,7 +27,8 @@ struct pci_dev;
 
 #ifdef CONFIG_VGA_ARB
 void vga_set_legacy_decoding(struct pci_dev *pdev, unsigned int decodes);
-int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible);
+int __must_check vga_get(struct pci_dev *pdev, unsigned int rsrc,
+			 int interruptible);
 void vga_put(struct pci_dev *pdev, unsigned int rsrc);
 struct pci_dev *vga_default_device(void);
 void vga_set_default_device(struct pci_dev *pdev);
@@ -39,8 +40,8 @@ static inline void vga_set_legacy_decoding(struct pci_dev *pdev,
 		unsigned int decodes)
 {
 };
-static inline int vga_get(struct pci_dev *pdev, unsigned int rsrc,
-		int interruptible)
+static inline int __must_check vga_get(struct pci_dev *pdev, unsigned int rsrc,
+				       int interruptible)
 {
 	return 0;
 }
@@ -74,8 +75,8 @@ static inline int vga_client_register(struct pci_dev *pdev,
  *
  * On success, release the VGA resource again with vga_put().
  */
-static inline int vga_get_interruptible(struct pci_dev *pdev,
-					unsigned int rsrc)
+static inline int __must_check vga_get_interruptible(struct pci_dev *pdev,
+						     unsigned int rsrc)
 {
 	return vga_get(pdev, rsrc, 1);
 }
@@ -89,8 +90,8 @@ static inline int vga_get_interruptible(struct pci_dev *pdev,
  *
  * On success, release the VGA resource again with vga_put().
  */
-static inline int vga_get_uninterruptible(struct pci_dev *pdev,
-					  unsigned int rsrc)
+static inline int __must_check vga_get_uninterruptible(struct pci_dev *pdev,
+						       unsigned int rsrc)
 {
 	return vga_get(pdev, rsrc, 0);
 }
#5 lore raw

PATCH 1/1 drm/i915: handle failure from vga_get_uninterruptible()

In reply to Mark Brown

The vga_get_uninterruptible() function can return an error if it fails to set up VGA decoding for the requested device.

If VGA decoding is unavailable, we don't need to be careful to leave the VGA emulation in a usable state, as vgacon will also be unable to get access later on, so just skip over the VGA accesses and the vga_put() call matching the failed vga_get_uninterruptible().

---
 drivers/gpu/drm/i915/display/intel_vga.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_vga.c +19 -2
index 6e125564db34..dd581f20e962 100644
@@ -49,6 +49,7 @@ void intel_vga_disable(struct intel_display *display)
 	enum pipe pipe;
 	u32 tmp;
 	u8 sr1;
+	int err;
 
 	tmp = intel_de_read(display, vga_reg);
 	if (tmp & VGA_DISP_DISABLE)
@@ -65,13 +66,22 @@ void intel_vga_disable(struct intel_display *display)
 		    pipe_name(pipe));
 
 	/* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
-	vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
+	/*
+	 * if the VGA ports are inaccessible now, the chance that vgacon
+	 * will be able to access them later is low enough that we don't
+	 * have to care about the emulation state machines being in sync
+	 */
+	err = vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
+	if (err)
+		goto skip;
+
 	outb(0x01, VGA_SEQ_I);
 	sr1 = inb(VGA_SEQ_D);
 	outb(sr1 | VGA_SR01_SCREEN_OFF, VGA_SEQ_D);
 	vga_put(pdev, VGA_RSRC_LEGACY_IO);
 	udelay(300);
 
+skip:
 	intel_de_write(display, vga_reg, VGA_DISP_DISABLE);
 	intel_de_posting_read(display, vga_reg);
 }
@@ -79,6 +89,7 @@ void intel_vga_disable(struct intel_display *display)
 void intel_vga_reset_io_mem(struct intel_display *display)
 {
 	struct pci_dev *pdev = to_pci_dev(display->drm->dev);
+	int err;
 
 	/*
 	 * After we re-enable the power well, if we touch VGA register 0x3d5
@@ -89,8 +100,14 @@ void intel_vga_reset_io_mem(struct intel_display *display)
 	 * console_unlock(). So make here we touch the VGA MSR register, making
 	 * sure vgacon can keep working normally without triggering interrupts
 	 * and error messages.
+	 *
+	 * We ignore this issue if we can't access the VGA registers, because
+	 * neither can vgacon.
 	 */
-	vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
+	err = vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
+	if (err)
+		return;
+
 	outb(inb(VGA_MIS_R), VGA_MIS_W);
 	vga_put(pdev, VGA_RSRC_LEGACY_IO);
 }