* [PATCH v2] i915: Support Intel GPU porting on any non-x86 system.
@ 2025-11-24 6:56 zhangzhijie
2025-11-24 21:05 ` Ville Syrjälä
0 siblings, 1 reply; 11+ messages in thread
From: zhangzhijie @ 2025-11-24 6:56 UTC (permalink / raw)
To: jani.nikula, jeff, zhangzhijie, wangran, zhangjian, daniel,
rodrigo.vivi, joonas.lahtinen, tursulin, airlied, intel-gfx,
intel-xe, dri-devel, linux-kernel
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 | 27 ++++++++++++++++++------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
index 6e125564db34..d5d6c4ba6434 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)
{
@@ -66,11 +75,13 @@ void intel_vga_disable(struct intel_display *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);
+ if (likely(intel_arch_support_vga_pm(display))) {
+ 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);
@@ -91,8 +102,10 @@ void intel_vga_reset_io_mem(struct intel_display *display)
* 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))) {
+ 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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2] i915: Support Intel GPU porting on any non-x86 system.
@ 2025-11-24 6:56 zhangzhijie
2025-11-24 12:24 ` Jani Nikula
2025-11-25 13:18 ` Simon Richter
0 siblings, 2 replies; 11+ messages in thread
From: zhangzhijie @ 2025-11-24 6:56 UTC (permalink / raw)
To: jani.nikula, jeff, zhangzhijie, wangran, zhangjian, daniel,
rodrigo.vivi, joonas.lahtinen, tursulin, airlied, intel-gfx,
intel-xe, dri-devel, linux-kernel, guoyaxing
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 | 27 ++++++++++++++++++------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
index 6e125564db34..d5d6c4ba6434 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)
{
@@ -66,11 +75,13 @@ void intel_vga_disable(struct intel_display *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);
+ if (likely(intel_arch_support_vga_pm(display))) {
+ 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);
@@ -91,8 +102,10 @@ void intel_vga_reset_io_mem(struct intel_display *display)
* 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))) {
+ 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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2] i915: Support Intel GPU porting on any non-x86 system.
2025-11-24 6:56 [PATCH v2] i915: Support Intel GPU porting on any non-x86 system zhangzhijie
@ 2025-11-24 12:24 ` Jani Nikula
2025-11-25 9:55 ` ZhangZhiJie
2025-11-25 13:18 ` Simon Richter
1 sibling, 1 reply; 11+ messages in thread
From: Jani Nikula @ 2025-11-24 12:24 UTC (permalink / raw)
To: zhangzhijie, jeff, zhangzhijie, wangran, zhangjian, daniel,
rodrigo.vivi, joonas.lahtinen, tursulin, airlied, intel-gfx,
intel-xe, dri-devel, linux-kernel, guoyaxing
On Mon, 24 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.
Seems to me it inb/outb depend on CONFIG_HAS_IOPORT. Which arch are you
talking about specifically?
> Signed-off-by: zhangzhijie <zhangzhijie@bosc.ac.cn>
> ---
> drivers/gpu/drm/i915/display/intel_vga.c | 27 ++++++++++++++++++------
> 1 file changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
> index 6e125564db34..d5d6c4ba6434 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)
> {
> @@ -66,11 +75,13 @@ void intel_vga_disable(struct intel_display *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);
> + if (likely(intel_arch_support_vga_pm(display))) {
As a rule of thumb, please do not use likely/unlikely, at all.
Here, intel_arch_support_vga_pm() is evaluated at build time, and the
likely has no functional value, only dubious documentation value.
> + 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);
Both or neither get/put need to be inside the branch. Now you only get,
never put, on non-x86.
BR,
Jani.
> + udelay(300);
> + }
>
> intel_de_write(display, vga_reg, VGA_DISP_DISABLE);
> intel_de_posting_read(display, vga_reg);
> @@ -91,8 +102,10 @@ void intel_vga_reset_io_mem(struct intel_display *display)
> * 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))) {
> + 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] i915: Support Intel GPU porting on any non-x86 system.
2025-11-24 6:56 zhangzhijie
@ 2025-11-24 21:05 ` Ville Syrjälä
2025-11-25 3:31 ` ZhangZhiJie
0 siblings, 1 reply; 11+ messages in thread
From: Ville Syrjälä @ 2025-11-24 21:05 UTC (permalink / raw)
To: zhangzhijie
Cc: jani.nikula, jeff, wangran, zhangjian, daniel, rodrigo.vivi,
joonas.lahtinen, tursulin, airlied, intel-gfx, intel-xe,
dri-devel, linux-kernel
On Mon, Nov 24, 2025 at 02:56:12PM +0800, zhangzhijie wrote:
> 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 | 27 ++++++++++++++++++------
> 1 file changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
> index 6e125564db34..d5d6c4ba6434 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)
whatis "pm"?
> +{
> +#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
> + return true;
> +#else
> + return false;
> +#endif
Isn't there already some kind of ARCH_HAS_PORTIO thing?
Does that not work?
> +}
> +
> /* Disable the VGA plane that we never use */
> void intel_vga_disable(struct intel_display *display)
> {
> @@ -66,11 +75,13 @@ void intel_vga_disable(struct intel_display *display)
>
I wouldn't expect us to get this far. The VGA plane should
never have been enabled in the first place.
> /* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
> vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
Why are you leaving the vga_get() outside the check?
> - 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))) {
> + 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);
> @@ -91,8 +102,10 @@ void intel_vga_reset_io_mem(struct intel_display *display)
> * 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))) {
> + 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
--
Ville Syrjälä
Intel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] i915: Support Intel GPU porting on any non-x86 system.
2025-11-24 21:05 ` Ville Syrjälä
@ 2025-11-25 3:31 ` ZhangZhiJie
0 siblings, 0 replies; 11+ messages in thread
From: ZhangZhiJie @ 2025-11-25 3:31 UTC (permalink / raw)
To: Ville Syrjälä
Cc: jani.nikula, jeff, wangran, zhangjian, daniel, rodrigo.vivi,
joonas.lahtinen, tursulin, airlied, intel-gfx, intel-xe,
dri-devel, linux-kernel
On 2025/11/25 05:05, Ville Syrjälä wrote:
> On Mon, Nov 24, 2025 at 02:56:12PM +0800, zhangzhijie wrote:
>> 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 | 27 ++++++++++++++++++------
>> 1 file changed, 20 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
>> index 6e125564db34..d5d6c4ba6434 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)
>
> whatis "pm"?
I'd wana to power-manage . or can using better function name
>
>> +{
>> +#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
>> + return true;
>> +#else
>> + return false;
>> +#endif
>
> Isn't there already some kind of ARCH_HAS_PORTIO thing?
> Does that not work?
>
configs had HAS_IOPORT, But non-x86 arch not support ioport for VGA_SEQ_*
>> +}
>> +
>> /* Disable the VGA plane that we never use */
>> void intel_vga_disable(struct intel_display *display)
>> {
>> @@ -66,11 +75,13 @@ void intel_vga_disable(struct intel_display *display)
>>
>
> I wouldn't expect us to get this far. The VGA plane should
> never have been enabled in the first place.
>
>> /* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
>> vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
>
> Why are you leaving the vga_get() outside the check?
>
Sorry forgot , I will take new patch for fix this misstake
>> - 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))) {
>> + 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);
>> @@ -91,8 +102,10 @@ void intel_vga_reset_io_mem(struct intel_display *display)
>> * 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))) {
>> + 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
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] i915: Support Intel GPU porting on any non-x86 system.
2025-11-24 12:24 ` Jani Nikula
@ 2025-11-25 9:55 ` ZhangZhiJie
2025-11-25 10:13 ` Jani Nikula
0 siblings, 1 reply; 11+ messages in thread
From: ZhangZhiJie @ 2025-11-25 9:55 UTC (permalink / raw)
To: Jani Nikula, jeff, wangran, zhangjian, daniel, rodrigo.vivi,
joonas.lahtinen, tursulin, airlied, intel-gfx, intel-xe,
dri-devel, linux-kernel, guoyaxing
On 2025/11/24 20:24, Jani Nikula wrote:
> On Mon, 24 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.
>
> Seems to me it inb/outb depend on CONFIG_HAS_IOPORT. Which arch are you
> talking about specifically?
riscv , has CONFIG_HAS_IOPORT. is using for serial, GPIO., etc.
Thanks.
BR.
ZhiJie
>
>> Signed-off-by: zhangzhijie <zhangzhijie@bosc.ac.cn>
>> ---
>> drivers/gpu/drm/i915/display/intel_vga.c | 27 ++++++++++++++++++------
>> 1 file changed, 20 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
>> index 6e125564db34..d5d6c4ba6434 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)
>> {
>> @@ -66,11 +75,13 @@ void intel_vga_disable(struct intel_display *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);
>> + if (likely(intel_arch_support_vga_pm(display))) {
>
> As a rule of thumb, please do not use likely/unlikely, at all.
>
> Here, intel_arch_support_vga_pm() is evaluated at build time, and the
> likely has no functional value, only dubious documentation value.
>
>> + 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);
>
> Both or neither get/put need to be inside the branch. Now you only get,
> never put, on non-x86.
>
> BR,
> Jani.
>
>> + udelay(300);
>> + }
>>
>> intel_de_write(display, vga_reg, VGA_DISP_DISABLE);
>> intel_de_posting_read(display, vga_reg);
>> @@ -91,8 +102,10 @@ void intel_vga_reset_io_mem(struct intel_display *display)
>> * 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))) {
>> + outb(inb(VGA_MIS_R), VGA_MIS_W);
>> + vga_put(pdev, VGA_RSRC_LEGACY_IO);
>> + }
>> }
>>
>> int intel_vga_register(struct intel_display *display)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] i915: Support Intel GPU porting on any non-x86 system.
2025-11-25 9:55 ` ZhangZhiJie
@ 2025-11-25 10:13 ` Jani Nikula
2025-11-25 10:20 ` ZhangZhiJie
0 siblings, 1 reply; 11+ messages in thread
From: Jani Nikula @ 2025-11-25 10:13 UTC (permalink / raw)
To: ZhangZhiJie, jeff, wangran, zhangjian, daniel, rodrigo.vivi,
joonas.lahtinen, tursulin, airlied, intel-gfx, intel-xe,
dri-devel, linux-kernel, guoyaxing
On Tue, 25 Nov 2025, ZhangZhiJie <zhangzhijie@bosc.ac.cn> wrote:
> On 2025/11/24 20:24, Jani Nikula wrote:
>> On Mon, 24 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.
>>
>> Seems to me it inb/outb depend on CONFIG_HAS_IOPORT. Which arch are you
>> talking about specifically?
>
> riscv , has CONFIG_HAS_IOPORT. is using for serial, GPIO., etc.
What is the actual failure mode you see?
Does it build?
BR,
Jani.
>
> Thanks.
> BR.
> ZhiJie
>>
>>> Signed-off-by: zhangzhijie <zhangzhijie@bosc.ac.cn>
>>> ---
>>> drivers/gpu/drm/i915/display/intel_vga.c | 27 ++++++++++++++++++------
>>> 1 file changed, 20 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
>>> index 6e125564db34..d5d6c4ba6434 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)
>>> {
>>> @@ -66,11 +75,13 @@ void intel_vga_disable(struct intel_display *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);
>>> + if (likely(intel_arch_support_vga_pm(display))) {
>>
>> As a rule of thumb, please do not use likely/unlikely, at all.
>>
>> Here, intel_arch_support_vga_pm() is evaluated at build time, and the
>> likely has no functional value, only dubious documentation value.
>>
>>> + 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);
>>
>> Both or neither get/put need to be inside the branch. Now you only get,
>> never put, on non-x86.
>>
>> BR,
>> Jani.
>>
>>> + udelay(300);
>>> + }
>>>
>>> intel_de_write(display, vga_reg, VGA_DISP_DISABLE);
>>> intel_de_posting_read(display, vga_reg);
>>> @@ -91,8 +102,10 @@ void intel_vga_reset_io_mem(struct intel_display *display)
>>> * 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))) {
>>> + 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] i915: Support Intel GPU porting on any non-x86 system.
2025-11-25 10:13 ` Jani Nikula
@ 2025-11-25 10:20 ` ZhangZhiJie
2025-11-25 21:54 ` Lucas De Marchi
0 siblings, 1 reply; 11+ messages in thread
From: ZhangZhiJie @ 2025-11-25 10:20 UTC (permalink / raw)
To: Jani Nikula, jeff, wangran, zhangjian, daniel, rodrigo.vivi,
joonas.lahtinen, tursulin, airlied, intel-gfx, intel-xe,
dri-devel, linux-kernel, guoyaxing
On 2025/11/25 18:13, Jani Nikula wrote:
> On Tue, 25 Nov 2025, ZhangZhiJie <zhangzhijie@bosc.ac.cn> wrote:
>> On 2025/11/24 20:24, Jani Nikula wrote:
>>> On Mon, 24 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.
>>>
>>> Seems to me it inb/outb depend on CONFIG_HAS_IOPORT. Which arch are you
>>> talking about specifically?
>>
>> riscv , has CONFIG_HAS_IOPORT. is using for serial, GPIO., etc.
>
> What is the actual failure mode you see?
>
> Does it build?
>
> BR,
> Jani.
>
Yes, i compiled Xe driver, and it's occured load access fault when not
disable VGA_SEQ_*.
can found this link
https://github.com/geerlingguy/raspberry-pi-pcie-devices/issues/510#issuecomment-3383284831
Thanks.
BR.
ZhiJie
>
>
>>
>> Thanks.
>> BR.
>> ZhiJie
>>>
>>>> Signed-off-by: zhangzhijie <zhangzhijie@bosc.ac.cn>
>>>> ---
>>>> drivers/gpu/drm/i915/display/intel_vga.c | 27 ++++++++++++++++++------
>>>> 1 file changed, 20 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
>>>> index 6e125564db34..d5d6c4ba6434 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)
>>>> {
>>>> @@ -66,11 +75,13 @@ void intel_vga_disable(struct intel_display *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);
>>>> + if (likely(intel_arch_support_vga_pm(display))) {
>>>
>>> As a rule of thumb, please do not use likely/unlikely, at all.
>>>
>>> Here, intel_arch_support_vga_pm() is evaluated at build time, and the
>>> likely has no functional value, only dubious documentation value.
>>>
>>>> + 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);
>>>
>>> Both or neither get/put need to be inside the branch. Now you only get,
>>> never put, on non-x86.
>>>
>>> BR,
>>> Jani.
>>>
>>>> + udelay(300);
>>>> + }
>>>>
>>>> intel_de_write(display, vga_reg, VGA_DISP_DISABLE);
>>>> intel_de_posting_read(display, vga_reg);
>>>> @@ -91,8 +102,10 @@ void intel_vga_reset_io_mem(struct intel_display *display)
>>>> * 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))) {
>>>> + outb(inb(VGA_MIS_R), VGA_MIS_W);
>>>> + vga_put(pdev, VGA_RSRC_LEGACY_IO);
>>>> + }
>>>> }
>>>>
>>>> int intel_vga_register(struct intel_display *display)
>>>
>>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] i915: Support Intel GPU porting on any non-x86 system.
2025-11-24 6:56 [PATCH v2] i915: Support Intel GPU porting on any non-x86 system zhangzhijie
2025-11-24 12:24 ` Jani Nikula
@ 2025-11-25 13:18 ` Simon Richter
1 sibling, 0 replies; 11+ messages in thread
From: Simon Richter @ 2025-11-25 13:18 UTC (permalink / raw)
To: zhangzhijie, jani.nikula, jeff, wangran, zhangjian, daniel,
rodrigo.vivi, joonas.lahtinen, tursulin, airlied, intel-gfx,
intel-xe, dri-devel, linux-kernel, guoyaxing
Hi,
On 11/24/25 3:56 PM, zhangzhijie wrote:
> inb/outb speccial wire not support on other ARCH.
> Should detect whether arch platform support or not.
These platforms still have inb/outb definitions though that do
something. https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1824
has a few cases where this goes wrong.
There are also a few Intel chipsets that also allow MMIO accesses to VGA
registers. Whether there is an intersection of chipsets that allow it,
and chipsets where that is useful is another question though.
> vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
This function really should check if inb/outb will address pdev after
the function returns, and return an error if not, then the accesses here
and in the power well code could be conditional on this, and it would be
generic.
For this, the vgaarb code would need to check that the bridges on the
way up have accepted the VGA forwarding bit (i.e. read back after
writing it), and there probably should be a mechanism for the bridge
between PCI(e) and the platform bus, so systems with multiple PCI(e)
domains can also be handled.
E.g. on POWER, there are global variables "isa_io_base" and
"pci_io_base", and it is assumed that these point to a place that
generates IO accesses from MMIO, but this assumption is not actually
verified, and I can pretty much guarantee that it's wrong if the PCIe
bus in question is not even attached to the first socket.
Just checking that upstream bridges accept the VGA bit while vgaarb
switches decoding over would solve all of my problems though, because
the root bridge doesn't, so that would be a quick way of inhibiting
these accesses. It might work for you too, just try setting the bit
manually with setpci and check if it sticks.
Simon
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] i915: Support Intel GPU porting on any non-x86 system.
2025-11-25 10:20 ` ZhangZhiJie
@ 2025-11-25 21:54 ` Lucas De Marchi
2025-11-26 1:39 ` ZhangZhiJie
0 siblings, 1 reply; 11+ messages in thread
From: Lucas De Marchi @ 2025-11-25 21:54 UTC (permalink / raw)
To: ZhangZhiJie
Cc: Jani Nikula, jeff, wangran, zhangjian, daniel, rodrigo.vivi,
joonas.lahtinen, tursulin, airlied, intel-gfx, intel-xe,
dri-devel, linux-kernel, guoyaxing
On Tue, Nov 25, 2025 at 06:20:00PM +0800, ZhangZhiJie wrote:
>
>
>On 2025/11/25 18:13, Jani Nikula wrote:
>>On Tue, 25 Nov 2025, ZhangZhiJie <zhangzhijie@bosc.ac.cn> wrote:
>>>On 2025/11/24 20:24, Jani Nikula wrote:
>>>>On Mon, 24 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.
>>>>
>>>>Seems to me it inb/outb depend on CONFIG_HAS_IOPORT. Which arch are you
>>>>talking about specifically?
>>>
>>>riscv , has CONFIG_HAS_IOPORT. is using for serial, GPIO., etc.
>>
>>What is the actual failure mode you see?
>>
>>Does it build?
>>
>>BR,
>>Jani.
>>
>Yes, i compiled Xe driver, and it's occured load access fault when not
>disable VGA_SEQ_*.
>
>can found this link https://github.com/geerlingguy/raspberry-pi-pcie-devices/issues/510#issuecomment-3383284831
and this is what I tested with rpi:
https://lore.kernel.org/intel-xe/20251119-ioport-v1-1-ec43f1e12c49@intel.com/
not sure why you are changing the intel_vga_disable() function: out of
reset that bit is disabled and the function does nothing:
tmp = intel_de_read(display, vga_reg);
if (tmp & VGA_DISP_DISABLE)
return;
If there's no VGA, no bios, then there isn't anything enabling that and
we don't need to disable it.
I have a patch that moves the vga access to a separate function,
intel_vga_set_screen_off(), but that's mostly for clarity, not to fix
anything. If later we want to add an ifdef then we'd probably have to
implement the alternative.
Also note that not having CONFIG_HAS_IOPORT doesn't mean inb()/outb()
are not implemented. See arch/{arm,powerpc,sparc}/include/asm/io.h
for a few variants.
Lucas De Marchi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] i915: Support Intel GPU porting on any non-x86 system.
2025-11-25 21:54 ` Lucas De Marchi
@ 2025-11-26 1:39 ` ZhangZhiJie
0 siblings, 0 replies; 11+ messages in thread
From: ZhangZhiJie @ 2025-11-26 1:39 UTC (permalink / raw)
To: Lucas De Marchi
Cc: Jani Nikula, jeff, wangran, zhangjian, daniel, rodrigo.vivi,
joonas.lahtinen, tursulin, airlied, intel-gfx, intel-xe,
dri-devel, linux-kernel, guoyaxing
On 2025/11/26 05:54, Lucas De Marchi wrote:
> On Tue, Nov 25, 2025 at 06:20:00PM +0800, ZhangZhiJie wrote:
>>
>>
>> On 2025/11/25 18:13, Jani Nikula wrote:
>>> On Tue, 25 Nov 2025, ZhangZhiJie <zhangzhijie@bosc.ac.cn> wrote:
>>>> On 2025/11/24 20:24, Jani Nikula wrote:
>>>>> On Mon, 24 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.
>>>>>
>>>>> Seems to me it inb/outb depend on CONFIG_HAS_IOPORT. Which arch are
>>>>> you
>>>>> talking about specifically?
>>>>
>>>> riscv , has CONFIG_HAS_IOPORT. is using for serial, GPIO., etc.
>>>
>>> What is the actual failure mode you see?
>>>
>>> Does it build?
>>>
>>> BR,
>>> Jani.
>>>
>> Yes, i compiled Xe driver, and it's occured load access fault when not
>> disable VGA_SEQ_*.
>>
>> can found this link https://github.com/geerlingguy/raspberry-pi-pcie-
>> devices/issues/510#issuecomment-3383284831
>
> and this is what I tested with rpi:
> https://lore.kernel.org/intel-xe/20251119-ioport-v1-1-
> ec43f1e12c49@intel.com/
>
Yep. agree like this patch.
In my mind. if machine not implement VGA_SEQ_* ioport.
should avoid access ioports about VGA_SEQ_* .
Can you give log for bootting on non-x86 arch?
> not sure why you are changing the intel_vga_disable() function: out of
> reset that bit is disabled and the function does nothing:
>
> tmp = intel_de_read(display, vga_reg);
> if (tmp & VGA_DISP_DISABLE)
> return;
>
> If there's no VGA, no bios, then there isn't anything enabling that and
> we don't need to disable it.
>
> I have a patch that moves the vga access to a separate function,
> intel_vga_set_screen_off(), but that's mostly for clarity, not to fix
> anything. If later we want to add an ifdef then we'd probably have to
> implement the alternative.
>
> Also note that not having CONFIG_HAS_IOPORT doesn't mean inb()/outb()
> are not implemented. See arch/{arm,powerpc,sparc}/include/asm/io.h
> for a few variants.
>
> Lucas De Marchi
BR.
ZhiJie
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-11-26 1:55 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-24 6:56 [PATCH v2] i915: Support Intel GPU porting on any non-x86 system zhangzhijie
2025-11-24 12:24 ` Jani Nikula
2025-11-25 9:55 ` ZhangZhiJie
2025-11-25 10:13 ` Jani Nikula
2025-11-25 10:20 ` ZhangZhiJie
2025-11-25 21:54 ` Lucas De Marchi
2025-11-26 1:39 ` ZhangZhiJie
2025-11-25 13:18 ` Simon Richter
-- strict thread matches above, loose matches on Subject: below --
2025-11-24 6:56 zhangzhijie
2025-11-24 21:05 ` Ville Syrjälä
2025-11-25 3:31 ` ZhangZhiJie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox