Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2145527rdb; Mon, 9 Oct 2023 14:22:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNFIWzgd9KTH4XRLjmmX42x5WrJX5EUrfIlzgIrMji42DOc8yKyZaGzm5lIur9bmtEczxv X-Received: by 2002:a17:90a:4815:b0:276:7907:ecf with SMTP id a21-20020a17090a481500b0027679070ecfmr13012509pjh.36.1696886532015; Mon, 09 Oct 2023 14:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696886531; cv=none; d=google.com; s=arc-20160816; b=cm9yCDL5icQWiTrov9fwG4cQwtr9VyP9Cn6Cw4FIGzFyx1nzsr9dloDo6lbOtjZwkc 7Nu36HfBC1pn4ISrFfKLTPQTAhVdimk7vz89nMq94WcvJjlw6Y7NSsiM0uC0D+z9uvme IaaG4iAMVinxkQBscFsLH5keih+nIT7x1hOk5cyjPsediL3Kk7VKdKjhL43U9yum7Kkr L/vae89WU4XgH9xLjCt62WnsWMoxJmOASa4xvsKE0BC7hKW6WBocX7UABFdD52WFavkj GBNtDnmM14Hg5SYkZaK4yA1lUYJQidMQfj0XudNSLJ6Ueo4ZteOLQivzgjfuQTmwds4Q srew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JJbSXYz74CZ3mUHeAmGaGJDICXMFsZcrWzzZXI/W0Lo=; fh=5rjrd9z1AwCU6K4zctiyztRWfSlrVT4HOR1EMu5XpZI=; b=Nr0Pkx0jQWUB2N+v79l3+VPr7mWZ2O2CkE3B8eb8tKaFjRGOST61EKZHsEeKnbgtcl kCOaXKzIg80qy05FahlHDkZ7C5XhymwwAq8kVvwygXvDrmQ8eFWUubrSIG/qdepJxQM3 O50L7rhsuAjMRt8GrIU75rEj4oLHV2cVqXTaH4KvPzezqnjxzfqjcYaclwJkKNMsEjlI vd9C0Kx7heSITZPQDeFe4yk4VAKENvSJThBDPKOfV+v7pXc8MJUCuaMNR3fMAc3fYl8o t/DyCJN9Z03Qsvjh35J5qODEA7fkE7jx1ocobogTN040bA54i+dlh9RRfhOHDd/nTfQL BcTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NmSWIJiI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id x19-20020a17090ab01300b0027cdee52324si517786pjq.74.2023.10.09.14.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 14:22:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NmSWIJiI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D3F998044FFF; Mon, 9 Oct 2023 14:22:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378735AbjJIVV4 (ORCPT + 99 others); Mon, 9 Oct 2023 17:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378703AbjJIVVS (ORCPT ); Mon, 9 Oct 2023 17:21:18 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41216133; Mon, 9 Oct 2023 14:20:35 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57782C433A9; Mon, 9 Oct 2023 21:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696886434; bh=IUe9zQKsuCSW8PZPXBcaUGQEXOnvJDkNFrZmACx/Wc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NmSWIJiIMcyJjUfY5qC1+UVpedpmfmM66fmZu9OPQGX55nM5F1ijugpZATvGMMYLN 4OtJ68KWwnxC5sKEJHnXB0aPfh+L7jtRdvG3Ur9gFXkeieGSWAIA5v1RDLallZ7LaF ECZ4HTzfRXUiKmQKck0yRmHpvNA52NglqFMVnZjDkiAdX+Jc8CuUNLPfTEUBovYWNI KCj8GVKYtCzYKzH0wh/izBEtRrF1Kby4mGFn1lYaWezV/u9j863swaEgD7FOiPVxvg rv5hmStNIP5G+DhKDG1qddwfAUsgPb2O3uS107yfh00B9t616gUllJtrSz0BpX17wX Z9rWHJNyiE9Iw== From: Arnd Bergmann To: Thomas Zimmermann , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: Arnd Bergmann , "David S. Miller" , "K. Y. Srinivasan" , Ard Biesheuvel , Borislav Petkov , Brian Cain , Catalin Marinas , Christophe Leroy , Daniel Vetter , Dave Hansen , David Airlie , Deepak Rawat , Dexuan Cui , Dinh Nguyen , Greg Kroah-Hartman , Guo Ren , Haiyang Zhang , Helge Deller , Huacai Chen , Ingo Molnar , Javier Martinez Canillas , John Paul Adrian Glaubitz , Khalid Aziz , Linus Walleij , Matt Turner , Max Filippov , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Russell King , Thomas Bogendoerfer , Thomas Gleixner , WANG Xuerui , Wei Liu , Will Deacon , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [PATCH v3 8/9] hyperv: avoid dependency on screen_info Date: Mon, 9 Oct 2023 23:18:44 +0200 Message-Id: <20231009211845.3136536-9-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009211845.3136536-1-arnd@kernel.org> References: <20231009211845.3136536-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 09 Oct 2023 14:22:09 -0700 (PDT) X-Spam-Level: ** From: Arnd Bergmann The two hyperv framebuffer drivers (hyperv_fb or hyperv_drm_drv) access the global screen_info in order to take over from the sysfb framebuffer, which in turn could be handled by simplefb, simpledrm or efifb. Similarly, the vmbus_drv code marks the original EFI framebuffer as reserved, but this is not required if there is no sysfb. As a preparation for making screen_info itself more local to the sysfb helper code, add a compile-time conditional in all three files that relate to hyperv fb and just skip this code if there is no sysfb that needs to be unregistered. Reviewed-by: Javier Martinez Canillas Acked-by: Helge Deller Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 7 ++++--- drivers/hv/vmbus_drv.c | 6 ++++-- drivers/video/fbdev/hyperv_fb.c | 8 ++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c index 58b0b46a21e68..d511d17c5bdfc 100644 --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c @@ -73,9 +73,10 @@ static int hyperv_setup_vram(struct hyperv_drm_device *hv, struct drm_device *dev = &hv->dev; int ret; - drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base, - screen_info.lfb_size, - &hyperv_driver); + if (IS_ENABLED(CONFIG_SYSFB)) + drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base, + screen_info.lfb_size, + &hyperv_driver); hv->fb_size = (unsigned long)hv->mmio_megabytes * 1024 * 1024; diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index edbb38f6956b9..b33d5abd9beb2 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -2100,8 +2100,10 @@ static void __maybe_unused vmbus_reserve_fb(void) if (efi_enabled(EFI_BOOT)) { /* Gen2 VM: get FB base from EFI framebuffer */ - start = screen_info.lfb_base; - size = max_t(__u32, screen_info.lfb_size, 0x800000); + if (IS_ENABLED(CONFIG_SYSFB)) { + start = screen_info.lfb_base; + size = max_t(__u32, screen_info.lfb_size, 0x800000); + } } else { /* Gen1 VM: get FB base from PCI */ pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c index 2e27c6bd80442..bf59daf862fc7 100644 --- a/drivers/video/fbdev/hyperv_fb.c +++ b/drivers/video/fbdev/hyperv_fb.c @@ -1010,7 +1010,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) goto getmem_done; } pr_info("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n"); - } else { + } else if (IS_ENABLED(CONFIG_SYSFB)) { base = screen_info.lfb_base; size = screen_info.lfb_size; } @@ -1056,13 +1056,13 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) getmem_done: aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME); - if (gen2vm) { + if (!gen2vm) { + pci_dev_put(pdev); + } else if (IS_ENABLED(CONFIG_SYSFB)) { /* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */ screen_info.lfb_size = 0; screen_info.lfb_base = 0; screen_info.orig_video_isVGA = 0; - } else { - pci_dev_put(pdev); } return 0; -- 2.39.2