Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp645210lqb; Fri, 15 Mar 2024 02:16:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWdOhbBpyhMkm6+EW/qCBxLZSLT+IAdT3bxhmrkmmE9KiwQuY5lhREZyJfBEEkJNhG39am4pq5Ry2SyKEQ/BB7hN8in7vY29tBnpAf/fA== X-Google-Smtp-Source: AGHT+IGodg1IuKnnR4BhgNEpfoyuhosb3ffSekMfrS3e2PuSX2N3dMbZORnrudPizOJoYrukpgFK X-Received: by 2002:a05:620a:29c3:b0:788:6cc4:a0d3 with SMTP id s3-20020a05620a29c300b007886cc4a0d3mr5328031qkp.56.1710494195729; Fri, 15 Mar 2024 02:16:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710494195; cv=pass; d=google.com; s=arc-20160816; b=B9vQnMc/m8Wly8QvEclruheClwICH5n07JPeT88rjAcdZYXLEvfvqXayu3jVuhLeRy cj65nEcNk8kmg3YYlxduTwnWq8D9ZYnNJIlfK7R726qmEPby9vxBiKyF+/g90TNSzIR/ 3Kvjxeh+eOFlz7otuvHT4VaLRvkJLrmZCrHEwjN8+IRQHOD6oRpSUtGxpiWY0iH/ciwQ uOIKHmH/b3T2OF5dAmwE6uOzx3gb1Bro+71d0SEhjMjMrM/y60Im8CzidvD2CuSAK3Ny 1jOcxmHJuJxgiYsdwWQ4DlaPY1hTx6Aw+VYKol12fwYKKVYiskz53lGKQFZwr1/2Ccoc rufQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=hYLXNRNt81ZtoyMN6O1zonkQ13t8/7kmK8R+aKE4kgU=; fh=oI7cANUQf8P4o8lS7zowrhAE02ejTcb7GEo7Ix45erg=; b=AFO0HXJof9PAmgGDAVbrf+0jkH/GxPCz5MJOaOUqnABAJCAx1I2KXXVScJWH7V4L0x 3jeibfwMaRlePoTHCbBKKqcoBNb8cK4HcvTK1mSZDVgfwFHcwPVvrJph7WGTTz57ywrJ jbE+JN0/20umNt8oB94n6bqyen/b0VOEUN+y646kmGuWwWUJ3jIos9cI0Vikixzzp9lj 8T65fGtfSA64i/P3FAZVBXMZF7DOmUyodlppauTI2iaL+ujM76jyHJ7hMFa0Fzph5gtC rcnKdgUlp5X5E1RtYw6KQNb25dnutfh2zkj/FnrA/4TpY5S/wIeNWPDewBwss9GUmRTi 88Bg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=Ucg22uyj; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-104194-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104194-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x27-20020a05620a14bb00b00789d71afdedsi2713638qkj.785.2024.03.15.02.16.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 02:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104194-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=Ucg22uyj; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-104194-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104194-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 636811C212A4 for ; Fri, 15 Mar 2024 09:16:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E990017BA6; Fri, 15 Mar 2024 09:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=deller@gmx.de header.b="Ucg22uyj" Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 331431798A; Fri, 15 Mar 2024 09:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710494187; cv=none; b=DnxNZq8yrPPJCvgYQDSl+BFhVGTnYUejvJQ1Hio542bVoC4Y9l4fz6IEdrPtGih4x1uBvb1FWwmHoJMim7un/qcUUyPQ7GujKX9tMkrzjmAAGWCwLRHkVCRVIIJIUQqZv8AsDBknnsENWgofgtYwI7l+bwXbqhkK62nMPEf8o0c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710494187; c=relaxed/simple; bh=sVh221sKCY6dxs59B7y5VJOAx7gsVUi2AyYV7Mo9e2g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dwrVN0rFOawnv7Evh8iXNUANcR7tqNXH1Gb/WMwC5x9kRqNyWpJF9KiHt6qOGmV3kRqT3NENe7gmVtMzZPBFbHplcpuCZrHM7zXU5Ep/xAhjXg0GcqVcZ3IRiJtZzv6hE2D0xtpBj1vZnyaJtkBi1OM3+PJBP8eop4TFu9eZ6WU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=deller@gmx.de header.b=Ucg22uyj; arc=none smtp.client-ip=212.227.17.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1710494178; x=1711098978; i=deller@gmx.de; bh=hYLXNRNt81ZtoyMN6O1zonkQ13t8/7kmK8R+aKE4kgU=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=Ucg22uyj8iuv/cDVowkXvUXM10tDk5guuVRCm9CVXYMtR9BzQV9VV3tRu5z5QnpY lNpYStsDC85wxrxgh4UuSrLoKW5Jed/lVkr5Qh1hoZpmduf8wv8MJOmFzwzYN3Jr9 8YzCySw+ToFwVFmUGiju8ZYPSab7/YdiPPBvYAMsPzE2ghn8YBqnSkAm7gxz6jn9w eDHRxyVRYCQS/GiNVqCdTwTCAPRWv6zy1yyK5N+KKwiJ604mkbcOXvEyPfLzh35Rn gB6ygfz/h6LrYsWGQ+cLIYzDhZsEuhnfBbQBkyTMfy2QYkMOn/DqbCRFVVI7+W4qE 8xKPHA3JSq/Yu781XQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.20.55] ([94.134.155.107]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1ML9uU-1rU51E1V7S-00ICSh; Fri, 15 Mar 2024 10:16:18 +0100 Message-ID: Date: Fri, 15 Mar 2024 10:16:18 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/2] VT: Allow to get max font width and height Content-Language: en-US To: legion@kernel.org, Greg Kroah-Hartman , Jiri Slaby Cc: LKML , kbd@lists.linux.dev, linux-api@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-serial@vger.kernel.org References: <78fcb9ad77b88edee8768806ce6a4d23f6d33118.1710252966.git.legion@kernel.org> From: Helge Deller Autocrypt: addr=deller@gmx.de; keydata= xsFNBF3Ia3MBEAD3nmWzMgQByYAWnb9cNqspnkb2GLVKzhoH2QD4eRpyDLA/3smlClbeKkWT HLnjgkbPFDmcmCz5V0Wv1mKYRClAHPCIBIJgyICqqUZo2qGmKstUx3pFAiztlXBANpRECgwJ r+8w6mkccOM9GhoPU0vMaD/UVJcJQzvrxVHO8EHS36aUkjKd6cOpdVbCt3qx8cEhCmaFEO6u CL+k5AZQoABbFQEBocZE1/lSYzaHkcHrjn4cQjc3CffXnUVYwlo8EYOtAHgMDC39s9a7S90L 69l6G73lYBD/Br5lnDPlG6dKfGFZZpQ1h8/x+Qz366Ojfq9MuuRJg7ZQpe6foiOtqwKym/zV dVvSdOOc5sHSpfwu5+BVAAyBd6hw4NddlAQUjHSRs3zJ9OfrEx2d3mIfXZ7+pMhZ7qX0Axlq Lq+B5cfLpzkPAgKn11tfXFxP+hcPHIts0bnDz4EEp+HraW+oRCH2m57Y9zhcJTOJaLw4YpTY GRUlF076vZ2Hz/xMEvIJddRGId7UXZgH9a32NDf+BUjWEZvFt1wFSW1r7zb7oGCwZMy2LI/G aHQv/N0NeFMd28z+deyxd0k1CGefHJuJcOJDVtcE1rGQ43aDhWS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ZZKST7yTVa5P89JymGE8CBGdQaAXnqYK3/yWf FwRDcGV6nxanxZGKEkSHHOm8jHwvQWvPP73pvuPBEPtKGLzbgd7OOcGZWtq2hNC6cRtsRdDx 4TAGMCz4j238m+2mdbdhRh3iBnWT5yPFfnv/2IjFAk+sdix1Mrr+LIDF++kiekeq0yUpDdc4 ExBy2xf6dd+tuFFBp3/VDN4U0UfG4QJ2fg19zE5Z8dS4jGIbLg== In-Reply-To: <78fcb9ad77b88edee8768806ce6a4d23f6d33118.1710252966.git.legion@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:1Fz/iIrPY0EpPDzAgv+9YcYDyuPh/pzFhEy2tfwLDbQQt7AnPUQ QqOTMT23C5mCjI3Cl14Gum0UqTeu1Jd+JaobIh6XPjqV6UnJCxDdNrNYT1MfFf3r/U7HSW1 3IGGr4DuTVynY1Lruvp8dT1J36HrDlhpFK3T44OQGl9FWT0bioIQg2LRfjHGrYIT1Yzh0/I OAQuZ/X5ZZ9JBfUdNvt4A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:LjGbrVmHslk=;NTUBkXlAJNIoZVNxfVB5L5Agd0X e7waE7PH3wFR/Uv30Y9NVS1FLeTMEGitHyTt2nzPHxDo84tyFsNLTRijRwC0Sph5IkSpcJuKX LpSqpNEbDRdHmytT/0v8HaeiN6b1hEDIgpcKP0xkWIUUcp7T5RSyWZgMApLlfz+HORIud7BH/ zug9clYum/7sDa41zv9fthkYoHIKW9bmzFyJRsn7Z9Qcbuazl3QLSnpdQxTkbi2lOYs5skyAI N/z2zuDqaY/5L8+OjPL1YSN8eqVb0LWSyDkGDqkPjHYEOgAxo+MLUK9qFzd8sXguCM53Mo5Nq 7luiib886lw2S5SiKR2Wtb0Jp/T2kcatO2fzxQUv32wZ8Jkf2D9X9I/Zs02mxscRQYTyVx+at GI0ezoaqwtxmnH73OZkVu//O7eM7W2Su3sgze/ARYV1CsI+/rIaoQI47uRwHJma1eaJCugX+c azD5UYrII3qX2p5VGhQoJ+hkvtA7zy6r2fX5Df70B4YkpWz37lfZlWBZMyyCN8H4UWjrj1bDr nEafIl9rG03PAnmmNTAwzer1+67mAQGQa0zYnxxBBwa927nB/poY1sH9hNGuxiDqtNf9pAzRA wj98D+e1K4N+NgEBxDM+OwXhu7lwdkHsSeBMxBXXa4u0ThHlAAE9nCAvfKYElmRNU0f3LLdOL nVmbPGv0B0Ly0Pip1jvRJmrgpWylXP00sRSm0ZArTBIY5i/anc5YUnae791CjdNPUTNHWpcgn frTsqNbpOzUZKObmKeFYvetauZpl7DVekvQvYQSNwPe+KheGibb05K7LIle6sLbDLHUkqaScW 7xuRaYmuWjIBF3BFpAEnAyrz8PxRqpV7ciy9MIYRQm4Bc= On 3/12/24 15:23, legion@kernel.org wrote: > From: Alexey Gladkov > > The Console drivers has more restrictive font size limits than vt_ioctl. > This leads to errors that are difficult to handle. If a font whose size > is not supported is used, an EINVAL error will be returned, which is > also returned in case of errors in the font itself. At the moment there > is no way to understand what font sizes the current console driver > supports. > > To solve this problem, we need to transfer information about the > supported font to userspace from the console driver. > > Signed-off-by: Alexey Gladkov Acked-by: Helge Deller Helge > --- > drivers/video/console/newport_con.c | 21 +++++++++++++++++---- > drivers/video/console/sticon.c | 25 +++++++++++++++++++++++-- > drivers/video/console/vgacon.c | 21 ++++++++++++++++++++- > drivers/video/fbdev/core/fbcon.c | 22 +++++++++++++++++++++- > 4 files changed, 81 insertions(+), 8 deletions(-) > > diff --git a/drivers/video/console/newport_con.c b/drivers/video/console= /newport_con.c > index e8e4f82cd4a1..87f174a95fa8 100644 > --- a/drivers/video/console/newport_con.c > +++ b/drivers/video/console/newport_con.c > @@ -33,6 +33,9 @@ > > #define NEWPORT_LEN 0x10000 > > +#define NEWPORT_MAX_FONT_WIDTH 8 > +#define NEWPORT_MAX_FONT_HEIGHT 16 > + > #define FONT_DATA ((unsigned char *)font_vga_8x16.data) > > static unsigned char *font_data[MAX_NR_CONSOLES]; > @@ -328,8 +331,8 @@ static void newport_init(struct vc_data *vc, int ini= t) > { > int cols, rows; > > - cols =3D newport_xsize / 8; > - rows =3D newport_ysize / 16; > + cols =3D newport_xsize / NEWPORT_MAX_FONT_WIDTH; > + rows =3D newport_ysize / NEWPORT_MAX_FONT_HEIGHT; > vc->vc_can_do_color =3D 1; > if (init) { > vc->vc_cols =3D cols; > @@ -507,8 +510,8 @@ static int newport_set_font(int unit, struct console= _font *op, unsigned int vpit > > /* ladis: when I grow up, there will be a day... and more sizes will > * be supported ;-) */ > - if ((w !=3D 8) || (h !=3D 16) || (vpitch !=3D 32) > - || (op->charcount !=3D 256 && op->charcount !=3D 512)) > + if ((w !=3D NEWPORT_MAX_FONT_WIDTH) || (h !=3D NEWPORT_MAX_FONT_HEIGHT= ) || > + (vpitch !=3D 32) || (op->charcount !=3D 256 && op->charcount !=3D = 512)) > return -EINVAL; > > if (!(new_data =3D kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, > @@ -569,6 +572,15 @@ static int newport_font_default(struct vc_data *vc,= struct console_font *op, cha > return newport_set_def_font(vc->vc_num, op); > } > > +static int newport_font_info(struct vc_data *vc, struct console_font_in= fo *info) > +{ > + info->min_width =3D info->max_width =3D NEWPORT_MAX_FONT_WIDTH; > + info->min_height =3D info->max_height =3D NEWPORT_MAX_FONT_HEIGHT; > + info->flags =3D KD_FONT_INFO_FLAG_LOW_SIZE | KD_FONT_INFO_FLAG_HIGH_SI= ZE; > + > + return 0; > +} > + > static int newport_font_set(struct vc_data *vc, struct console_font *f= ont, > unsigned int vpitch, unsigned int flags) > { > @@ -688,6 +700,7 @@ const struct consw newport_con =3D { > .con_scroll =3D newport_scroll, > .con_switch =3D newport_switch, > .con_blank =3D newport_blank, > + .con_font_info =3D newport_font_info, > .con_font_set =3D newport_font_set, > .con_font_default =3D newport_font_default, > .con_save_screen =3D newport_save_screen > diff --git a/drivers/video/console/sticon.c b/drivers/video/console/stic= on.c > index 992a4fa431aa..d32ca458eb77 100644 > --- a/drivers/video/console/sticon.c > +++ b/drivers/video/console/sticon.c > @@ -56,6 +56,11 @@ > #define BLANK 0 > static int vga_is_gfx; > > +#define STICON_MIN_FONT_WIDTH 6 > +#define STICON_MIN_FONT_HEIGHT 6 > +#define STICON_MAX_FONT_WIDTH 32 > +#define STICON_MAX_FONT_HEIGHT 32 > + > #define STI_DEF_FONT sticon_sti->font > > /* borrowed from fbcon.c */ > @@ -180,8 +185,10 @@ static int sticon_set_font(struct vc_data *vc, stru= ct console_font *op, > struct sti_cooked_font *cooked_font; > unsigned char *data =3D op->data, *p; > > - if ((w < 6) || (h < 6) || (w > 32) || (h > 32) || (vpitch !=3D 32) > - || (op->charcount !=3D 256 && op->charcount !=3D 512)) > + if (!in_range(w, STICON_MIN_FONT_WIDTH, STICON_MAX_FONT_WIDTH) || > + !in_range(h, STICON_MIN_FONT_HEIGHT, STICON_MAX_FONT_HEIGHT) || > + (vpitch !=3D 32) || > + (op->charcount !=3D 256 && op->charcount !=3D 512)) > return -EINVAL; > pitch =3D ALIGN(w, 8) / 8; > bpc =3D pitch * h; > @@ -273,6 +280,19 @@ static int sticon_font_set(struct vc_data *vc, stru= ct console_font *font, > return sticon_set_font(vc, font, vpitch); > } > > +static int sticon_font_info(struct vc_data *vc, struct console_font_inf= o *info) > +{ > + info->min_width =3D STICON_MIN_FONT_WIDTH; > + info->min_height =3D STICON_MIN_FONT_HEIGHT; > + > + info->max_width =3D STICON_MAX_FONT_WIDTH; > + info->max_height =3D STICON_MAX_FONT_HEIGHT; > + > + info->flags =3D KD_FONT_INFO_FLAG_LOW_SIZE | KD_FONT_INFO_FLAG_HIGH_SI= ZE; > + > + return 0; > +} > + > static void sticon_init(struct vc_data *c, int init) > { > struct sti_struct *sti =3D sticon_sti; > @@ -371,6 +391,7 @@ static const struct consw sti_con =3D { > .con_scroll =3D sticon_scroll, > .con_switch =3D sticon_switch, > .con_blank =3D sticon_blank, > + .con_font_info =3D sticon_font_info, > .con_font_set =3D sticon_font_set, > .con_font_default =3D sticon_font_default, > .con_build_attr =3D sticon_build_attr, > diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgac= on.c > index 8ef1579fa57f..b75d31ef3353 100644 > --- a/drivers/video/console/vgacon.c > +++ b/drivers/video/console/vgacon.c > @@ -61,6 +61,10 @@ static struct vgastate vgastate; > #define BLANK 0x0020 > > #define VGA_FONTWIDTH 8 /* VGA does not support fontwidths != =3D 8 */ > + > +#define VGACON_MAX_FONT_WIDTH VGA_FONTWIDTH > +#define VGACON_MAX_FONT_HEIGHT 32 > + > /* > * Interface used by the world > */ > @@ -1013,6 +1017,19 @@ static int vgacon_adjust_height(struct vc_data *v= c, unsigned fontheight) > return 0; > } > > +static int vgacon_font_info(struct vc_data *vc, struct console_font_inf= o *info) > +{ > + info->min_width =3D VGACON_MAX_FONT_WIDTH; > + info->min_height =3D 0; > + > + info->max_width =3D VGACON_MAX_FONT_WIDTH; > + info->max_height =3D VGACON_MAX_FONT_HEIGHT; > + > + info->flags =3D KD_FONT_INFO_FLAG_LOW_SIZE | KD_FONT_INFO_FLAG_HIGH_SI= ZE; > + > + return 0; > +} > + > static int vgacon_font_set(struct vc_data *c, struct console_font *fon= t, > unsigned int vpitch, unsigned int flags) > { > @@ -1022,7 +1039,8 @@ static int vgacon_font_set(struct vc_data *c, stru= ct console_font *font, > if (vga_video_type < VIDEO_TYPE_EGAM) > return -EINVAL; > > - if (font->width !=3D VGA_FONTWIDTH || font->height > 32 || vpitch !=3D= 32 || > + if (font->width !=3D VGACON_MAX_FONT_WIDTH || > + font->height > VGACON_MAX_FONT_HEIGHT || vpitch !=3D 32 || > (charcount !=3D 256 && charcount !=3D 512)) > return -EINVAL; > > @@ -1177,6 +1195,7 @@ const struct consw vga_con =3D { > .con_scroll =3D vgacon_scroll, > .con_switch =3D vgacon_switch, > .con_blank =3D vgacon_blank, > + .con_font_info =3D vgacon_font_info, > .con_font_set =3D vgacon_font_set, > .con_font_get =3D vgacon_font_get, > .con_resize =3D vgacon_resize, > diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core= /fbcon.c > index 46823c2e2ba1..e10abe416159 100644 > --- a/drivers/video/fbdev/core/fbcon.c > +++ b/drivers/video/fbdev/core/fbcon.c > @@ -101,6 +101,9 @@ enum { > FBCON_LOGO_DONTSHOW =3D -3 /* do not show the logo */ > }; > > +#define FBCON_MAX_FONT_WIDTH 32 > +#define FBCON_MAX_FONT_HEIGHT 32 > + > static struct fbcon_display fb_display[MAX_NR_CONSOLES]; > > static struct fb_info *fbcon_registered_fb[FB_MAX]; > @@ -2456,6 +2459,21 @@ static int fbcon_do_set_font(struct vc_data *vc, = int w, int h, int charcount, > return ret; > } > > + > +static int fbcon_font_info(struct vc_data *vc, struct console_font_info= *info) > +{ > + info->min_width =3D 0; > + info->min_height =3D 0; > + > + info->max_width =3D FBCON_MAX_FONT_WIDTH; > + info->max_height =3D FBCON_MAX_FONT_HEIGHT; > + > + info->flags =3D KD_FONT_INFO_FLAG_LOW_SIZE | KD_FONT_INFO_FLAG_HIGH_SI= ZE; > + > + return 0; > +} > + > + > /* > * User asked to set font; we are guaranteed that charcount does not = exceed 512 > * but lets not assume that, since charcount of 512 is small for unic= ode support. > @@ -2483,7 +2501,8 @@ static int fbcon_set_font(struct vc_data *vc, stru= ct console_font *font, > h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres)) > return -EINVAL; > > - if (font->width > 32 || font->height > 32) > + if (font->width > FBCON_MAX_FONT_WIDTH || > + font->height > FBCON_MAX_FONT_HEIGHT) > return -EINVAL; > > /* Make sure drawing engine can handle the font */ > @@ -3158,6 +3177,7 @@ static const struct consw fb_con =3D { > .con_scroll =3D fbcon_scroll, > .con_switch =3D fbcon_switch, > .con_blank =3D fbcon_blank, > + .con_font_info =3D fbcon_font_info, > .con_font_set =3D fbcon_set_font, > .con_font_get =3D fbcon_get_font, > .con_font_default =3D fbcon_set_def_font,