Commit 56a14c69 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'hyperv-fixes-signed-20220128' of...

Merge tag 'hyperv-fixes-signed-20220128' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux

Pull hyperv fixes from Wei Liu:

 - Fix screen resolution for hyperv framebuffer (Michael Kelley)

 - Fix packet header accounting for balloon driver (Yanming Liu)

* tag 'hyperv-fixes-signed-20220128' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
  video: hyperv_fb: Fix validation of screen resolution
  Drivers: hv: balloon: account for vmbus packet header in max_pkt_size
parents 3cd7cd8a 9ff5549b
...@@ -1660,6 +1660,13 @@ static int balloon_connect_vsp(struct hv_device *dev) ...@@ -1660,6 +1660,13 @@ static int balloon_connect_vsp(struct hv_device *dev)
unsigned long t; unsigned long t;
int ret; int ret;
/*
* max_pkt_size should be large enough for one vmbus packet header plus
* our receive buffer size. Hyper-V sends messages up to
* HV_HYP_PAGE_SIZE bytes long on balloon channel.
*/
dev->channel->max_pkt_size = HV_HYP_PAGE_SIZE * 2;
ret = vmbus_open(dev->channel, dm_ring_size, dm_ring_size, NULL, 0, ret = vmbus_open(dev->channel, dm_ring_size, dm_ring_size, NULL, 0,
balloon_onchannelcallback, dev); balloon_onchannelcallback, dev);
if (ret) if (ret)
......
...@@ -287,8 +287,6 @@ struct hvfb_par { ...@@ -287,8 +287,6 @@ struct hvfb_par {
static uint screen_width = HVFB_WIDTH; static uint screen_width = HVFB_WIDTH;
static uint screen_height = HVFB_HEIGHT; static uint screen_height = HVFB_HEIGHT;
static uint screen_width_max = HVFB_WIDTH;
static uint screen_height_max = HVFB_HEIGHT;
static uint screen_depth; static uint screen_depth;
static uint screen_fb_size; static uint screen_fb_size;
static uint dio_fb_size; /* FB size for deferred IO */ static uint dio_fb_size; /* FB size for deferred IO */
...@@ -582,7 +580,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev) ...@@ -582,7 +580,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev)
int ret = 0; int ret = 0;
unsigned long t; unsigned long t;
u8 index; u8 index;
int i;
memset(msg, 0, sizeof(struct synthvid_msg)); memset(msg, 0, sizeof(struct synthvid_msg));
msg->vid_hdr.type = SYNTHVID_RESOLUTION_REQUEST; msg->vid_hdr.type = SYNTHVID_RESOLUTION_REQUEST;
...@@ -613,13 +610,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev) ...@@ -613,13 +610,6 @@ static int synthvid_get_supported_resolution(struct hv_device *hdev)
goto out; goto out;
} }
for (i = 0; i < msg->resolution_resp.resolution_count; i++) {
screen_width_max = max_t(unsigned int, screen_width_max,
msg->resolution_resp.supported_resolution[i].width);
screen_height_max = max_t(unsigned int, screen_height_max,
msg->resolution_resp.supported_resolution[i].height);
}
screen_width = screen_width =
msg->resolution_resp.supported_resolution[index].width; msg->resolution_resp.supported_resolution[index].width;
screen_height = screen_height =
...@@ -941,7 +931,7 @@ static void hvfb_get_option(struct fb_info *info) ...@@ -941,7 +931,7 @@ static void hvfb_get_option(struct fb_info *info)
if (x < HVFB_WIDTH_MIN || y < HVFB_HEIGHT_MIN || if (x < HVFB_WIDTH_MIN || y < HVFB_HEIGHT_MIN ||
(synthvid_ver_ge(par->synthvid_version, SYNTHVID_VERSION_WIN10) && (synthvid_ver_ge(par->synthvid_version, SYNTHVID_VERSION_WIN10) &&
(x > screen_width_max || y > screen_height_max)) || (x * y * screen_depth / 8 > screen_fb_size)) ||
(par->synthvid_version == SYNTHVID_VERSION_WIN8 && (par->synthvid_version == SYNTHVID_VERSION_WIN8 &&
x * y * screen_depth / 8 > SYNTHVID_FB_SIZE_WIN8) || x * y * screen_depth / 8 > SYNTHVID_FB_SIZE_WIN8) ||
(par->synthvid_version == SYNTHVID_VERSION_WIN7 && (par->synthvid_version == SYNTHVID_VERSION_WIN7 &&
...@@ -1194,8 +1184,8 @@ static int hvfb_probe(struct hv_device *hdev, ...@@ -1194,8 +1184,8 @@ static int hvfb_probe(struct hv_device *hdev,
} }
hvfb_get_option(info); hvfb_get_option(info);
pr_info("Screen resolution: %dx%d, Color depth: %d\n", pr_info("Screen resolution: %dx%d, Color depth: %d, Frame buffer size: %d\n",
screen_width, screen_height, screen_depth); screen_width, screen_height, screen_depth, screen_fb_size);
ret = hvfb_getmem(hdev, info); ret = hvfb_getmem(hdev, info);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment