[PATCH v2/2] i915: Support Intel GPU porting on any non-x86 system.

zhangzhijie posted 1 patch 6 days, 20 hours ago
There is a newer version of this series
drivers/gpu/drm/i915/display/intel_vga.c | 33 +++++++++++++++++-------
1 file changed, 23 insertions(+), 10 deletions(-)
[PATCH v2/2] i915: Support Intel GPU porting on any non-x86 system.
Posted by zhangzhijie 6 days, 20 hours ago
inb/outb speccial wire not support on other ARCH.
Should detect whether arch platform support or not.

Signed-off-by: zhangzhijie <zhangzhijie@bosc.ac.cn>
---
 drivers/gpu/drm/i915/display/intel_vga.c | 33 +++++++++++++++++-------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
index 6e125564db34..d85622ba10fc 100644
--- a/drivers/gpu/drm/i915/display/intel_vga.c
+++ b/drivers/gpu/drm/i915/display/intel_vga.c
@@ -41,6 +41,15 @@ static bool has_vga_pipe_sel(struct intel_display *display)
 	return DISPLAY_VER(display) < 7;
 }
 
+static bool intel_arch_support_vga_pm(struct intel_display *display)
+{
+#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
+	return true;
+#else
+	return false;
+#endif
+}
+
 /* Disable the VGA plane that we never use */
 void intel_vga_disable(struct intel_display *display)
 {
@@ -64,13 +73,15 @@ void intel_vga_disable(struct intel_display *display)
 	drm_dbg_kms(display->drm, "Disabling VGA plane on pipe %c\n",
 		    pipe_name(pipe));
 
-	/* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
-	vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
-	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);
+	if (likely(intel_arch_support_vga_pm(display))) {
+		/* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
+		vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
+		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);
+	}
 
 	intel_de_write(display, vga_reg, VGA_DISP_DISABLE);
 	intel_de_posting_read(display, vga_reg);
@@ -90,9 +101,11 @@ void intel_vga_reset_io_mem(struct intel_display *display)
 	 * sure vgacon can keep working normally without triggering interrupts
 	 * and error messages.
 	 */
-	vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
-	outb(inb(VGA_MIS_R), VGA_MIS_W);
-	vga_put(pdev, VGA_RSRC_LEGACY_IO);
+	if (likely(intel_arch_support_vga_pm(display))) {
+		vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
+		outb(inb(VGA_MIS_R), VGA_MIS_W);
+		vga_put(pdev, VGA_RSRC_LEGACY_IO);
+	}
 }
 
 int intel_vga_register(struct intel_display *display)
-- 
2.34.1
Re: [PATCH v2/2] i915: Support Intel GPU porting on any non-x86 system.
Posted by Jani Nikula 6 days, 15 hours ago
On Tue, 25 Nov 2025, zhangzhijie <zhangzhijie@bosc.ac.cn> wrote:
> inb/outb speccial wire not support on other ARCH.
> Should detect whether arch platform support or not.

I would rather finish the discussion on the previous version before
seeing a new version.

You mentioned risc-v in the previous thread, but it needs to be part of
the commit message too. And I still don't know what "speccial wire" is
supposed to mean here.

You still use likely/unlikely, and I told you not to.

There's no patch changelog.

The version in the subject is "v2/2", but there has already been two
"v2" posted previously.


BR,
Jani.


>
> Signed-off-by: zhangzhijie <zhangzhijie@bosc.ac.cn>
> ---
>  drivers/gpu/drm/i915/display/intel_vga.c | 33 +++++++++++++++++-------
>  1 file changed, 23 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
> index 6e125564db34..d85622ba10fc 100644
> --- a/drivers/gpu/drm/i915/display/intel_vga.c
> +++ b/drivers/gpu/drm/i915/display/intel_vga.c
> @@ -41,6 +41,15 @@ static bool has_vga_pipe_sel(struct intel_display *display)
>  	return DISPLAY_VER(display) < 7;
>  }
>  
> +static bool intel_arch_support_vga_pm(struct intel_display *display)
> +{
> +#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
> +	return true;
> +#else
> +	return false;
> +#endif
> +}
> +
>  /* Disable the VGA plane that we never use */
>  void intel_vga_disable(struct intel_display *display)
>  {
> @@ -64,13 +73,15 @@ void intel_vga_disable(struct intel_display *display)
>  	drm_dbg_kms(display->drm, "Disabling VGA plane on pipe %c\n",
>  		    pipe_name(pipe));
>  
> -	/* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
> -	vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
> -	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);
> +	if (likely(intel_arch_support_vga_pm(display))) {
> +		/* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
> +		vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
> +		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);
> +	}
>  
>  	intel_de_write(display, vga_reg, VGA_DISP_DISABLE);
>  	intel_de_posting_read(display, vga_reg);
> @@ -90,9 +101,11 @@ void intel_vga_reset_io_mem(struct intel_display *display)
>  	 * sure vgacon can keep working normally without triggering interrupts
>  	 * and error messages.
>  	 */
> -	vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
> -	outb(inb(VGA_MIS_R), VGA_MIS_W);
> -	vga_put(pdev, VGA_RSRC_LEGACY_IO);
> +	if (likely(intel_arch_support_vga_pm(display))) {
> +		vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
> +		outb(inb(VGA_MIS_R), VGA_MIS_W);
> +		vga_put(pdev, VGA_RSRC_LEGACY_IO);
> +	}
>  }
>  
>  int intel_vga_register(struct intel_display *display)

-- 
Jani Nikula, Intel
Re: [PATCH v2/2] i915: Support Intel GPU porting on any non-x86 system.
Posted by ZhangZhiJie 6 days, 15 hours ago
Hi. Jani

On 2025/11/25 16:38, Jani Nikula wrote:
> On Tue, 25 Nov 2025, zhangzhijie <zhangzhijie@bosc.ac.cn> wrote:
>> inb/outb speccial wire not support on other ARCH.
>> Should detect whether arch platform support or not.
> 
> I would rather finish the discussion on the previous version before
> seeing a new version.
> 
> You mentioned risc-v in the previous thread, but it needs to be part of
> the commit message too. And I still don't know what "speccial wire" is
> supposed to mean here.
> 
I using RISCV to bootingup A380, This arch not support  VGA_SEQ_* 
ioports. and i don't know if other arch(such as aarch64) has VGA_SEQ_*.
> You still use likely/unlikely, and I told you not to.
> 
Ok, Next patch will fixed.
> There's no patch changelog.
> 
> The version in the subject is "v2/2", but there has already been two
> "v2" posted previously.
> 
After sending emails using V2, I realized that I had used V2 before, so 
I started using V2/2. Can I use V3 to continue with subsequent 
patch-modified commits?
> 
> BR,
> Jani.
> 
> 
>>
>> Signed-off-by: zhangzhijie <zhangzhijie@bosc.ac.cn>
>> ---
>>   drivers/gpu/drm/i915/display/intel_vga.c | 33 +++++++++++++++++-------
>>   1 file changed, 23 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
>> index 6e125564db34..d85622ba10fc 100644
>> --- a/drivers/gpu/drm/i915/display/intel_vga.c
>> +++ b/drivers/gpu/drm/i915/display/intel_vga.c
>> @@ -41,6 +41,15 @@ static bool has_vga_pipe_sel(struct intel_display *display)
>>   	return DISPLAY_VER(display) < 7;
>>   }
>>   
>> +static bool intel_arch_support_vga_pm(struct intel_display *display)
>> +{
>> +#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
>> +	return true;
>> +#else
>> +	return false;
>> +#endif
>> +}
>> +
>>   /* Disable the VGA plane that we never use */
>>   void intel_vga_disable(struct intel_display *display)
>>   {
>> @@ -64,13 +73,15 @@ void intel_vga_disable(struct intel_display *display)
>>   	drm_dbg_kms(display->drm, "Disabling VGA plane on pipe %c\n",
>>   		    pipe_name(pipe));
>>   
>> -	/* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
>> -	vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
>> -	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);
>> +	if (likely(intel_arch_support_vga_pm(display))) {
>> +		/* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
>> +		vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
>> +		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);
>> +	}
>>   
>>   	intel_de_write(display, vga_reg, VGA_DISP_DISABLE);
>>   	intel_de_posting_read(display, vga_reg);
>> @@ -90,9 +101,11 @@ void intel_vga_reset_io_mem(struct intel_display *display)
>>   	 * sure vgacon can keep working normally without triggering interrupts
>>   	 * and error messages.
>>   	 */
>> -	vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
>> -	outb(inb(VGA_MIS_R), VGA_MIS_W);
>> -	vga_put(pdev, VGA_RSRC_LEGACY_IO);
>> +	if (likely(intel_arch_support_vga_pm(display))) {
>> +		vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
>> +		outb(inb(VGA_MIS_R), VGA_MIS_W);
>> +		vga_put(pdev, VGA_RSRC_LEGACY_IO);
>> +	}
>>   }
>>   
>>   int intel_vga_register(struct intel_display *display)
>