Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* Re: [PATCH] Drivers: hv: vmbus: Improve the logc of reserving fb_mmio on Gen2 VMs
       [not found] <20260416183529.838321-1-decui@microsoft.com>
@ 2026-04-30 16:33 ` kernel test robot
  2026-04-30 22:42   ` [EXTERNAL] " Dexuan Cui
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-04-30 16:33 UTC (permalink / raw)
  To: Dexuan Cui, kys, haiyangz, wei.liu, longli, linux-hyperv,
	linux-kernel, mhklinux, matthew.ruffell, johansen
  Cc: llvm, oe-kbuild-all, stable

Hi Dexuan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v7.1-rc1 next-20260429]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Dexuan-Cui/Drivers-hv-vmbus-Improve-the-logc-of-reserving-fb_mmio-on-Gen2-VMs/20260424-033622
base:   linus/master
patch link:    https://lore.kernel.org/r/20260416183529.838321-1-decui%40microsoft.com
patch subject: [PATCH] Drivers: hv: vmbus: Improve the logc of reserving fb_mmio on Gen2 VMs
config: i386-buildonly-randconfig-002-20260430 (https://download.01.org/0day-ci/archive/20260501/202605010002.dnnxVZFF-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260501/202605010002.dnnxVZFF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605010002.dnnxVZFF-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/hv/vmbus_drv.c:2403:40: warning: result of comparison of constant 4294967296 with expression of type 'resource_size_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
    2403 |                         if (!low_mmio_base || low_mmio_base >= SZ_4G ||
         |                                               ~~~~~~~~~~~~~ ^  ~~~~~
   1 warning generated.


vim +2403 drivers/hv/vmbus_drv.c

  2385	
  2386	static void __maybe_unused vmbus_reserve_fb(void)
  2387	{
  2388		resource_size_t start = 0, size;
  2389		resource_size_t low_mmio_base;
  2390		struct pci_dev *pdev;
  2391	
  2392		/* Hyper-V CoCo guests do not have a framebuffer device. */
  2393		if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
  2394			return;
  2395	
  2396		if (efi_enabled(EFI_BOOT)) {
  2397			/* Gen2 VM: get FB base from EFI framebuffer */
  2398			if (IS_ENABLED(CONFIG_SYSFB)) {
  2399				start = sysfb_primary_display.screen.lfb_base;
  2400				size = max_t(__u32, sysfb_primary_display.screen.lfb_size, 0x800000);
  2401	
  2402				low_mmio_base = hyperv_mmio->start;
> 2403				if (!low_mmio_base || low_mmio_base >= SZ_4G ||
  2404				    (start && start < low_mmio_base)) {
  2405					pr_warn("Unexpected low mmio base 0x%pa\n", &low_mmio_base);
  2406				} else {
  2407					/*
  2408					 * If the kdump kernel's lfb_base is 0,
  2409					 * fall back to the low mmio base.
  2410					 */
  2411					if (!start)
  2412						start = low_mmio_base;
  2413					/*
  2414					 * Reserve half of the space below 4GB for high
  2415					 * resolutions, but cap the reservation to 128MB.
  2416					 */
  2417					size = min((SZ_4G - start) / 2, SZ_128M);
  2418				}
  2419			}
  2420		} else {
  2421			/* Gen1 VM: get FB base from PCI */
  2422			pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
  2423					      PCI_DEVICE_ID_HYPERV_VIDEO, NULL);
  2424			if (!pdev)
  2425				return;
  2426	
  2427			if (pdev->resource[0].flags & IORESOURCE_MEM) {
  2428				start = pci_resource_start(pdev, 0);
  2429				size = pci_resource_len(pdev, 0);
  2430			}
  2431	
  2432			/*
  2433			 * Release the PCI device so hyperv_drm driver can grab it
  2434			 * later.
  2435			 */
  2436			pci_dev_put(pdev);
  2437		}
  2438	
  2439		if (!start)
  2440			return;
  2441	
  2442		/*
  2443		 * Make a claim for the frame buffer in the resource tree under the
  2444		 * first node, which will be the one below 4GB.  The length seems to
  2445		 * be underreported, particularly in a Generation 1 VM.  So start out
  2446		 * reserving a larger area and make it smaller until it succeeds.
  2447		 */
  2448		for (; !fb_mmio && (size >= 0x100000); size >>= 1)
  2449			fb_mmio = __request_region(hyperv_mmio, start, size, fb_mmio_name, 0);
  2450	
  2451		pr_info("hv_mmio=%pR,%pR fb=%pR\n", hyperv_mmio, hyperv_mmio->sibling, fb_mmio);
  2452	}
  2453	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [EXTERNAL] Re: [PATCH] Drivers: hv: vmbus: Improve the logc of reserving fb_mmio on Gen2 VMs
  2026-04-30 16:33 ` [PATCH] Drivers: hv: vmbus: Improve the logc of reserving fb_mmio on Gen2 VMs kernel test robot
@ 2026-04-30 22:42   ` Dexuan Cui
  0 siblings, 0 replies; 2+ messages in thread
From: Dexuan Cui @ 2026-04-30 22:42 UTC (permalink / raw)
  To: kernel test robot, KY Srinivasan, Haiyang Zhang,
	wei.liu@kernel.org, Long Li, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org, mhklinux@outlook.com,
	matthew.ruffell@canonical.com, johansen@templeofstupid.com
  Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	stable@vger.kernel.org

> From: kernel test robot <lkp@intel.com>
> Sent: Thursday, April 30, 2026 9:33 AM
> ...
> config: i386-buildonly-randconfig-002-20260430
>  ...
> All warnings (new ones prefixed by >>):
> 
> >> drivers/hv/vmbus_drv.c:2403:40: warning: result of comparison of constant
> 4294967296 with expression of type 'resource_size_t' (aka 'unsigned int') is
> always false [-Wtautological-constant-out-of-range-compare]
>     2403 |                         if (!low_mmio_base || low_mmio_base >= SZ_4G ||
>          |                                               ~~~~~~~~~~~~~ ^  ~~~~~
>    1 warning generated.

Thanks for reporting the warning with the i386 kernel config.
I don't know if there is any x86-32 users nowadays, but this warning can be
fixed by:

-	if (!low_mmio_base || low_mmio_base >= SZ_4G ||
+	if (!low_mmio_base || upper_32_bits(low_mmio_base) ||
 	    (start && start < low_mmio_base)) {
 		pr_warn("Unexpected low mmio base 0x%pa\n", &low_mmio_base);
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-30 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260416183529.838321-1-decui@microsoft.com>
2026-04-30 16:33 ` [PATCH] Drivers: hv: vmbus: Improve the logc of reserving fb_mmio on Gen2 VMs kernel test robot
2026-04-30 22:42   ` [EXTERNAL] " Dexuan Cui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox