Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull hyperv fixes from Wei Liu:

- Fix an error handling issue in DRM driver (Christophe JAILLET)

- Fix some issues in framebuffer driver (Vitaly Kuznetsov)

- Two typo fixes (Jason Wang, Shaomin Deng)

- Drop unnecessary casting in kvp tool (Zhou Jie)

* tag 'hyperv-fixes-signed-20220912' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
Drivers: hv: Never allocate anything besides framebuffer from framebuffer memory region
Drivers: hv: Always reserve framebuffer region for Gen1 VMs
PCI: Move PCI_VENDOR_ID_MICROSOFT/PCI_DEVICE_ID_HYPERV_VIDEO definitions to pci_ids.h
tools: hv: kvp: remove unnecessary (void*) conversions
Drivers: hv: remove duplicate word in a comment
tools: hv: Remove an extraneous "the"
drm/hyperv: Fix an error handling path in hyperv_vmbus_probe()

+52 -33
+4 -6
drivers/gpu/drm/hyperv/hyperv_drm_drv.c
··· 23 23 #define DRIVER_MAJOR 1 24 24 #define DRIVER_MINOR 0 25 25 26 - #define PCI_VENDOR_ID_MICROSOFT 0x1414 27 - #define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353 28 - 29 26 DEFINE_DRM_GEM_FOPS(hv_fops); 30 27 31 28 static struct drm_driver hyperv_driver = { ··· 130 133 } 131 134 132 135 ret = hyperv_setup_vram(hv, hdev); 133 - 134 136 if (ret) 135 137 goto err_vmbus_close; 136 138 ··· 146 150 147 151 ret = hyperv_mode_config_init(hv); 148 152 if (ret) 149 - goto err_vmbus_close; 153 + goto err_free_mmio; 150 154 151 155 ret = drm_dev_register(dev, 0); 152 156 if (ret) { 153 157 drm_err(dev, "Failed to register drm driver.\n"); 154 - goto err_vmbus_close; 158 + goto err_free_mmio; 155 159 } 156 160 157 161 drm_fbdev_generic_setup(dev, 0); 158 162 159 163 return 0; 160 164 165 + err_free_mmio: 166 + vmbus_free_mmio(hv->mem->start, hv->fb_size); 161 167 err_vmbus_close: 162 168 vmbus_close(hdev->channel); 163 169 err_hv_set_drv_data:
+1 -1
drivers/hv/hv_fcopy.c
··· 129 129 130 130 /* 131 131 * The strings sent from the host are encoded in 132 - * in utf16; convert it to utf8 strings. 132 + * utf16; convert it to utf8 strings. 133 133 * The host assures us that the utf16 strings will not exceed 134 134 * the max lengths specified. We will however, reserve room 135 135 * for the string terminating character - in the utf16s_utf8s()
+41 -15
drivers/hv/vmbus_drv.c
··· 35 35 #include <linux/kernel.h> 36 36 #include <linux/syscore_ops.h> 37 37 #include <linux/dma-map-ops.h> 38 + #include <linux/pci.h> 38 39 #include <clocksource/hyperv_timer.h> 39 40 #include "hyperv_vmbus.h" 40 41 ··· 2263 2262 2264 2263 static void vmbus_reserve_fb(void) 2265 2264 { 2266 - int size; 2265 + resource_size_t start = 0, size; 2266 + struct pci_dev *pdev; 2267 + 2268 + if (efi_enabled(EFI_BOOT)) { 2269 + /* Gen2 VM: get FB base from EFI framebuffer */ 2270 + start = screen_info.lfb_base; 2271 + size = max_t(__u32, screen_info.lfb_size, 0x800000); 2272 + } else { 2273 + /* Gen1 VM: get FB base from PCI */ 2274 + pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, 2275 + PCI_DEVICE_ID_HYPERV_VIDEO, NULL); 2276 + if (!pdev) 2277 + return; 2278 + 2279 + if (pdev->resource[0].flags & IORESOURCE_MEM) { 2280 + start = pci_resource_start(pdev, 0); 2281 + size = pci_resource_len(pdev, 0); 2282 + } 2283 + 2284 + /* 2285 + * Release the PCI device so hyperv_drm or hyperv_fb driver can 2286 + * grab it later. 2287 + */ 2288 + pci_dev_put(pdev); 2289 + } 2290 + 2291 + if (!start) 2292 + return; 2293 + 2267 2294 /* 2268 2295 * Make a claim for the frame buffer in the resource tree under the 2269 2296 * first node, which will be the one below 4GB. The length seems to 2270 2297 * be underreported, particularly in a Generation 1 VM. So start out 2271 2298 * reserving a larger area and make it smaller until it succeeds. 2272 2299 */ 2273 - 2274 - if (screen_info.lfb_base) { 2275 - if (efi_enabled(EFI_BOOT)) 2276 - size = max_t(__u32, screen_info.lfb_size, 0x800000); 2277 - else 2278 - size = max_t(__u32, screen_info.lfb_size, 0x4000000); 2279 - 2280 - for (; !fb_mmio && (size >= 0x100000); size >>= 1) { 2281 - fb_mmio = __request_region(hyperv_mmio, 2282 - screen_info.lfb_base, size, 2283 - fb_mmio_name, 0); 2284 - } 2285 - } 2300 + for (; !fb_mmio && (size >= 0x100000); size >>= 1) 2301 + fb_mmio = __request_region(hyperv_mmio, start, size, fb_mmio_name, 0); 2286 2302 } 2287 2303 2288 2304 /** ··· 2331 2313 bool fb_overlap_ok) 2332 2314 { 2333 2315 struct resource *iter, *shadow; 2334 - resource_size_t range_min, range_max, start; 2316 + resource_size_t range_min, range_max, start, end; 2335 2317 const char *dev_n = dev_name(&device_obj->device); 2336 2318 int retval; 2337 2319 ··· 2366 2348 range_max = iter->end; 2367 2349 start = (range_min + align - 1) & ~(align - 1); 2368 2350 for (; start + size - 1 <= range_max; start += align) { 2351 + end = start + size - 1; 2352 + 2353 + /* Skip the whole fb_mmio region if not fb_overlap_ok */ 2354 + if (!fb_overlap_ok && fb_mmio && 2355 + (((start >= fb_mmio->start) && (start <= fb_mmio->end)) || 2356 + ((end >= fb_mmio->start) && (end <= fb_mmio->end)))) 2357 + continue; 2358 + 2369 2359 shadow = __request_region(iter, start, size, NULL, 2370 2360 IORESOURCE_BUSY); 2371 2361 if (!shadow)
-4
drivers/net/ethernet/microsoft/mana/gdma_main.c
··· 1465 1465 pci_disable_device(pdev); 1466 1466 } 1467 1467 1468 - #ifndef PCI_VENDOR_ID_MICROSOFT 1469 - #define PCI_VENDOR_ID_MICROSOFT 0x1414 1470 - #endif 1471 - 1472 1468 static const struct pci_device_id mana_id_table[] = { 1473 1469 { PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_PF_DEVICE_ID) }, 1474 1470 { PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_VF_DEVICE_ID) },
-4
drivers/video/fbdev/hyperv_fb.c
··· 74 74 #define SYNTHVID_DEPTH_WIN8 32 75 75 #define SYNTHVID_FB_SIZE_WIN8 (8 * 1024 * 1024) 76 76 77 - #define PCI_VENDOR_ID_MICROSOFT 0x1414 78 - #define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353 79 - 80 - 81 77 enum pipe_msg_type { 82 78 PIPE_MSG_INVALID, 83 79 PIPE_MSG_DATA,
+3
include/linux/pci_ids.h
··· 2079 2079 #define PCI_DEVICE_ID_ICE_1712 0x1712 2080 2080 #define PCI_DEVICE_ID_VT1724 0x1724 2081 2081 2082 + #define PCI_VENDOR_ID_MICROSOFT 0x1414 2083 + #define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353 2084 + 2082 2085 #define PCI_VENDOR_ID_OXSEMI 0x1415 2083 2086 #define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 2084 2087 #define PCI_DEVICE_ID_OXSEMI_PCIe840 0xC000
+3 -3
tools/hv/hv_kvp_daemon.c
··· 44 44 45 45 /* 46 46 * KVP protocol: The user mode component first registers with the 47 - * the kernel component. Subsequently, the kernel component requests, data 47 + * kernel component. Subsequently, the kernel component requests, data 48 48 * for the specified keys. In response to this message the user mode component 49 49 * fills in the value corresponding to the specified key. We overload the 50 50 * sequence field in the cn_msg header to define our KVP message types. ··· 772 772 const char *str; 773 773 774 774 if (family == AF_INET) { 775 - addr = (struct sockaddr_in *)addrp; 775 + addr = addrp; 776 776 str = inet_ntop(family, &addr->sin_addr, tmp, 50); 777 777 addr_length = INET_ADDRSTRLEN; 778 778 } else { 779 - addr6 = (struct sockaddr_in6 *)addrp; 779 + addr6 = addrp; 780 780 str = inet_ntop(family, &addr6->sin6_addr.s6_addr, tmp, 50); 781 781 addr_length = INET6_ADDRSTRLEN; 782 782 }