[PATCH] drm/bridge: add it6505 driver read config from dt property

2022-06-26 Thread allen
From: allen chen 

add read max-lane and max-pixel-clock from dt property

Signed-off-by: Allen Chen 
Signed-off-by: Pin-yen Lin 
---
 drivers/gpu/drm/bridge/ite-it6505.c | 35 ++---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
index 4b673c4792d77..c9121d4635a52 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -436,6 +436,8 @@ struct it6505 {
bool powered;
bool hpd_state;
u32 afe_setting;
+   u32 max_dpi_pixel_clock;
+   u32 max_lane_count;
enum hdcp_state hdcp_status;
struct delayed_work hdcp_work;
struct work_struct hdcp_wait_ksv_list;
@@ -1466,7 +1468,8 @@ static void it6505_parse_link_capabilities(struct it6505 
*it6505)
it6505->lane_count = link->num_lanes;
DRM_DEV_DEBUG_DRIVER(dev, "Sink support %d lanes training",
 it6505->lane_count);
-   it6505->lane_count = min_t(int, it6505->lane_count, MAX_LANE_COUNT);
+   it6505->lane_count = min_t(int, it6505->lane_count,
+  it6505->max_lane_count);
 
it6505->branch_device = drm_dp_is_branch(it6505->dpcd);
DRM_DEV_DEBUG_DRIVER(dev, "Sink %sbranch device",
@@ -2895,7 +2898,7 @@ it6505_bridge_mode_valid(struct drm_bridge *bridge,
if (mode->flags & DRM_MODE_FLAG_INTERLACE)
return MODE_NO_INTERLACE;
 
-   if (mode->clock > DPI_PIXEL_CLK_MAX)
+   if (mode->clock > it6505->max_dpi_pixel_clock)
return MODE_CLOCK_HIGH;
 
it6505->video_info.clock = mode->clock;
@@ -3057,6 +3060,8 @@ static void it6505_parse_dt(struct it6505 *it6505)
 {
struct device *dev = >client->dev;
u32 *afe_setting = >afe_setting;
+   u32 *max_lane_count = >max_lane_count;
+   u32 *max_dpi_pixel_clock = >max_dpi_pixel_clock;
 
it6505->lane_swap_disabled =
device_property_read_bool(dev, "no-laneswap");
@@ -3072,7 +3077,31 @@ static void it6505_parse_dt(struct it6505 *it6505)
} else {
*afe_setting = 0;
}
-   DRM_DEV_DEBUG_DRIVER(dev, "using afe_setting: %d", *afe_setting);
+
+   if (device_property_read_u32(dev, "max-lane-count",
+max_lane_count) == 0) {
+   if (*max_lane_count > 4 || *max_lane_count == 3) {
+   dev_err(dev, "max lane count error, use default");
+   *max_lane_count = MAX_LANE_COUNT;
+   }
+   } else {
+   *max_lane_count = MAX_LANE_COUNT;
+   }
+
+   if (device_property_read_u32(dev, "max-dpi-pixel-clock",
+max_dpi_pixel_clock) == 0) {
+   if (*max_dpi_pixel_clock > 297000) {
+   dev_err(dev, "max pixel clock error, use default");
+   *max_dpi_pixel_clock = DPI_PIXEL_CLK_MAX;
+   }
+   } else {
+   *max_dpi_pixel_clock = DPI_PIXEL_CLK_MAX;
+   }
+
+   DRM_DEV_DEBUG_DRIVER(dev, "using afe_setting: %u, max_lane_count: %u",
+it6505->afe_setting, it6505->max_lane_count);
+   DRM_DEV_DEBUG_DRIVER(dev, "using max_dpi_pixel_clock: %u kHz",
+it6505->max_dpi_pixel_clock);
 }
 
 static ssize_t receive_timing_debugfs_show(struct file *file, char __user *buf,
-- 
2.25.1



Re: [bug report] drm: Add support for the LogiCVC display controller

2022-06-26 Thread Dan Carpenter
On Fri, Jun 24, 2022 at 04:53:25PM +0200, Paul Kocialkowski wrote:
> Hello Dan,
> 
> On Tue 14 Jun 22, 15:07, Dan Carpenter wrote:
> > Hello Paul Kocialkowski,
> > 
> > The patch efeeaefe9be5: "drm: Add support for the LogiCVC display
> > controller" from May 20, 2022, leads to the following Smatch static
> > checker warning:
> > 
> > drivers/gpu/drm/logicvc/logicvc_layer.c:320 
> > logicvc_layer_buffer_find_setup()
> > warn: impossible condition '(hoffset > (1))) << (16)) - 1)) => 
> > (0-u16max > u16max)'
> > 
> > drivers/gpu/drm/logicvc/logicvc_layer.c
> > 258 int logicvc_layer_buffer_find_setup(struct logicvc_drm *logicvc,
> > 259 struct logicvc_layer *layer,
> > 260 struct drm_plane_state *state,
> > 261 struct 
> > logicvc_layer_buffer_setup *setup)
> > 262 {
> > 263 struct drm_device *drm_dev = >drm_dev;
> > 264 struct drm_framebuffer *fb = state->fb;
> > 265 /* All the supported formats have a single data plane. */
> > 266 u32 layer_bytespp = fb->format->cpp[0];
> > 267 u32 layer_stride = layer_bytespp * 
> > logicvc->config.row_stride;
> > 268 u32 base_offset = layer->config.base_offset * layer_stride;
> > 269 u32 buffer_offset = layer->config.buffer_offset * 
> > layer_stride;
> > 270 u8 buffer_sel = 0;
> > 271 u16 voffset = 0;
> > 272 u16 hoffset = 0;
> > 273 phys_addr_t fb_addr;
> > 274 u32 fb_offset;
> > 275 u32 gap;
> > 276 
> > 277 if (!logicvc->reserved_mem_base) {
> > 278 drm_err(drm_dev, "No reserved memory base was 
> > registered!\n");
> > 279 return -ENOMEM;
> > 280 }
> > 281 
> > 282 fb_addr = drm_fb_cma_get_gem_addr(fb, state, 0);
> > 283 if (fb_addr < logicvc->reserved_mem_base) {
> > 284 drm_err(drm_dev,
> > 285 "Framebuffer memory below reserved memory 
> > base!\n");
> > 286 return -EINVAL;
> > 287 }
> > 288 
> > 289 fb_offset = (u32) (fb_addr - logicvc->reserved_mem_base);
> > 290 
> > 291 if (fb_offset < base_offset) {
> > 292 drm_err(drm_dev,
> > 293 "Framebuffer offset below layer base 
> > offset!\n");
> > 294 return -EINVAL;
> > 295 }
> > 296 
> > 297 gap = fb_offset - base_offset;
> > 298 
> > 299 /* Use the possible video buffers selection. */
> > 300 if (gap && buffer_offset) {
> > 301 buffer_sel = gap / buffer_offset;
> > 302 if (buffer_sel > LOGICVC_BUFFER_SEL_MAX)
> > 303 buffer_sel = LOGICVC_BUFFER_SEL_MAX;
> > 304 
> > 305 gap -= buffer_sel * buffer_offset;
> > 306 }
> > 307 
> > 308 /* Use the vertical offset. */
> > 309 if (gap && layer_stride && 
> > logicvc->config.layers_configurable) {
> > 310 voffset = gap / layer_stride;
> > 311 if (voffset > LOGICVC_LAYER_VOFFSET_MAX)
> > 312 voffset = LOGICVC_LAYER_VOFFSET_MAX;
> > 313 
> > 314 gap -= voffset * layer_stride;
> > 315 }
> > 316 
> > 317 /* Use the horizontal offset. */
> > 318 if (gap && layer_bytespp && 
> > logicvc->config.layers_configurable) {
> > 319 hoffset = gap / layer_bytespp;
> > 
> > Can "gap / layer_bytespp" ever be more than USHRT_MAX?  Because if so
> > that won't fit into "hoffset"
> 
> Well there is nothing that really restricts the size of the gap, so yes this
> could happen. At this stage the gap should have been reduced already but we
> never really know.
> 
> Would it make sense to add a check that gap / layer_bytespp <= USHRT_MAX
> in that if statement?
> 

My favorite fix would be to declare "hoffset" as a unsigned int.

regards,
dan carpenter



Re: [Intel-gfx] [PATCH] drm/fourcc: Document the Intel CCS modifiers' CC plane expected pitch

2022-06-26 Thread Jordan Justen
On 2022-06-24 14:38:50, Chery, Nanley G wrote:
> +Jordan (FYI)
> 
> I think the commit message has an extra "color" next to "CC". 
> With or without that dropped,
> 
> Reviewed-by: Nanley Chery 

Reviewed-by: Jordan Justen 


Re: [PATCH V2 2/2] drm: xlnx: dsi: Add Xilinx MIPI DSI-Tx subsystem driver

2022-06-26 Thread kernel test robot
Hi Venkateshwar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm/drm-next]
[also build test ERROR on linus/master v5.19-rc3 next-20220624]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/intel-lab-lkp/linux/commits/Venkateshwar-Rao-Gannavarapu/Add-Xilinx-DSI-Tx-subsystem-DRM-driver/20220616-222008
base:   git://anongit.freedesktop.org/drm/drm drm-next
config: mips-randconfig-c004-20220626
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
b0d6dd3905db145853c7c744ac92d49b00b1fa20)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# 
https://github.com/intel-lab-lkp/linux/commit/28aa62ffdc1901029bf75961166f4ebba948b9b7
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Venkateshwar-Rao-Gannavarapu/Add-Xilinx-DSI-Tx-subsystem-DRM-driver/20220616-222008
git checkout 28aa62ffdc1901029bf75961166f4ebba948b9b7
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=mips SHELL=/bin/bash drivers/gpu/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/xlnx/xlnx_dsi.c:255:10: error: label at end of compound 
>> statement: expected statement
   default: /* define */
   ^
;
   1 error generated.


vim +255 drivers/gpu/drm/xlnx/xlnx_dsi.c

   227  
   228  #define MAX_INPUT_SEL_FORMATS   3
   229  static u32
   230  *xlnx_dsi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
   231 struct drm_bridge_state 
*bridge_state,
   232 struct drm_crtc_state 
*crtc_state,
   233 struct drm_connector_state 
*conn_state,
   234 u32 output_fmt,
   235 unsigned int *num_input_fmts)
   236  {
   237  u32 *input_fmts;
   238  unsigned int i = 0;
   239  
   240  *num_input_fmts = 0;
   241  input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, 
sizeof(*input_fmts), GFP_KERNEL);
   242  if (!input_fmts)
   243  return NULL;
   244  
   245  switch (output_fmt) {
   246  case MEDIA_BUS_FMT_FIXED:
   247  input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24;
   248  break;
   249  case MEDIA_BUS_FMT_RGB666_1X18:
   250  input_fmts[i++] = MEDIA_BUS_FMT_RGB666_1X18;
   251  break;
   252  case MEDIA_BUS_FMT_RGB565_1X16:
   253  input_fmts[i++] = MEDIA_BUS_FMT_RGB565_1X16;
   254  break;
 > 255  default: /* define */
   256  }
   257  
   258  *num_input_fmts = i;
   259  if (*num_input_fmts == 0) {
   260  kfree(input_fmts);
   261  input_fmts = NULL;
   262  }
   263  
   264  return input_fmts;
   265  }
   266  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


Re: [PATCH v3 5/6] drm/meson: add DSI encoder

2022-06-26 Thread Martin Blumenstingl
On Fri, Jun 17, 2022 at 9:27 AM Neil Armstrong  wrote:
>
> This adds an encoder bridge designed to drive a MIPI-DSI display
> by using the ENCL encoder through the internal MIPI DSI transceiver
> connected to the output of the ENCL pixel encoder.
>
> Signed-off-by: Neil Armstrong 
> Reviewed-by: Jagan Teki 
Acked-by: Martin Blumenstingl 


Re: [PATCH v3 6/6] drm/meson: add support for MIPI-DSI transceiver

2022-06-26 Thread Martin Blumenstingl
Hi Neil,

On Fri, Jun 17, 2022 at 9:27 AM Neil Armstrong  wrote:
> +/* [31:16] RW intr_stat/clr. Default 0.
> + * For each bit, read as this interrupt level status,
> + * write 1 to clear.
Do you know if an interrupt line from GIC is routed to the MIPI-DSI
transceiver? If so, we should make it mandatory in patch #1 of this
series (dt-bindings patch), even though it's not in use by the driver
at the moment.


Re: [Intel-gfx] [PATCH 2/2] iosys-map: Add per-word write

2022-06-26 Thread Lucas De Marchi

On Fri, Jun 17, 2022 at 01:52:04AM -0700, Lucas De Marchi wrote:

Like was done for read, provide the equivalent for write. Even if
current users are not in the hot path, this should future-proof it.

v2:
 - Remove default from _Generic() - callers wanting to write more
   than u64 should use iosys_map_memcpy_to()
 - Add WRITE_ONCE() cases dereferencing the pointer when using system
   memory


Thomas, do you have any additional concern on this patch regarding your
previous review?

thanks
Lucas De Marchi



Signed-off-by: Lucas De Marchi 
Reviewed-by: Reviewed-by: Christian König  # v1
---
include/linux/iosys-map.h | 42 ++-
1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/include/linux/iosys-map.h b/include/linux/iosys-map.h
index f59dd00ed202..580e14cd360c 100644
--- a/include/linux/iosys-map.h
+++ b/include/linux/iosys-map.h
@@ -337,9 +337,13 @@ static inline void iosys_map_memset(struct iosys_map *dst, 
size_t offset,
#ifdef CONFIG_64BIT
#define __iosys_map_rd_io_u64_case(val_, vaddr_iomem_)  
\
u64: val_ = readq(vaddr_iomem_)
+#define __iosys_map_wr_io_u64_case(val_, vaddr_iomem_) \
+   u64: writeq(val_, vaddr_iomem_)
#else
#define __iosys_map_rd_io_u64_case(val_, vaddr_iomem_)  
\
u64: memcpy_fromio(&(val_), vaddr_iomem__, sizeof(u64))
+#define __iosys_map_wr_io_u64_case(val_, vaddr_iomem_) \
+   u64: memcpy_toio(vaddr_iomem_, &(val_), sizeof(u64))
#endif

#define __iosys_map_rd_io(val__, vaddr_iomem__, type__) _Generic(val__, 
\
@@ -354,6 +358,19 @@ static inline void iosys_map_memset(struct iosys_map *dst, 
size_t offset,
val__ = READ_ONCE(*((type__ *)vaddr__));
\
})

+#define __iosys_map_wr_io(val__, vaddr_iomem__, type__) _Generic(val__,
\
+   u8: writeb(val__, vaddr_iomem__),   
\
+   u16: writew(val__, vaddr_iomem__),  
\
+   u32: writel(val__, vaddr_iomem__),  
\
+   __iosys_map_wr_io_u64_case(val__, vaddr_iomem__))
+
+#define __iosys_map_wr_sys(val__, vaddr__, type__) ({  
\
+   compiletime_assert(sizeof(type__) <= sizeof(u64),\
+  "Unsupported access size for __iosys_map_wr_sys()"); 
\
+   WRITE_ONCE(*((type__ *)vaddr__), val__);
\
+})
+
+
/**
 * iosys_map_rd - Read a C-type value from the iosys_map
 *
@@ -386,12 +403,17 @@ static inline void iosys_map_memset(struct iosys_map 
*dst, size_t offset,
 * @type__: Type of the value being written
 * @val__:  Value to write
 *
- * Write a C-type value to the iosys_map, handling possible un-aligned accesses
- * to the mapping.
+ * Write a C type value (u8, u16, u32 and u64) to the iosys_map. For other 
types
+ * or if pointer may be unaligned (and problematic for the architecture
+ * supported), use iosys_map_memcpy_to()
 */
-#define iosys_map_wr(map__, offset__, type__, val__) ({
\
-   type__ val = (val__);   \
-   iosys_map_memcpy_to(map__, offset__, , sizeof(val));\
+#define iosys_map_wr(map__, offset__, type__, val__) ({
\
+   type__ val = (val__);   
\
+   if ((map__)->is_iomem) { \
+   __iosys_map_wr_io(val, (map__)->vaddr_iomem + (offset__), 
type__);\
+   } else {
\
+   __iosys_map_wr_sys(val, (map__)->vaddr + (offset__), type__);   
 \
+   }   
\
})

/**
@@ -472,10 +494,12 @@ static inline void iosys_map_memset(struct iosys_map 
*dst, size_t offset,
 * @field__:Member of the struct to read
 * @val__:  Value to write
 *
- * Write a value to the iosys_map considering its layout is described by a C 
struct
- * starting at @struct_offset__. The field offset and size is calculated and 
the
- * @val__ is written handling possible un-aligned memory accesses. Refer to
- * iosys_map_rd_field() for expected usage and memory layout.
+ * Write a value to the iosys_map considering its layout is described by a C
+ * struct starting at @struct_offset__. The field offset and size is calculated
+ * and the @val__ is written. If the field access would incur in un-aligned
+ * access, then either iosys_map_memcpy_to() needs to be used or the
+ * architecture must support it. Refer to iosys_map_rd_field() for expected
+ * usage and memory layout.
 */
#define iosys_map_wr_field(map__, struct_offset__, struct_type__, field__, 
val__) ({\
struct_type__ *s;   

Re: [PATCH 1/2] drm/i915: Correct duplicated/misplaced GT register definitions

2022-06-26 Thread Lucas De Marchi

On Fri, Jun 24, 2022 at 02:03:27PM -0700, Matt Roper wrote:

XEHPSDV_FLAT_CCS_BASE_ADDR, GEN8_L3_LRA_1_GPGPU, and MMCD_MISC_CTRL were
duplicated between i915_reg.h and intel_gt_regs.h.  These are all GT
registers, so we should drop the copy from i915_reg.h.

XEHPSDV_TILE0_ADDR_RANGE was defined in i915_reg.h, but really belongs
in intel_gt_regs.h.  Move it.

Signed-off-by: Matt Roper 



Reviewed-by: Lucas De Marchi 

Lucas De Marchi 


---
drivers/gpu/drm/i915/gem/i915_gem_stolen.c |  1 +
drivers/gpu/drm/i915/gt/intel_gt_regs.h|  3 +++
drivers/gpu/drm/i915/i915_reg.h| 17 -
3 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c 
b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
index fa54823d1219..e63de9c06596 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
@@ -14,6 +14,7 @@
#include "gem/i915_gem_region.h"
#include "gt/intel_gt.h"
#include "gt/intel_gt_mcr.h"
+#include "gt/intel_gt_regs.h"
#include "gt/intel_region_lmem.h"
#include "i915_drv.h"
#include "i915_gem_stolen.h"
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h 
b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
index 07ef111947b8..61815b6e87de 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
@@ -324,6 +324,9 @@

#define GEN12_PAT_INDEX(index)  _MMIO(0x4800 + (index) * 4)

+#define XEHPSDV_TILE0_ADDR_RANGE   _MMIO(0x4900)
+#define   XEHPSDV_TILE_LMEM_RANGE_SHIFT8
+
#define XEHPSDV_FLAT_CCS_BASE_ADDR  _MMIO(0x4910)
#define   XEHPSDV_CCS_BASE_SHIFT8

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 932bd6aa4a0a..cf5e16abf6c7 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -8345,23 +8345,6 @@ enum skl_power_gate {
#define   SGGI_DIS  REG_BIT(15)
#define   SGR_DIS   REG_BIT(13)

-#define XEHPSDV_TILE0_ADDR_RANGE   _MMIO(0x4900)
-#define   XEHPSDV_TILE_LMEM_RANGE_SHIFT  8
-
-#define XEHPSDV_FLAT_CCS_BASE_ADDR _MMIO(0x4910)
-#define   XEHPSDV_CCS_BASE_SHIFT   8
-
-/* gamt regs */
-#define GEN8_L3_LRA_1_GPGPU _MMIO(0x4dd4)
-#define   GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_BDW  0x67F1427F /* max/min for 
LRA1/2 */
-#define   GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_CHV  0x5FF101FF /* max/min for 
LRA1/2 */
-#define   GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_SKL  0x67F1427F /*"" */
-#define   GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_BXT  0x5FF101FF /*"" */
-
-#define MMCD_MISC_CTRL _MMIO(0x4ddc) /* skl+ */
-#define  MMCD_PCLA (1 << 31)
-#define  MMCD_HOTSPOT_EN   (1 << 27)
-
#define _ICL_PHY_MISC_A 0x64C00
#define _ICL_PHY_MISC_B 0x64C04
#define _DG2_PHY_MISC_TC1   0x64C14 /* TC1="PHY E" but offset as if "PHY F" 
*/
--
2.36.1



Annoying AMDGPU boot-time warning due to simplefb / amdgpu resource clash

2022-06-26 Thread Linus Torvalds
So this has been going on for a while, and it's quite annoying.

At bootup, my main desktop (Threadripper 3970X with radeon graphics)
now complains about

  resource sanity check: requesting [mem 0xd000-0xdfff], which
spans more than BOOTFB [mem 0xd000-0xd02f]

and then gives me a nasty callchain that is basically the amdgpu probe
sequence ending in amdgpu_bo_init() doing the
arch_io_reserve_memtype_wc() which is then what complains.

That "BOOTFB" resource is from sysfb_simplefb.c, and I think what
started triggering this is commit c96898342c38 ("drivers/firmware:
Don't mark as busy the simple-framebuffer IO resource").

Because it turns out that that removed the IORESOURCE_BUSY, which in
turn is what makes the resource conflict code complain about it now,
because

/*
 * if a resource is "BUSY", it's not a hardware resource
 * but a driver mapping of such a resource; we don't want
 * to warn for those; some drivers legitimately map only
 * partial hardware resources. (example: vesafb)
 */

so the issue is that now the resource code - correctly - says "hey,
you have *two* conflicting driver mappings".

And that commit claims it did it because "which can lead to drivers
requesting the same memory resource to fail", but - once again - the
link in the commit that might actually tell more is just one of those
useless patch submission links again.

So who knows why that commit was actually done, but it's causing annoyance.

If simplefb is actually still using that frame buffer, it's a problem.
If it isn't, then maybe that resource should have been released?

I really think that commit c96898342c38 is buggy. It talks about "let
drivers to request it as busy instead", but then it registers a
resource that isn't actually a proper real resource. It's just a
random incomplete chunk of the actual real thing, so it will still
interfere with resource allocation, and in fact now interferes even
with that "set memtype" because of this valid warning.

 Linus


[PATCH] staging: fbtft: fix alignment should match open parenthesis

2022-06-26 Thread David Reaver
Fix alignment of this line of code with the previous parenthesis, as
suggested by checkpatch.pl:

  $ ./scripts/checkpatch.pl -f drivers/staging/fbtft/fb_tinylcd.c
  CHECK: Alignment should match open parenthesis
  #41: FILE: drivers/staging/fbtft/fb_tinylcd.c:41:
  +   write_reg(par, 0xE0, 0x00, 0x35, 0x33, 0x00, 0x00, 0x00,
  +  0x00, 0x35, 0x33, 0x00, 0x00, 0x00);

Signed-off-by: David Reaver 
---
 drivers/staging/fbtft/fb_tinylcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fb_tinylcd.c 
b/drivers/staging/fbtft/fb_tinylcd.c
index 9469248f2c50..60cda57bcb33 100644
--- a/drivers/staging/fbtft/fb_tinylcd.c
+++ b/drivers/staging/fbtft/fb_tinylcd.c
@@ -38,7 +38,7 @@ static int init_display(struct fbtft_par *par)
write_reg(par, 0xE5, 0x00);
write_reg(par, 0xF0, 0x36, 0xA5, 0x53);
write_reg(par, 0xE0, 0x00, 0x35, 0x33, 0x00, 0x00, 0x00,
-  0x00, 0x35, 0x33, 0x00, 0x00, 0x00);
+ 0x00, 0x35, 0x33, 0x00, 0x00, 0x00);
write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, 0x55);
write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
udelay(250);


Re: [Intel-gfx] [PATCH 2/2] drm/i915: Prefer "XEHP_" prefix for registers

2022-06-26 Thread Caz Yokoyama
Reviewed-by:  Caz Yokoyama 
-caz


On Fri, Jun 24, 2022 at 2:04 PM Matt Roper 
wrote:

> We've been introducing new registers with a mix of "XEHP_"
> (architecture) and "XEHPSDV_" (platform) prefixes.  For consistency,
> let's settle on "XEHP_" as the preferred form.
>
> XEHPSDV_RP_STATE_CAP stays with its current name since that's truly a
> platform-specific register and not something that applies to the Xe_HP
> architecture as a whole.
>
> Signed-off-by: Matt Roper 
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_stolen.c  | 4 ++--
>  drivers/gpu/drm/i915/gt/intel_gt_regs.h | 8 
>  drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 4 ++--
>  drivers/gpu/drm/i915/gt/intel_region_lmem.c | 8 
>  drivers/gpu/drm/i915/i915_reg.h | 6 +++---
>  5 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> index e63de9c06596..166d0a4b9e8c 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> @@ -836,8 +836,8 @@ i915_gem_stolen_lmem_setup(struct drm_i915_private
> *i915, u16 type,
> } else {
> resource_size_t lmem_range;
>
> -   lmem_range = intel_gt_mcr_read_any(>gt0,
> XEHPSDV_TILE0_ADDR_RANGE) & 0x;
> -   lmem_size = lmem_range >> XEHPSDV_TILE_LMEM_RANGE_SHIFT;
> +   lmem_range = intel_gt_mcr_read_any(>gt0,
> XEHP_TILE0_ADDR_RANGE) & 0x;
> +   lmem_size = lmem_range >> XEHP_TILE_LMEM_RANGE_SHIFT;
> lmem_size *= SZ_1G;
> }
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> index 61815b6e87de..37c1095d8603 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> @@ -324,11 +324,11 @@
>
>  #define GEN12_PAT_INDEX(index) _MMIO(0x4800 + (index) * 4)
>
> -#define XEHPSDV_TILE0_ADDR_RANGE   _MMIO(0x4900)
> -#define   XEHPSDV_TILE_LMEM_RANGE_SHIFT8
> +#define XEHP_TILE0_ADDR_RANGE  _MMIO(0x4900)
> +#define   XEHP_TILE_LMEM_RANGE_SHIFT   8
>
> -#define XEHPSDV_FLAT_CCS_BASE_ADDR _MMIO(0x4910)
> -#define   XEHPSDV_CCS_BASE_SHIFT   8
> +#define XEHP_FLAT_CCS_BASE_ADDR_MMIO(0x4910)
> +#define   XEHP_CCS_BASE_SHIFT  8
>
>  #define GAMTARBMODE_MMIO(0x4a08)
>  #define   ARB_MODE_BWGTLB_DISABLE  (1 << 9)
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> index ae8a8f725f01..73a8b46e0234 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> @@ -679,7 +679,7 @@ static ssize_t media_RP0_freq_mhz_show(struct device
> *dev,
> u32 val;
> int err;
>
> -   err = snb_pcode_read_p(gt->uncore, XEHPSDV_PCODE_FREQUENCY_CONFIG,
> +   err = snb_pcode_read_p(gt->uncore, XEHP_PCODE_FREQUENCY_CONFIG,
>PCODE_MBOX_FC_SC_READ_FUSED_P0,
>PCODE_MBOX_DOMAIN_MEDIAFF, );
>
> @@ -700,7 +700,7 @@ static ssize_t media_RPn_freq_mhz_show(struct device
> *dev,
> u32 val;
> int err;
>
> -   err = snb_pcode_read_p(gt->uncore, XEHPSDV_PCODE_FREQUENCY_CONFIG,
> +   err = snb_pcode_read_p(gt->uncore, XEHP_PCODE_FREQUENCY_CONFIG,
>PCODE_MBOX_FC_SC_READ_FUSED_PN,
>PCODE_MBOX_DOMAIN_MEDIAFF, );
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> index 2ff448047020..d09b996a9759 100644
> --- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> +++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> @@ -105,12 +105,12 @@ static struct intel_memory_region *setup_lmem(struct
> intel_gt *gt)
> resource_size_t lmem_range;
> u64 tile_stolen, flat_ccs_base;
>
> -   lmem_range = intel_gt_mcr_read_any(>gt0,
> XEHPSDV_TILE0_ADDR_RANGE) & 0x;
> -   lmem_size = lmem_range >> XEHPSDV_TILE_LMEM_RANGE_SHIFT;
> +   lmem_range = intel_gt_mcr_read_any(>gt0,
> XEHP_TILE0_ADDR_RANGE) & 0x;
> +   lmem_size = lmem_range >> XEHP_TILE_LMEM_RANGE_SHIFT;
> lmem_size *= SZ_1G;
>
> -   flat_ccs_base = intel_gt_mcr_read_any(gt,
> XEHPSDV_FLAT_CCS_BASE_ADDR);
> -   flat_ccs_base = (flat_ccs_base >> XEHPSDV_CCS_BASE_SHIFT)
> * SZ_64K;
> +   flat_ccs_base = intel_gt_mcr_read_any(gt,
> XEHP_FLAT_CCS_BASE_ADDR);
> +   flat_ccs_base = (flat_ccs_base >> XEHP_CCS_BASE_SHIFT) *
> SZ_64K;
>
> /* FIXME: Remove this when we have small-bar enabled */
> if (pci_resource_len(pdev, 2) < lmem_size) {
> diff --git a/drivers/gpu/drm/i915/i915_reg.h
> 

Re: [PATCH] staging: fbtft: fix alignment should match open parenthesis

2022-06-26 Thread David Reaver


Joe Perches  writes:

> On Sat, 2022-06-25 at 19:00 -0700, David Reaver wrote:
>> Fix alignment of this line of code with the previous parenthesis, as
>> suggested by checkpatch.pl:
> []
>> diff --git a/drivers/staging/fbtft/fb_tinylcd.c 
>> b/drivers/staging/fbtft/fb_tinylcd.c
> []
>> @@ -38,7 +38,7 @@ static int init_display(struct fbtft_par *par)
>>  write_reg(par, 0xE5, 0x00);
>>  write_reg(par, 0xF0, 0x36, 0xA5, 0x53);
>>  write_reg(par, 0xE0, 0x00, 0x35, 0x33, 0x00, 0x00, 0x00,
>> -   0x00, 0x35, 0x33, 0x00, 0x00, 0x00);
>> +  0x00, 0x35, 0x33, 0x00, 0x00, 0x00);
>
> It's probably better to ignore the message in this case as the first
> argument means something and the second and subsequent are the data
> being written via a specific macro using NUMARGS.

Thanks for taking a look Joe! That makes sense. I'm new to the kernel
and running checkpath.pl on staging drivers was suggested as a good
place to start contributing, but I'll keep a more careful eye out next
time and not follow checkpath blindly.


Re: [GIT PULL] fbdev updates & fixes for v5.19-rc4

2022-06-26 Thread pr-tracker-bot
The pull request you sent on Sun, 26 Jun 2022 17:01:24 +0200:

> http://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev.git 
> tags/for-5.19/fbdev-2

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/be129fab66f284c239251ec5b6e30c6e903d8881

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html


[PATCH 1/2] drm/exynos: MAINTAINERS: move Joonyoung Shim to credits

2022-06-26 Thread Krzysztof Kozlowski
Emails to Joonyoung Shim bounce ("550 5.1.1 Recipient address rejected:
User unknown"), so move him to credits file.

Signed-off-by: Krzysztof Kozlowski 
---
 CREDITS | 4 
 MAINTAINERS | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CREDITS b/CREDITS
index 7e85a53b6a88..91a564c17012 100644
--- a/CREDITS
+++ b/CREDITS
@@ -3491,6 +3491,10 @@ D: wd33c93 SCSI driver (linux-m68k)
 S: San Jose, California
 S: USA
 
+N: Joonyoung Shim
+E: y0922.s...@samsung.com
+D: Samsung Exynos DRM drivers
+
 N: Robert Siemer
 E: robert.sie...@gmx.de
 P: 2048/C99A4289 2F DC 17 2E 56 62 01 C8  3D F2 AC 09 F2 E5 DD EE
diff --git a/MAINTAINERS b/MAINTAINERS
index 19875f60ebb1..d208bf3b6f11 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6695,7 +6695,6 @@ F:drivers/gpu/drm/bridge/
 
 DRM DRIVERS FOR EXYNOS
 M: Inki Dae 
-M: Joonyoung Shim 
 M: Seung-Woo Kim 
 M: Kyungmin Park 
 L: dri-devel@lists.freedesktop.org
-- 
2.34.1



[PATCH 2/2] dt-bindings: remove Joonyoung Shim from maintainers

2022-06-26 Thread Krzysztof Kozlowski
Emails to Joonyoung Shim bounce ("550 5.1.1 Recipient address rejected:
User unknown"), so remove him from maintainers of DT bindings (display,
phy).

Signed-off-by: Krzysztof Kozlowski 
---
 .../bindings/display/samsung/samsung,exynos-hdmi-ddc.yaml| 1 -
 .../devicetree/bindings/display/samsung/samsung,exynos-hdmi.yaml | 1 -
 .../bindings/display/samsung/samsung,exynos-mixer.yaml   | 1 -
 .../bindings/display/samsung/samsung,exynos5433-decon.yaml   | 1 -
 .../bindings/display/samsung/samsung,exynos5433-mic.yaml | 1 -
 .../bindings/display/samsung/samsung,exynos7-decon.yaml  | 1 -
 .../devicetree/bindings/display/samsung/samsung,fimd.yaml| 1 -
 .../devicetree/bindings/phy/samsung,exynos-hdmi-phy.yaml | 1 -
 8 files changed, 8 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/display/samsung/samsung,exynos-hdmi-ddc.yaml
 
b/Documentation/devicetree/bindings/display/samsung/samsung,exynos-hdmi-ddc.yaml
index 919734c05c0b..458d399cb025 100644
--- 
a/Documentation/devicetree/bindings/display/samsung/samsung,exynos-hdmi-ddc.yaml
+++ 
b/Documentation/devicetree/bindings/display/samsung/samsung,exynos-hdmi-ddc.yaml
@@ -8,7 +8,6 @@ title: Samsung Exynos SoC HDMI DDC
 
 maintainers:
   - Inki Dae 
-  - Joonyoung Shim 
   - Seung-Woo Kim 
   - Kyungmin Park 
   - Krzysztof Kozlowski 
diff --git 
a/Documentation/devicetree/bindings/display/samsung/samsung,exynos-hdmi.yaml 
b/Documentation/devicetree/bindings/display/samsung/samsung,exynos-hdmi.yaml
index 63379fae3636..e4a68c5a1a09 100644
--- a/Documentation/devicetree/bindings/display/samsung/samsung,exynos-hdmi.yaml
+++ b/Documentation/devicetree/bindings/display/samsung/samsung,exynos-hdmi.yaml
@@ -8,7 +8,6 @@ title: Samsung Exynos SoC HDMI
 
 maintainers:
   - Inki Dae 
-  - Joonyoung Shim 
   - Seung-Woo Kim 
   - Kyungmin Park 
   - Krzysztof Kozlowski 
diff --git 
a/Documentation/devicetree/bindings/display/samsung/samsung,exynos-mixer.yaml 
b/Documentation/devicetree/bindings/display/samsung/samsung,exynos-mixer.yaml
index 00e325a19cb1..25d53fde92e1 100644
--- 
a/Documentation/devicetree/bindings/display/samsung/samsung,exynos-mixer.yaml
+++ 
b/Documentation/devicetree/bindings/display/samsung/samsung,exynos-mixer.yaml
@@ -8,7 +8,6 @@ title: Samsung Exynos SoC Mixer
 
 maintainers:
   - Inki Dae 
-  - Joonyoung Shim 
   - Seung-Woo Kim 
   - Kyungmin Park 
   - Krzysztof Kozlowski 
diff --git 
a/Documentation/devicetree/bindings/display/samsung/samsung,exynos5433-decon.yaml
 
b/Documentation/devicetree/bindings/display/samsung/samsung,exynos5433-decon.yaml
index 7c37470bd329..921bfe925cd6 100644
--- 
a/Documentation/devicetree/bindings/display/samsung/samsung,exynos5433-decon.yaml
+++ 
b/Documentation/devicetree/bindings/display/samsung/samsung,exynos5433-decon.yaml
@@ -8,7 +8,6 @@ title: Samsung Exynos5433 SoC Display and Enhancement 
Controller (DECON)
 
 maintainers:
   - Inki Dae 
-  - Joonyoung Shim 
   - Seung-Woo Kim 
   - Kyungmin Park 
   - Krzysztof Kozlowski 
diff --git 
a/Documentation/devicetree/bindings/display/samsung/samsung,exynos5433-mic.yaml 
b/Documentation/devicetree/bindings/display/samsung/samsung,exynos5433-mic.yaml
index c5c6239c28d0..7d405f2febcd 100644
--- 
a/Documentation/devicetree/bindings/display/samsung/samsung,exynos5433-mic.yaml
+++ 
b/Documentation/devicetree/bindings/display/samsung/samsung,exynos5433-mic.yaml
@@ -8,7 +8,6 @@ title: Samsung Exynos5433 SoC Mobile Image Compressor (MIC)
 
 maintainers:
   - Inki Dae 
-  - Joonyoung Shim 
   - Seung-Woo Kim 
   - Kyungmin Park 
   - Krzysztof Kozlowski 
diff --git 
a/Documentation/devicetree/bindings/display/samsung/samsung,exynos7-decon.yaml 
b/Documentation/devicetree/bindings/display/samsung/samsung,exynos7-decon.yaml
index 320eedc61a5b..969bd8c563a5 100644
--- 
a/Documentation/devicetree/bindings/display/samsung/samsung,exynos7-decon.yaml
+++ 
b/Documentation/devicetree/bindings/display/samsung/samsung,exynos7-decon.yaml
@@ -8,7 +8,6 @@ title: Samsung Exynos7 SoC Display and Enhancement Controller 
(DECON)
 
 maintainers:
   - Inki Dae 
-  - Joonyoung Shim 
   - Seung-Woo Kim 
   - Kyungmin Park 
   - Krzysztof Kozlowski 
diff --git 
a/Documentation/devicetree/bindings/display/samsung/samsung,fimd.yaml 
b/Documentation/devicetree/bindings/display/samsung/samsung,fimd.yaml
index c62ea9d22843..5d5cc220f78a 100644
--- a/Documentation/devicetree/bindings/display/samsung/samsung,fimd.yaml
+++ b/Documentation/devicetree/bindings/display/samsung/samsung,fimd.yaml
@@ -8,7 +8,6 @@ title: Samsung S3C/S5P/Exynos SoC Fully Interactive Mobile 
Display (FIMD)
 
 maintainers:
   - Inki Dae 
-  - Joonyoung Shim 
   - Seung-Woo Kim 
   - Kyungmin Park 
   - Krzysztof Kozlowski 
diff --git a/Documentation/devicetree/bindings/phy/samsung,exynos-hdmi-phy.yaml 
b/Documentation/devicetree/bindings/phy/samsung,exynos-hdmi-phy.yaml
index 3e5f035de2e9..efc679c385ab 100644
--- 

[GIT PULL] fbdev updates & fixes for v5.19-rc4

2022-06-26 Thread Helge Deller
The following changes since commit a111daf0c53ae91e71fd2bfe7497862d14132e3e:

  Linux 5.19-rc3 (2022-06-19 15:06:47 -0500)

are available in the Git repository at:

  http://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev.git 
tags/for-5.19/fbdev-2

for you to fetch changes up to cb5177336ecb07fe1c6804306fe8efc827643c64:

  video: fbdev: omap: Remove duplicate 'the' in comment (2022-06-22 16:55:51 
+0200)


fbdev fixes and updates for kernel v5.19-rc4:

Two bug fixes for the pxa3xx and intelfb drivers:
- pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write
- intelfb: Initialize value of stolen size

The other changes are small cleanups, simplifications and documentation
updates to the cirrusfb, skeletonfb, omapfb, intelfb, au1100fb and
simplefb drivers.


Bjorn Helgaas (2):
  video: fbdev: cirrusfb: Remove useless reference to PCI power management
  video: fbdev: skeletonfb: Convert to generic power management

Hyunwoo Kim (1):
  video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write

Jiang Jian (2):
  video: fbdev: omapfb: Align '*' in comment
  video: fbdev: omap: Remove duplicate 'the' in comment

Petr Cvek (2):
  video: fbdev: intelfb: Use aperture size from pci_resource_len
  video: fbdev: intelfb: Initialize value of stolen size

Xiang wangx (1):
  video: fbdev: skeletonfb: Fix syntax errors in comments

Yihao Han (2):
  video: fbdev: au1100fb: Drop unnecessary NULL ptr check
  video: fbdev: simplefb: Check before clk_put() not needed

 drivers/video/fbdev/au1100fb.c  |  6 ++
 drivers/video/fbdev/cirrusfb.c  |  6 --
 drivers/video/fbdev/intelfb/intelfbdrv.c|  4 ++--
 drivers/video/fbdev/intelfb/intelfbhw.c | 12 +---
 drivers/video/fbdev/omap/sossi.c|  2 +-
 drivers/video/fbdev/omap2/omapfb/dss/hdmi_phy.c |  2 +-
 drivers/video/fbdev/pxa3xx-gcu.c|  2 +-
 drivers/video/fbdev/simplefb.c  |  3 +--
 drivers/video/fbdev/skeletonfb.c| 15 ---
 9 files changed, 21 insertions(+), 31 deletions(-)


[PATCH] drm/amd/display: change to_dal_irq_source_dnc32() storage class specifier to static

2022-06-26 Thread Tom Rix
sparse reports
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn32/irq_service_dcn32.c:39:20: 
warning: symbol 'to_dal_irq_source_dcn32' was not declared. Should it be static?

to_dal_irq_source_dnc32() is only referenced in irq_service_dnc32.c, so change 
its
storage class specifier to static.

Fixes: 0efd4374f6b4 ("drm/amd/display: add dcn32 IRQ changes")
Signed-off-by: Tom Rix 
---
 drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c 
b/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c
index 3a213ca2f077..b1012fa1977b 100644
--- a/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c
+++ b/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c
@@ -36,7 +36,7 @@
 
 #define DCN_BASE__INST0_SEG2   0x34C0
 
-enum dc_irq_source to_dal_irq_source_dcn32(
+static enum dc_irq_source to_dal_irq_source_dcn32(
struct irq_service *irq_service,
uint32_t src_id,
uint32_t ext_id)
-- 
2.27.0



[PATCH] drm/amd/display: Remove unused globals FORCE_RATE and FORCE_LANE_COUNT

2022-06-26 Thread Tom Rix
sparse reports
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:3885:6: warning: 
symbol 'FORCE_RATE' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:3886:10: warning: 
symbol 'FORCE_LANE_COUNT' was not declared. Should it be static?

Neither of thse variables is used in dc_link_dp.c.  Reviewing the commit listed 
in
the fixes tag shows neither was used in the original patch.  So remove them.

Fixes: 265280b99822 ("drm/amd/display: add CLKMGR changes for DCN32/321")
Signed-off-by: Tom Rix 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index be1dcb0a2a06..f3421f2bd52e 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -3882,9 +3882,6 @@ static bool decide_mst_link_settings(const struct dc_link 
*link, struct dc_link_
return true;
 }
 
-bool FORCE_RATE = false;
-uint32_t FORCE_LANE_COUNT = 0;
-
 void decide_link_settings(struct dc_stream_state *stream,
struct dc_link_settings *link_setting)
 {
-- 
2.27.0



[Bug 216175] PowerColor Radeon Rx 6400 ITX does not work.

2022-06-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216175

--- Comment #4 from nobutarounos...@gmail.com ---
Created attachment 301280
  --> https://bugzilla.kernel.org/attachment.cgi?id=301280=edit
.config for my kernel build.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

[Bug 216175] PowerColor Radeon Rx 6400 ITX does not work.

2022-06-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216175

--- Comment #3 from nobutarounos...@gmail.com ---
Next, I add the Rx 6400 and change display output via Ryzen 3 PRO 4350G. The
run goes to reboot automatically. The journal is Attachment-B.

Finally, the run after the automatic reboot works. The journal is attachment-C.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

[Bug 216175] PowerColor Radeon Rx 6400 ITX does not work.

2022-06-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216175

nobutarounos...@gmail.com changed:

   What|Removed |Added

 Attachment #301279|attachment-C|Journal: attachment-C
description||

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

[Bug 216175] PowerColor Radeon Rx 6400 ITX does not work.

2022-06-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216175

nobutarounos...@gmail.com changed:

   What|Removed |Added

 Attachment #301278|Attachment-B|Journal: Attachment-B
description||

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

[Bug 216175] PowerColor Radeon Rx 6400 ITX does not work.

2022-06-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216175

nobutarounos...@gmail.com changed:

   What|Removed |Added

 Attachment #301277|Attachment-A|Journal: Attachment-A
description||

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

[Bug 216175] PowerColor Radeon Rx 6400 ITX does not work.

2022-06-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216175

--- Comment #2 from nobutarounos...@gmail.com ---
Created attachment 301279
  --> https://bugzilla.kernel.org/attachment.cgi?id=301279=edit
attachment-C

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

[Bug 216175] PowerColor Radeon Rx 6400 ITX does not work.

2022-06-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216175

--- Comment #1 from nobutarounos...@gmail.com ---
Created attachment 301278
  --> https://bugzilla.kernel.org/attachment.cgi?id=301278=edit
Attachment-B

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

[Bug 216175] New: PowerColor Radeon Rx 6400 ITX does not work.

2022-06-26 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216175

Bug ID: 216175
   Summary: PowerColor Radeon Rx 6400 ITX does not work.
   Product: Drivers
   Version: 2.5
Kernel Version: 5.19-rc3
  Hardware: AMD
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: blocking
  Priority: P1
 Component: Video(DRI - non Intel)
  Assignee: drivers_video-...@kernel-bugs.osdl.org
  Reporter: nobutarounos...@gmail.com
Regression: No

Created attachment 301277
  --> https://bugzilla.kernel.org/attachment.cgi?id=301277=edit
Attachment-A

My PowerColor Radeon Rx 6400 ITX never works. I explain it step by step.


My regular hardware set is here and it surely works well,

CPU: Ryzen 3 PRO 4350G
MB: Asrock A520M-ITX/AC 
BIOS: v1.90
Display output: From Ryzen 3 PRO 4350G via HDMI.

Next, I turn off the power supply and add Radeon RX 6400 and output from RX
6400.
In this time, a mosaic screen is shown. After some seconds, the screen becomes
black out.
Neither CTRL-ALT-DEL nor SysRq keys are work. (Attachment-A is the journal of
this run)

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

[PATCH v6 1/4] fbcon: Disallow setting font bigger than screen size

2022-06-26 Thread Helge Deller
Prevent that users set a font size which is bigger than the physical screen.
It's unlikely this may happen (because screens are usually much larger than the
fonts and each font char is limited to 32x32 pixels), but it may happen on
smaller screens/LCD displays.

Signed-off-by: Helge Deller 
Reviewed-by: Daniel Vetter 
Cc: sta...@vger.kernel.org # v4.14+
---
 drivers/video/fbdev/core/fbcon.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index c4e91715ef00..e162d5e753e5 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2469,6 +2469,11 @@ static int fbcon_set_font(struct vc_data *vc, struct 
console_font *font,
if (charcount != 256 && charcount != 512)
return -EINVAL;

+   /* font bigger than screen resolution ? */
+   if (font->width  > FBCON_SWAP(info->var.rotate, info->var.xres, 
info->var.yres) ||
+   font->height > FBCON_SWAP(info->var.rotate, info->var.yres, 
info->var.xres))
+   return -EINVAL;
+
/* Make sure drawing engine can handle the font */
if (!(info->pixmap.blit_x & (1 << (font->width - 1))) ||
!(info->pixmap.blit_y & (1 << (font->height - 1
--
2.35.3



[PATCH v6 2/4] fbmem: Prevent invalid virtual screen sizes

2022-06-26 Thread Helge Deller
Prevent that drivers or the user sets the virtual screen resolution
smaller than the physical screen resolution.  This is important, because
otherwise we may access memory outside of the graphics memory area.

Signed-off-by: Helge Deller 
Reviewed-by: Daniel Vetter 
Cc: sta...@vger.kernel.org # v5.4+
---
 drivers/video/fbdev/core/fbmem.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index afa2863670f3..5dfa4bbee642 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1006,6 +1006,12 @@ fb_set_var(struct fb_info *info, struct 
fb_var_screeninfo *var)
if (var->xres < 8 || var->yres < 8)
return -EINVAL;

+   /* make sure virtual resolution >= physical resolution */
+   if (var->xres_virtual < var->xres)
+   return -EINVAL;
+   if (var->yres_virtual < var->yres)
+   return -EINVAL;
+
/* Too huge resolution causes multiplication overflow. */
if (check_mul_overflow(var->xres, var->yres, ) ||
check_mul_overflow(var->xres_virtual, var->yres_virtual, ))
--
2.35.3



[PATCH v6 4/4] fbcon: Use fbcon_info_from_console() in fbcon_modechange_possible()

2022-06-26 Thread Helge Deller
Use the fbcon_info_from_console() wrapper which was added to kernel
v5.19 with commit 409d6c95f9c6 ("fbcon: Introduce wrapper for console->fb_info 
lookup").

Signed-off-by: Helge Deller 
Reviewed-by: Daniel Vetter 
---
 drivers/video/fbdev/core/fbcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 69c7261ac334..2ab7515ac842 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2751,7 +2751,7 @@ int fbcon_modechange_possible(struct fb_info *info, 
struct fb_var_screeninfo *va
/* prevent setting a screen size which is smaller than font size */
for (i = first_fb_vc; i <= last_fb_vc; i++) {
vc = vc_cons[i].d;
-   if (!vc || registered_fb[con2fb_map[i]] != info)
+   if (!vc || fbcon_info_from_console(i) != info)
continue;

if (vc->vc_font.width  > FBCON_SWAP(var->rotate, var->xres, 
var->yres) ||
--
2.35.3



[PATCH v6 3/4] fbcon: Prevent that screen size is smaller than font size

2022-06-26 Thread Helge Deller
We need to prevent that users configure a screen size which is smaller than the
currently selected font size. Otherwise rendering chars on the screen will
access memory outside the graphics memory region.

This patch adds a new function fbcon_modechange_possible() which
implements this check and which later may be extended with other checks
if necessary.  The new function is called from the FBIOPUT_VSCREENINFO
ioctl handler in fbmem.c, which will return -EINVAL if userspace asked
for a too small screen size.

Signed-off-by: Helge Deller 
Reviewed-by: Daniel Vetter 
Cc: sta...@vger.kernel.org # v5.4+
---
 drivers/video/fbdev/core/fbcon.c | 27 +++
 drivers/video/fbdev/core/fbmem.c |  4 +++-
 include/linux/fbcon.h|  4 
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index e162d5e753e5..69c7261ac334 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2736,6 +2736,33 @@ void fbcon_update_vcs(struct fb_info *info, bool all)
 }
 EXPORT_SYMBOL(fbcon_update_vcs);

+/* let fbcon check if it supports a new screen resolution */
+int fbcon_modechange_possible(struct fb_info *info, struct fb_var_screeninfo 
*var)
+{
+   struct fbcon_ops *ops = info->fbcon_par;
+   struct vc_data *vc;
+   int i;
+
+   WARN_CONSOLE_UNLOCKED();
+
+   if (!ops || ops->currcon < 0)
+   return -EINVAL;
+
+   /* prevent setting a screen size which is smaller than font size */
+   for (i = first_fb_vc; i <= last_fb_vc; i++) {
+   vc = vc_cons[i].d;
+   if (!vc || registered_fb[con2fb_map[i]] != info)
+   continue;
+
+   if (vc->vc_font.width  > FBCON_SWAP(var->rotate, var->xres, 
var->yres) ||
+   vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, 
var->xres))
+   return -EINVAL;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(fbcon_modechange_possible);
+
 int fbcon_mode_deleted(struct fb_info *info,
   struct fb_videomode *mode)
 {
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 5dfa4bbee642..b6e1d0f2b974 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1112,7 +1112,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned 
int cmd,
return -EFAULT;
console_lock();
lock_fb_info(info);
-   ret = fb_set_var(info, );
+   ret = fbcon_modechange_possible(info, );
+   if (!ret)
+   ret = fb_set_var(info, );
if (!ret)
fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL);
unlock_fb_info(info);
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
index ff5596dd30f8..2382dec6d6ab 100644
--- a/include/linux/fbcon.h
+++ b/include/linux/fbcon.h
@@ -15,6 +15,8 @@ void fbcon_new_modelist(struct fb_info *info);
 void fbcon_get_requirement(struct fb_info *info,
   struct fb_blit_caps *caps);
 void fbcon_fb_blanked(struct fb_info *info, int blank);
+int  fbcon_modechange_possible(struct fb_info *info,
+  struct fb_var_screeninfo *var);
 void fbcon_update_vcs(struct fb_info *info, bool all);
 void fbcon_remap_all(struct fb_info *info);
 int fbcon_set_con2fb_map_ioctl(void __user *argp);
@@ -33,6 +35,8 @@ static inline void fbcon_new_modelist(struct fb_info *info) {}
 static inline void fbcon_get_requirement(struct fb_info *info,
 struct fb_blit_caps *caps) {}
 static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {}
+static inline int  fbcon_modechange_possible(struct fb_info *info,
+   struct fb_var_screeninfo *var) { return 0; }
 static inline void fbcon_update_vcs(struct fb_info *info, bool all) {}
 static inline void fbcon_remap_all(struct fb_info *info) {}
 static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; }
--
2.35.3



[PATCH v6 0/4] fbcon: Fixes for screen resolution changes

2022-06-26 Thread Helge Deller
This series fixes possible out-of-bound memory accesses when users trigger
screen resolutions changes with invalid input parameters, e.g. reconfigures
screen which is smaller than the current font size, or if the virtual screen
size is smaller than the physical screen size.

v6:
- final version
- added all missing: Reviewed-by: Daniel Vetter 

v5:
- swapped patch #2 and #3
- modified patch #3 to use registered_fb[con2fb_map[i]] instead of
  fbcon_info_from_console(). This is necessary that the patch can
  be cleanly pushed back to v5.4
- added cleanup patch #4 to fix up patch #3 again to use 
fbcon_info_from_console()
  for v5.19+

v4:
- merged former patch #2 and #3
- added more Reviewed-by
- new patch #2 needs more testing. Note added to comit message that
  another patch needs to be backport as well.

Helge Deller (4):
  fbcon: Disallow setting font bigger than screen size
  fbmem: Prevent invalid virtual screen sizes
  fbcon: Prevent that screen size is smaller than font size
  fbcon: Use fbcon_info_from_console() in fbcon_modechange_possible()

 drivers/video/fbdev/core/fbcon.c | 32 
 drivers/video/fbdev/core/fbmem.c | 10 +-
 include/linux/fbcon.h|  4 
 3 files changed, 45 insertions(+), 1 deletion(-)

--
2.35.3



Re: [PATCH v5 4/4] fbcon: Use fbcon_info_from_console() in fbcon_modechange_possible()

2022-06-26 Thread Daniel Vetter
On Sun, Jun 26, 2022 at 10:56:15AM +0200, Helge Deller wrote:
> Use the fbcon_info_from_console() wrapper which was added to kernel
> v5.19 with commit 409d6c95f9c6 ("fbcon: Introduce wrapper for 
> console->fb_info lookup").
> 
> Signed-off-by: Helge Deller 

Reviewed-by: Daniel Vetter 

> ---
>  drivers/video/fbdev/core/fbcon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c 
> b/drivers/video/fbdev/core/fbcon.c
> index 69c7261ac334..2ab7515ac842 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -2751,7 +2751,7 @@ int fbcon_modechange_possible(struct fb_info *info, 
> struct fb_var_screeninfo *va
>   /* prevent setting a screen size which is smaller than font size */
>   for (i = first_fb_vc; i <= last_fb_vc; i++) {
>   vc = vc_cons[i].d;
> - if (!vc || registered_fb[con2fb_map[i]] != info)
> + if (!vc || fbcon_info_from_console(i) != info)
>   continue;
> 
>   if (vc->vc_font.width  > FBCON_SWAP(var->rotate, var->xres, 
> var->yres) ||
> --
> 2.35.3
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Re: [PATCH v5 3/4] fbcon: Prevent that screen size is smaller than font size

2022-06-26 Thread Daniel Vetter
On Sun, Jun 26, 2022 at 10:56:14AM +0200, Helge Deller wrote:
> We need to prevent that users configure a screen size which is smaller than 
> the
> currently selected font size. Otherwise rendering chars on the screen will
> access memory outside the graphics memory region.
> 
> This patch adds a new function fbcon_modechange_possible() which
> implements this check and which later may be extended with other checks
> if necessary.  The new function is called from the FBIOPUT_VSCREENINFO
> ioctl handler in fbmem.c, which will return -EINVAL if userspace asked
> for a too small screen size.
> 
> Signed-off-by: Helge Deller 
> Cc: sta...@vger.kernel.org # v5.4+

Reviewed-by: Daniel Vetter 

> ---
>  drivers/video/fbdev/core/fbcon.c | 27 +++
>  drivers/video/fbdev/core/fbmem.c |  4 +++-
>  include/linux/fbcon.h|  4 
>  3 files changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c 
> b/drivers/video/fbdev/core/fbcon.c
> index e162d5e753e5..69c7261ac334 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -2736,6 +2736,33 @@ void fbcon_update_vcs(struct fb_info *info, bool all)
>  }
>  EXPORT_SYMBOL(fbcon_update_vcs);
> 
> +/* let fbcon check if it supports a new screen resolution */
> +int fbcon_modechange_possible(struct fb_info *info, struct fb_var_screeninfo 
> *var)
> +{
> + struct fbcon_ops *ops = info->fbcon_par;
> + struct vc_data *vc;
> + int i;
> +
> + WARN_CONSOLE_UNLOCKED();
> +
> + if (!ops || ops->currcon < 0)
> + return -EINVAL;
> +
> + /* prevent setting a screen size which is smaller than font size */
> + for (i = first_fb_vc; i <= last_fb_vc; i++) {
> + vc = vc_cons[i].d;
> + if (!vc || registered_fb[con2fb_map[i]] != info)
> + continue;
> +
> + if (vc->vc_font.width  > FBCON_SWAP(var->rotate, var->xres, 
> var->yres) ||
> + vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, 
> var->xres))
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(fbcon_modechange_possible);
> +
>  int fbcon_mode_deleted(struct fb_info *info,
>  struct fb_videomode *mode)
>  {
> diff --git a/drivers/video/fbdev/core/fbmem.c 
> b/drivers/video/fbdev/core/fbmem.c
> index 5dfa4bbee642..b6e1d0f2b974 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1112,7 +1112,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned 
> int cmd,
>   return -EFAULT;
>   console_lock();
>   lock_fb_info(info);
> - ret = fb_set_var(info, );
> + ret = fbcon_modechange_possible(info, );
> + if (!ret)
> + ret = fb_set_var(info, );
>   if (!ret)
>   fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL);
>   unlock_fb_info(info);
> diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
> index ff5596dd30f8..2382dec6d6ab 100644
> --- a/include/linux/fbcon.h
> +++ b/include/linux/fbcon.h
> @@ -15,6 +15,8 @@ void fbcon_new_modelist(struct fb_info *info);
>  void fbcon_get_requirement(struct fb_info *info,
>  struct fb_blit_caps *caps);
>  void fbcon_fb_blanked(struct fb_info *info, int blank);
> +int  fbcon_modechange_possible(struct fb_info *info,
> +struct fb_var_screeninfo *var);
>  void fbcon_update_vcs(struct fb_info *info, bool all);
>  void fbcon_remap_all(struct fb_info *info);
>  int fbcon_set_con2fb_map_ioctl(void __user *argp);
> @@ -33,6 +35,8 @@ static inline void fbcon_new_modelist(struct fb_info *info) 
> {}
>  static inline void fbcon_get_requirement(struct fb_info *info,
>struct fb_blit_caps *caps) {}
>  static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {}
> +static inline int  fbcon_modechange_possible(struct fb_info *info,
> + struct fb_var_screeninfo *var) { return 0; }
>  static inline void fbcon_update_vcs(struct fb_info *info, bool all) {}
>  static inline void fbcon_remap_all(struct fb_info *info) {}
>  static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; }
> --
> 2.35.3
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Re: [PATCH v3 3/4] fbmem: Check screen resolution change against font size

2022-06-26 Thread Helge Deller
On 6/26/22 10:49, Daniel Vetter wrote:
> On Sun, Jun 26, 2022 at 01:56:18AM +0200, Helge Deller wrote:
>> On 6/26/22 01:12, Helge Deller wrote:
>>> On 6/26/22 00:37, Daniel Vetter wrote:
 On Sun, Jun 26, 2022 at 12:33:53AM +0200, Daniel Vetter wrote:
> On Sun, Jun 26, 2022 at 12:06:29AM +0200, Helge Deller wrote:
>> Enhance the check in the FBIOPUT_VSCREENINFO ioctl handler to verify if 
>> the
>> user-provided new screen size is bigger than the current font size.
>>
>> Signed-off-by: Helge Deller 
>> Cc: sta...@vger.kernel.org # v5.4+
>
> Please squash with previous patch. You might also want to add a note there
> that on older kernels backporters need to open-code
> fbcon_info_from_console instead, since it only exists since
> 409d6c95f9c6 ("fbcon: Introduce wrapper for console->fb_info lookup")

 Maybe easier would be to include that patch in the backports instead of
 open coding.
>>>
>>> I was afraid that WARN_CONSOLE_UNLOCKED() hadn't been backported.
>>> But it seems it's in v4.19+ (from patch 56e6c104e4f15), so that's ok.
>>>
>>> So, yes, it seems pushing 409d6c95f9c6 backwards is probably best.
>>
>> It would be the best solution, but sadly 409d6c95f9c6 can't easily be 
>> backported.
>> So, probably my other approach (fix up afterwards with extra patch) is
>> the way to go.
>
> Ah right there's some conflicts with the restoration/removal of scroll
> accel.
>
>> What's your thought on this ?
>
> I guess just open code in a separate backport is simplest.

I think my just-sent series is somewhat smarter... use old open-coding
in patch which goes backwards, and then just fix up in v5.19 (where
commit 409d6c95f9c6 was added).

Helge



> -Daniel
>
>>
>> Helge
>>
>>
>>
>>> Will try that approach now.
>>>
>>> Helge
>>>
>>>  I think that's what Greg generally prefers at least, less
 divergence between stable kernels.
 -Daniel

>
> With these two nits: Reviewed-by: Daniel Vetter 
>
>> ---
>>  drivers/video/fbdev/core/fbmem.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/video/fbdev/core/fbmem.c 
>> b/drivers/video/fbdev/core/fbmem.c
>> index afa2863670f3..160389365a36 100644
>> --- a/drivers/video/fbdev/core/fbmem.c
>> +++ b/drivers/video/fbdev/core/fbmem.c
>> @@ -1106,7 +1106,9 @@ static long do_fb_ioctl(struct fb_info *info, 
>> unsigned int cmd,
>>  return -EFAULT;
>>  console_lock();
>>  lock_fb_info(info);
>> -ret = fb_set_var(info, );
>> +ret = fbcon_modechange_possible(info, );
>> +if (!ret)
>> +ret = fb_set_var(info, );
>>  if (!ret)
>>  fbcon_update_vcs(info, var.activate & 
>> FB_ACTIVATE_ALL);
>>  unlock_fb_info(info);
>> --
>> 2.35.3
>>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

>>>
>>
>



Re: [PATCH v4 2/3] fbcon: Prevent that screen size is smaller than font size

2022-06-26 Thread Helge Deller
On 6/26/22 10:50, Daniel Vetter wrote:
> On Sun, Jun 26, 2022 at 01:27:02AM +0200, Helge Deller wrote:
>> We need to prevent that users configure a screen size which is smaller than 
>> the
>> currently selected font size. Otherwise rendering chars on the screen will
>> access memory outside the graphics memory region.
>>
>> This patch adds a new function fbcon_modechange_possible() which
>> implements this check and which later may be extended with other checks
>> if necessary.  The new function is called from the FBIOPUT_VSCREENINFO
>> ioctl handler in fbmem.c, which will return -EINVAL if userspace asked
>> for a too small screen size.
>>
>> This patch depends on commit 409d6c95f9c6 ("fbcon: Introduce wrapper for 
>> console->fb_info lookup"),
>> so it needs to be backported as well.
>>
>> Signed-off-by: Helge Deller 
>> Cc: sta...@vger.kernel.org # v5.4+
>
> Reviewed-by: Daniel Vetter 

Thanks, but sadly pushing commit 409d6c95f9c6 isn't easily possible.
I've just sent a new series v5 which fixes it up..

Helge

>
>> ---
>>  drivers/video/fbdev/core/fbcon.c | 27 +++
>>  drivers/video/fbdev/core/fbmem.c |  4 +++-
>>  include/linux/fbcon.h|  4 
>>  3 files changed, 34 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/video/fbdev/core/fbcon.c 
>> b/drivers/video/fbdev/core/fbcon.c
>> index e162d5e753e5..2ab7515ac842 100644
>> --- a/drivers/video/fbdev/core/fbcon.c
>> +++ b/drivers/video/fbdev/core/fbcon.c
>> @@ -2736,6 +2736,33 @@ void fbcon_update_vcs(struct fb_info *info, bool all)
>>  }
>>  EXPORT_SYMBOL(fbcon_update_vcs);
>>
>> +/* let fbcon check if it supports a new screen resolution */
>> +int fbcon_modechange_possible(struct fb_info *info, struct 
>> fb_var_screeninfo *var)
>> +{
>> +struct fbcon_ops *ops = info->fbcon_par;
>> +struct vc_data *vc;
>> +int i;
>> +
>> +WARN_CONSOLE_UNLOCKED();
>> +
>> +if (!ops || ops->currcon < 0)
>> +return -EINVAL;
>> +
>> +/* prevent setting a screen size which is smaller than font size */
>> +for (i = first_fb_vc; i <= last_fb_vc; i++) {
>> +vc = vc_cons[i].d;
>> +if (!vc || fbcon_info_from_console(i) != info)
>> +continue;
>> +
>> +if (vc->vc_font.width  > FBCON_SWAP(var->rotate, var->xres, 
>> var->yres) ||
>> +vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, 
>> var->xres))
>> +return -EINVAL;
>> +}
>> +
>> +return 0;
>> +}
>> +EXPORT_SYMBOL(fbcon_modechange_possible);
>> +
>>  int fbcon_mode_deleted(struct fb_info *info,
>> struct fb_videomode *mode)
>>  {
>> diff --git a/drivers/video/fbdev/core/fbmem.c 
>> b/drivers/video/fbdev/core/fbmem.c
>> index afa2863670f3..160389365a36 100644
>> --- a/drivers/video/fbdev/core/fbmem.c
>> +++ b/drivers/video/fbdev/core/fbmem.c
>> @@ -1106,7 +1106,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned 
>> int cmd,
>>  return -EFAULT;
>>  console_lock();
>>  lock_fb_info(info);
>> -ret = fb_set_var(info, );
>> +ret = fbcon_modechange_possible(info, );
>> +if (!ret)
>> +ret = fb_set_var(info, );
>>  if (!ret)
>>  fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL);
>>  unlock_fb_info(info);
>> diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
>> index ff5596dd30f8..2382dec6d6ab 100644
>> --- a/include/linux/fbcon.h
>> +++ b/include/linux/fbcon.h
>> @@ -15,6 +15,8 @@ void fbcon_new_modelist(struct fb_info *info);
>>  void fbcon_get_requirement(struct fb_info *info,
>> struct fb_blit_caps *caps);
>>  void fbcon_fb_blanked(struct fb_info *info, int blank);
>> +int  fbcon_modechange_possible(struct fb_info *info,
>> +   struct fb_var_screeninfo *var);
>>  void fbcon_update_vcs(struct fb_info *info, bool all);
>>  void fbcon_remap_all(struct fb_info *info);
>>  int fbcon_set_con2fb_map_ioctl(void __user *argp);
>> @@ -33,6 +35,8 @@ static inline void fbcon_new_modelist(struct fb_info 
>> *info) {}
>>  static inline void fbcon_get_requirement(struct fb_info *info,
>>   struct fb_blit_caps *caps) {}
>>  static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {}
>> +static inline int  fbcon_modechange_possible(struct fb_info *info,
>> +struct fb_var_screeninfo *var) { return 0; }
>>  static inline void fbcon_update_vcs(struct fb_info *info, bool all) {}
>>  static inline void fbcon_remap_all(struct fb_info *info) {}
>>  static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; 
>> }
>> --
>> 2.35.3
>>
>



[PATCH v5 0/4] fbcon: Fixes for screen resolution changes

2022-06-26 Thread Helge Deller
This series fixes possible out-of-bound memory accesses when users trigger
screen resolutions changes with invalid input parameters, e.g. reconfigures
screen which is smaller than the current font size, or if the virtual screen
size is smaller than the physical screen size.

Major change in this version v5 is that since we can't easily push
commit 409d6c95f9c6 ("fbcon: Introduce wrapper for console->fb_info lookup")
downwards, a new patch #4 to clean up the old usage of 
"registered_fb[con2fb_map[i]]"
afterwards has been added.

v5:
- swapped patch #2 and #3
- modified patch #3 to use registered_fb[con2fb_map[i]] instead of
  fbcon_info_from_console(). This is necessary that the patch can
  be cleanly pushed back to v5.4
- added cleanup patch #4 to fix up patch #3 again to use 
fbcon_info_from_console()
  for v5.19+

v4:
- merged former patch #2 and #3
- added more Reviewed-by
- new patch #2 needs more testing. Note added to comit message that
  another patch needs to be backport as well.

Helge Deller (4):
  fbcon: Disallow setting font bigger than screen size
  fbmem: Prevent invalid virtual screen sizes
  fbcon: Prevent that screen size is smaller than font size
  fbcon: Use fbcon_info_from_console() in fbcon_modechange_possible()

 drivers/video/fbdev/core/fbcon.c | 32 
 drivers/video/fbdev/core/fbmem.c | 10 +-
 include/linux/fbcon.h|  4 
 3 files changed, 45 insertions(+), 1 deletion(-)

--
2.35.3



[PATCH v5 2/4] fbmem: Prevent invalid virtual screen sizes

2022-06-26 Thread Helge Deller
Prevent that drivers or the user sets the virtual screen resolution
smaller than the physical screen resolution.  This is important, because
otherwise we may access memory outside of the graphics memory area.

Signed-off-by: Helge Deller 
Reviewed-by: Daniel Vetter 
Cc: sta...@vger.kernel.org # v5.4+
---
 drivers/video/fbdev/core/fbmem.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index afa2863670f3..5dfa4bbee642 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1006,6 +1006,12 @@ fb_set_var(struct fb_info *info, struct 
fb_var_screeninfo *var)
if (var->xres < 8 || var->yres < 8)
return -EINVAL;

+   /* make sure virtual resolution >= physical resolution */
+   if (var->xres_virtual < var->xres)
+   return -EINVAL;
+   if (var->yres_virtual < var->yres)
+   return -EINVAL;
+
/* Too huge resolution causes multiplication overflow. */
if (check_mul_overflow(var->xres, var->yres, ) ||
check_mul_overflow(var->xres_virtual, var->yres_virtual, ))
--
2.35.3



[PATCH v5 4/4] fbcon: Use fbcon_info_from_console() in fbcon_modechange_possible()

2022-06-26 Thread Helge Deller
Use the fbcon_info_from_console() wrapper which was added to kernel
v5.19 with commit 409d6c95f9c6 ("fbcon: Introduce wrapper for console->fb_info 
lookup").

Signed-off-by: Helge Deller 
---
 drivers/video/fbdev/core/fbcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 69c7261ac334..2ab7515ac842 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2751,7 +2751,7 @@ int fbcon_modechange_possible(struct fb_info *info, 
struct fb_var_screeninfo *va
/* prevent setting a screen size which is smaller than font size */
for (i = first_fb_vc; i <= last_fb_vc; i++) {
vc = vc_cons[i].d;
-   if (!vc || registered_fb[con2fb_map[i]] != info)
+   if (!vc || fbcon_info_from_console(i) != info)
continue;

if (vc->vc_font.width  > FBCON_SWAP(var->rotate, var->xres, 
var->yres) ||
--
2.35.3



[PATCH v5 1/4] fbcon: Disallow setting font bigger than screen size

2022-06-26 Thread Helge Deller
Prevent that users set a font size which is bigger than the physical screen.
It's unlikely this may happen (because screens are usually much larger than the
fonts and each font char is limited to 32x32 pixels), but it may happen on
smaller screens/LCD displays.

Signed-off-by: Helge Deller 
Reviewed-by: Daniel Vetter 
Cc: sta...@vger.kernel.org # v4.14+
---
 drivers/video/fbdev/core/fbcon.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index c4e91715ef00..e162d5e753e5 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2469,6 +2469,11 @@ static int fbcon_set_font(struct vc_data *vc, struct 
console_font *font,
if (charcount != 256 && charcount != 512)
return -EINVAL;

+   /* font bigger than screen resolution ? */
+   if (font->width  > FBCON_SWAP(info->var.rotate, info->var.xres, 
info->var.yres) ||
+   font->height > FBCON_SWAP(info->var.rotate, info->var.yres, 
info->var.xres))
+   return -EINVAL;
+
/* Make sure drawing engine can handle the font */
if (!(info->pixmap.blit_x & (1 << (font->width - 1))) ||
!(info->pixmap.blit_y & (1 << (font->height - 1
--
2.35.3



[PATCH v5 3/4] fbcon: Prevent that screen size is smaller than font size

2022-06-26 Thread Helge Deller
We need to prevent that users configure a screen size which is smaller than the
currently selected font size. Otherwise rendering chars on the screen will
access memory outside the graphics memory region.

This patch adds a new function fbcon_modechange_possible() which
implements this check and which later may be extended with other checks
if necessary.  The new function is called from the FBIOPUT_VSCREENINFO
ioctl handler in fbmem.c, which will return -EINVAL if userspace asked
for a too small screen size.

Signed-off-by: Helge Deller 
Cc: sta...@vger.kernel.org # v5.4+
---
 drivers/video/fbdev/core/fbcon.c | 27 +++
 drivers/video/fbdev/core/fbmem.c |  4 +++-
 include/linux/fbcon.h|  4 
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index e162d5e753e5..69c7261ac334 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2736,6 +2736,33 @@ void fbcon_update_vcs(struct fb_info *info, bool all)
 }
 EXPORT_SYMBOL(fbcon_update_vcs);

+/* let fbcon check if it supports a new screen resolution */
+int fbcon_modechange_possible(struct fb_info *info, struct fb_var_screeninfo 
*var)
+{
+   struct fbcon_ops *ops = info->fbcon_par;
+   struct vc_data *vc;
+   int i;
+
+   WARN_CONSOLE_UNLOCKED();
+
+   if (!ops || ops->currcon < 0)
+   return -EINVAL;
+
+   /* prevent setting a screen size which is smaller than font size */
+   for (i = first_fb_vc; i <= last_fb_vc; i++) {
+   vc = vc_cons[i].d;
+   if (!vc || registered_fb[con2fb_map[i]] != info)
+   continue;
+
+   if (vc->vc_font.width  > FBCON_SWAP(var->rotate, var->xres, 
var->yres) ||
+   vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, 
var->xres))
+   return -EINVAL;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(fbcon_modechange_possible);
+
 int fbcon_mode_deleted(struct fb_info *info,
   struct fb_videomode *mode)
 {
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 5dfa4bbee642..b6e1d0f2b974 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1112,7 +1112,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned 
int cmd,
return -EFAULT;
console_lock();
lock_fb_info(info);
-   ret = fb_set_var(info, );
+   ret = fbcon_modechange_possible(info, );
+   if (!ret)
+   ret = fb_set_var(info, );
if (!ret)
fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL);
unlock_fb_info(info);
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
index ff5596dd30f8..2382dec6d6ab 100644
--- a/include/linux/fbcon.h
+++ b/include/linux/fbcon.h
@@ -15,6 +15,8 @@ void fbcon_new_modelist(struct fb_info *info);
 void fbcon_get_requirement(struct fb_info *info,
   struct fb_blit_caps *caps);
 void fbcon_fb_blanked(struct fb_info *info, int blank);
+int  fbcon_modechange_possible(struct fb_info *info,
+  struct fb_var_screeninfo *var);
 void fbcon_update_vcs(struct fb_info *info, bool all);
 void fbcon_remap_all(struct fb_info *info);
 int fbcon_set_con2fb_map_ioctl(void __user *argp);
@@ -33,6 +35,8 @@ static inline void fbcon_new_modelist(struct fb_info *info) {}
 static inline void fbcon_get_requirement(struct fb_info *info,
 struct fb_blit_caps *caps) {}
 static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {}
+static inline int  fbcon_modechange_possible(struct fb_info *info,
+   struct fb_var_screeninfo *var) { return 0; }
 static inline void fbcon_update_vcs(struct fb_info *info, bool all) {}
 static inline void fbcon_remap_all(struct fb_info *info) {}
 static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; }
--
2.35.3



Re: [PATCH v4 2/3] fbcon: Prevent that screen size is smaller than font size

2022-06-26 Thread Daniel Vetter
On Sun, Jun 26, 2022 at 01:27:02AM +0200, Helge Deller wrote:
> We need to prevent that users configure a screen size which is smaller than 
> the
> currently selected font size. Otherwise rendering chars on the screen will
> access memory outside the graphics memory region.
> 
> This patch adds a new function fbcon_modechange_possible() which
> implements this check and which later may be extended with other checks
> if necessary.  The new function is called from the FBIOPUT_VSCREENINFO
> ioctl handler in fbmem.c, which will return -EINVAL if userspace asked
> for a too small screen size.
> 
> This patch depends on commit 409d6c95f9c6 ("fbcon: Introduce wrapper for 
> console->fb_info lookup"),
> so it needs to be backported as well.
> 
> Signed-off-by: Helge Deller 
> Cc: sta...@vger.kernel.org # v5.4+

Reviewed-by: Daniel Vetter 

> ---
>  drivers/video/fbdev/core/fbcon.c | 27 +++
>  drivers/video/fbdev/core/fbmem.c |  4 +++-
>  include/linux/fbcon.h|  4 
>  3 files changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c 
> b/drivers/video/fbdev/core/fbcon.c
> index e162d5e753e5..2ab7515ac842 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -2736,6 +2736,33 @@ void fbcon_update_vcs(struct fb_info *info, bool all)
>  }
>  EXPORT_SYMBOL(fbcon_update_vcs);
> 
> +/* let fbcon check if it supports a new screen resolution */
> +int fbcon_modechange_possible(struct fb_info *info, struct fb_var_screeninfo 
> *var)
> +{
> + struct fbcon_ops *ops = info->fbcon_par;
> + struct vc_data *vc;
> + int i;
> +
> + WARN_CONSOLE_UNLOCKED();
> +
> + if (!ops || ops->currcon < 0)
> + return -EINVAL;
> +
> + /* prevent setting a screen size which is smaller than font size */
> + for (i = first_fb_vc; i <= last_fb_vc; i++) {
> + vc = vc_cons[i].d;
> + if (!vc || fbcon_info_from_console(i) != info)
> + continue;
> +
> + if (vc->vc_font.width  > FBCON_SWAP(var->rotate, var->xres, 
> var->yres) ||
> + vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, 
> var->xres))
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(fbcon_modechange_possible);
> +
>  int fbcon_mode_deleted(struct fb_info *info,
>  struct fb_videomode *mode)
>  {
> diff --git a/drivers/video/fbdev/core/fbmem.c 
> b/drivers/video/fbdev/core/fbmem.c
> index afa2863670f3..160389365a36 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1106,7 +1106,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned 
> int cmd,
>   return -EFAULT;
>   console_lock();
>   lock_fb_info(info);
> - ret = fb_set_var(info, );
> + ret = fbcon_modechange_possible(info, );
> + if (!ret)
> + ret = fb_set_var(info, );
>   if (!ret)
>   fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL);
>   unlock_fb_info(info);
> diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
> index ff5596dd30f8..2382dec6d6ab 100644
> --- a/include/linux/fbcon.h
> +++ b/include/linux/fbcon.h
> @@ -15,6 +15,8 @@ void fbcon_new_modelist(struct fb_info *info);
>  void fbcon_get_requirement(struct fb_info *info,
>  struct fb_blit_caps *caps);
>  void fbcon_fb_blanked(struct fb_info *info, int blank);
> +int  fbcon_modechange_possible(struct fb_info *info,
> +struct fb_var_screeninfo *var);
>  void fbcon_update_vcs(struct fb_info *info, bool all);
>  void fbcon_remap_all(struct fb_info *info);
>  int fbcon_set_con2fb_map_ioctl(void __user *argp);
> @@ -33,6 +35,8 @@ static inline void fbcon_new_modelist(struct fb_info *info) 
> {}
>  static inline void fbcon_get_requirement(struct fb_info *info,
>struct fb_blit_caps *caps) {}
>  static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {}
> +static inline int  fbcon_modechange_possible(struct fb_info *info,
> + struct fb_var_screeninfo *var) { return 0; }
>  static inline void fbcon_update_vcs(struct fb_info *info, bool all) {}
>  static inline void fbcon_remap_all(struct fb_info *info) {}
>  static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; }
> --
> 2.35.3
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Re: [PATCH v3 3/4] fbmem: Check screen resolution change against font size

2022-06-26 Thread Daniel Vetter
On Sun, Jun 26, 2022 at 01:56:18AM +0200, Helge Deller wrote:
> On 6/26/22 01:12, Helge Deller wrote:
> > On 6/26/22 00:37, Daniel Vetter wrote:
> >> On Sun, Jun 26, 2022 at 12:33:53AM +0200, Daniel Vetter wrote:
> >>> On Sun, Jun 26, 2022 at 12:06:29AM +0200, Helge Deller wrote:
>  Enhance the check in the FBIOPUT_VSCREENINFO ioctl handler to verify if 
>  the
>  user-provided new screen size is bigger than the current font size.
> 
>  Signed-off-by: Helge Deller 
>  Cc: sta...@vger.kernel.org # v5.4+
> >>>
> >>> Please squash with previous patch. You might also want to add a note there
> >>> that on older kernels backporters need to open-code
> >>> fbcon_info_from_console instead, since it only exists since
> >>> 409d6c95f9c6 ("fbcon: Introduce wrapper for console->fb_info lookup")
> >>
> >> Maybe easier would be to include that patch in the backports instead of
> >> open coding.
> >
> > I was afraid that WARN_CONSOLE_UNLOCKED() hadn't been backported.
> > But it seems it's in v4.19+ (from patch 56e6c104e4f15), so that's ok.
> >
> > So, yes, it seems pushing 409d6c95f9c6 backwards is probably best.
> 
> It would be the best solution, but sadly 409d6c95f9c6 can't easily be 
> backported.
> So, probably my other approach (fix up afterwards with extra patch) is
> the way to go.

Ah right there's some conflicts with the restoration/removal of scroll
accel.

> What's your thought on this ?

I guess just open code in a separate backport is simplest.
-Daniel

> 
> Helge
> 
> 
> 
> > Will try that approach now.
> >
> > Helge
> >
> >  I think that's what Greg generally prefers at least, less
> >> divergence between stable kernels.
> >> -Daniel
> >>
> >>>
> >>> With these two nits: Reviewed-by: Daniel Vetter 
> >>>
>  ---
>   drivers/video/fbdev/core/fbmem.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
>  diff --git a/drivers/video/fbdev/core/fbmem.c 
>  b/drivers/video/fbdev/core/fbmem.c
>  index afa2863670f3..160389365a36 100644
>  --- a/drivers/video/fbdev/core/fbmem.c
>  +++ b/drivers/video/fbdev/core/fbmem.c
>  @@ -1106,7 +1106,9 @@ static long do_fb_ioctl(struct fb_info *info, 
>  unsigned int cmd,
>   return -EFAULT;
>   console_lock();
>   lock_fb_info(info);
>  -ret = fb_set_var(info, );
>  +ret = fbcon_modechange_possible(info, );
>  +if (!ret)
>  +ret = fb_set_var(info, );
>   if (!ret)
>   fbcon_update_vcs(info, var.activate & 
>  FB_ACTIVATE_ALL);
>   unlock_fb_info(info);
>  --
>  2.35.3
> 
> >>>
> >>> --
> >>> Daniel Vetter
> >>> Software Engineer, Intel Corporation
> >>> http://blog.ffwll.ch
> >>
> >
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Re: [PATCH 0/1] Delete VIA DRM

2022-06-26 Thread Sam Ravnborg
Hi Kevin,

On Sat, Jun 25, 2022 at 09:56:40PM -0500, Kevin Brace wrote:
> From: Kevin Brace 
> 
> This patch is a supplemental patch to delete VIA DRM so that the proposed
> OpenChrome DRM module can be compiled against drm-next-2022-06-03-1 tag of
> drm-next branch.
> Apply this patch first before applying the rest of OpenChrome DRM patches.
This almost works - you need to delete include/uapi/drm_via_drm.h too.

For your v1 this is fine, but when you submit v2 it is not OK to just
delete all files and then add new files on top.
We want to see the diff between the original files and the new files.
Even though this is almost a rewrite we need to verify that copyrights
are kept for example.

As an example via_drm.h generates the nice diff below which is exactly
what we want to see for reviewing purposes.

As your patches will break the build, just modify drm/Makefile in your
very first patch to drop the driver, and in the last patch you can update
drm/Makefile to include the driver in the build again.
In this way you do not break the build and the bots can give you build
coverage you cannot do yourself.

I look forward to see v2 of the patch-set.

Sam



diff --git a/include/uapi/drm/via_drm.h b/include/uapi/drm/via_drm.h
index a1e125d42208..e9da45ce130a 100644
--- a/include/uapi/drm/via_drm.h
+++ b/include/uapi/drm/via_drm.h
@@ -1,4 +1,5 @@
 /*
+ * Copyright © 2020 Kevin Brace
  * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
  * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
  *
@@ -16,10 +17,10 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS, COPYRIGHT HOLDERS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+ * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #ifndef _VIA_DRM_H_
 #define _VIA_DRM_H_
@@ -81,6 +82,11 @@ extern "C" {
 #define DRM_VIA_DMA_BLIT0x0e
 #define DRM_VIA_BLIT_SYNC   0x0f
 
+#defineDRM_VIA_GEM_CREATE  0x10
+#defineDRM_VIA_GEM_MAP 0x11
+#defineDRM_VIA_GEM_UNMAP   0x12
+
+
 #define DRM_IOCTL_VIA_ALLOCMEM   DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, 
drm_via_mem_t)
 #define DRM_IOCTL_VIA_FREEMEMDRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, 
drm_via_mem_t)
 #define DRM_IOCTL_VIA_AGP_INIT   DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, 
drm_via_agp_t)
@@ -97,6 +103,10 @@ extern "C" {
 #define DRM_IOCTL_VIA_DMA_BLITDRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, 
drm_via_dmablit_t)
 #define DRM_IOCTL_VIA_BLIT_SYNC   DRM_IOW(DRM_COMMAND_BASE + 
DRM_VIA_BLIT_SYNC, drm_via_blitsync_t)
 
+#defineDRM_IOCTL_VIA_GEM_CREATEDRM_IOWR(DRM_COMMAND_BASE + 
DRM_VIA_GEM_CREATE, struct drm_via_gem_create)
+#defineDRM_IOCTL_VIA_GEM_MAP   DRM_IOWR(DRM_COMMAND_BASE + 
DRM_VIA_GEM_MAP, struct drm_via_gem_map)
+#defineDRM_IOCTL_VIA_GEM_UNMAP DRM_IOR(DRM_COMMAND_BASE + 
DRM_VIA_GEM_UNMAP, struct drm_via_gem_unmap)
+
 /* Indices into buf.Setup where various bits of state are mirrored per
  * context and per buffer.  These can be fired at the card as a unit,
  * or in a piecewise fashion as required.
@@ -275,6 +285,23 @@ typedef struct drm_via_dmablit {
drm_via_blitsync_t sync;
 } drm_via_dmablit_t;
 
+struct drm_via_gem_create {
+   uint64_t size;
+   uint32_t alignment;
+   uint32_t domain;
+   uint32_t handle;
+   uint64_t offset;
+};
+
+struct drm_via_gem_map {
+   uint32_t handle;
+   uint64_t map_offset;
+};
+
+struct drm_via_gem_unmap {
+   uint32_t handle;
+};
+
 #if defined(__cplusplus)
 }
 #endif