From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9209DC11F68 for ; Wed, 30 Jun 2021 14:09:58 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 40A9961437 for ; Wed, 30 Jun 2021 14:09:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40A9961437 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 11B076079A; Wed, 30 Jun 2021 14:09:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B38z19IBf5bo; Wed, 30 Jun 2021 14:09:53 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 2098A60590; Wed, 30 Jun 2021 14:09:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C9682C001A; Wed, 30 Jun 2021 14:09:52 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1C94BC000E for ; Wed, 30 Jun 2021 14:09:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E7E1141582 for ; Wed, 30 Jun 2021 14:09:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=ffwll.ch Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uU-i0wpBYT9e for ; Wed, 30 Jun 2021 14:09:46 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5E3734039D for ; Wed, 30 Jun 2021 14:09:45 +0000 (UTC) Received: by mail-wr1-x433.google.com with SMTP id u6so3820569wrs.5 for ; Wed, 30 Jun 2021 07:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=r3GeVDKfDg2IdtSNKJjgP4w0tnW1nQSFfENAB3hC2hA=; b=efj4BZpTE1NnvdNo1r1yAHcjpEEhsj3CxMhScvKgcf2I2qUzpBBbxspSU38w7WUFSl ljeDSZuDZnd/NI6853QDhT+n/4IyN7N740kj3gUKFed4KlbCo3XtG7HtnzNBZBfzJPaM zq69opGBIlUN72ADmYoPHHxA5phKC4PCC9k7E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=r3GeVDKfDg2IdtSNKJjgP4w0tnW1nQSFfENAB3hC2hA=; b=dyGUeZVJtGLmq6Dt6Xxb0lUgi0Ud2DlgjJHHMBJOdrrRzP5gQTVzPESdcJ5jVjw2K+ 00qra3OX9YT5C+WSmGU8GyF2UYiQDQao351yh8qrlb/6vvuFx0c3BC6drLOT8Z94sq8U SSizLa63GV35s2eRdl4WdggUP1SysM4cyQaZIqRcW7tk1pqsqTmreb0NdK/WXn0QiIcb d0Q+D61Gakm+AmGsg5qngAS78U3u7272iiDzo9HrphJUSsY01qoZQiHYhRPUkGSMqiQn ZGjz0JV6Av7eonhzYE5CEMPRfzEcSFjPyaXpcRS8s2DaRETyoBlOdzyawX+f1+Qv/Qlz Wntw== X-Gm-Message-State: AOAM5304tW3LlyHyGyrhZyTtdpIYRzrPFpRgB4Df6MERW8nHA4DVBK1b 6gBA2oMTdBO4xevnUyWNWKeNtg== X-Google-Smtp-Source: ABdhPJykYKWAJKrmjWnfa0zM9PIpg66M6rb1Gq95fP4RbvuyyWtZD4eFUkMVuhyJCMYEEb4EcZ9tsg== X-Received: by 2002:adf:f808:: with SMTP id s8mr38773987wrp.270.1625062183838; Wed, 30 Jun 2021 07:09:43 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id w9sm3304418wmc.19.2021.06.30.07.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 07:09:43 -0700 (PDT) Date: Wed, 30 Jun 2021 16:09:41 +0200 From: Daniel Vetter To: Thomas Zimmermann Subject: Re: [PATCH 1/3] drm/bochs: Move to tiny/ Message-ID: References: <20210630140659.17623-1-tzimmermann@suse.de> <20210630140659.17623-2-tzimmermann@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210630140659.17623-2-tzimmermann@suse.de> X-Operating-System: Linux phenom 5.10.0-7-amd64 Cc: mripard@kernel.org, airlied@linux.ie, maarten.lankhorst@linux.intel.com, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, daniel@ffwll.ch X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Wed, Jun 30, 2021 at 04:06:57PM +0200, Thomas Zimmermann wrote: > The bochs driver is only ~600 lines of code. Putting it into tiny/ > cleans up the DRM directory slightly. Some style problems were fixed > and unneeded include statements were removed. No functional changes. > > Signed-off-by: Thomas Zimmermann Really nice! On the series: Acked-by: Daniel Vetter I think I've found one missing static below. Cheers, Daniel > --- > MAINTAINERS | 2 +- > drivers/gpu/drm/Kconfig | 2 - > drivers/gpu/drm/Makefile | 1 - > drivers/gpu/drm/bochs/Kconfig | 11 - > drivers/gpu/drm/bochs/Makefile | 4 - > drivers/gpu/drm/bochs/bochs.h | 98 ---- > drivers/gpu/drm/bochs/bochs_drv.c | 205 -------- > drivers/gpu/drm/bochs/bochs_hw.c | 323 ------------- > drivers/gpu/drm/bochs/bochs_kms.c | 178 ------- > drivers/gpu/drm/bochs/bochs_mm.c | 24 - > drivers/gpu/drm/tiny/Kconfig | 13 + > drivers/gpu/drm/tiny/Makefile | 1 + > drivers/gpu/drm/tiny/bochs.c | 768 ++++++++++++++++++++++++++++++ > 13 files changed, 783 insertions(+), 847 deletions(-) > delete mode 100644 drivers/gpu/drm/bochs/Kconfig > delete mode 100644 drivers/gpu/drm/bochs/Makefile > delete mode 100644 drivers/gpu/drm/bochs/bochs.h > delete mode 100644 drivers/gpu/drm/bochs/bochs_drv.c > delete mode 100644 drivers/gpu/drm/bochs/bochs_hw.c > delete mode 100644 drivers/gpu/drm/bochs/bochs_kms.c > delete mode 100644 drivers/gpu/drm/bochs/bochs_mm.c > create mode 100644 drivers/gpu/drm/tiny/bochs.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index dcb5f0d32303..95bad8d45200 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -5680,7 +5680,7 @@ M: Gerd Hoffmann > L: virtualization@lists.linux-foundation.org > S: Maintained > T: git git://anongit.freedesktop.org/drm/drm-misc > -F: drivers/gpu/drm/bochs/ > +F: drivers/gpu/drm/tiny/bochs.c > > DRM DRIVER FOR BOE HIMAX8279D PANELS > M: Jerry Han > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig > index 1366d8d4610a..0d372354c2d0 100644 > --- a/drivers/gpu/drm/Kconfig > +++ b/drivers/gpu/drm/Kconfig > @@ -322,8 +322,6 @@ source "drivers/gpu/drm/tilcdc/Kconfig" > > source "drivers/gpu/drm/qxl/Kconfig" > > -source "drivers/gpu/drm/bochs/Kconfig" > - > source "drivers/gpu/drm/virtio/Kconfig" > > source "drivers/gpu/drm/msm/Kconfig" > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile > index 12e6f4e485ed..ad1112154898 100644 > --- a/drivers/gpu/drm/Makefile > +++ b/drivers/gpu/drm/Makefile > @@ -98,7 +98,6 @@ obj-y += omapdrm/ > obj-$(CONFIG_DRM_SUN4I) += sun4i/ > obj-y += tilcdc/ > obj-$(CONFIG_DRM_QXL) += qxl/ > -obj-$(CONFIG_DRM_BOCHS) += bochs/ > obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio/ > obj-$(CONFIG_DRM_MSM) += msm/ > obj-$(CONFIG_DRM_TEGRA) += tegra/ > diff --git a/drivers/gpu/drm/bochs/Kconfig b/drivers/gpu/drm/bochs/Kconfig > deleted file mode 100644 > index 7bcdf294fed8..000000000000 > --- a/drivers/gpu/drm/bochs/Kconfig > +++ /dev/null > @@ -1,11 +0,0 @@ > -# SPDX-License-Identifier: GPL-2.0-only > -config DRM_BOCHS > - tristate "DRM Support for bochs dispi vga interface (qemu stdvga)" > - depends on DRM && PCI && MMU > - select DRM_KMS_HELPER > - select DRM_VRAM_HELPER > - select DRM_TTM > - select DRM_TTM_HELPER > - help > - Choose this option for qemu. > - If M is selected the module will be called bochs-drm. > diff --git a/drivers/gpu/drm/bochs/Makefile b/drivers/gpu/drm/bochs/Makefile > deleted file mode 100644 > index 55473371300f..000000000000 > --- a/drivers/gpu/drm/bochs/Makefile > +++ /dev/null > @@ -1,4 +0,0 @@ > -# SPDX-License-Identifier: GPL-2.0-only > -bochs-drm-y := bochs_drv.o bochs_mm.o bochs_kms.o bochs_hw.o > - > -obj-$(CONFIG_DRM_BOCHS) += bochs-drm.o > diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h > deleted file mode 100644 > index e9645c612aff..000000000000 > --- a/drivers/gpu/drm/bochs/bochs.h > +++ /dev/null > @@ -1,98 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0 */ > - > -#include > -#include > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include > - > -/* ---------------------------------------------------------------------- */ > - > -#define VBE_DISPI_IOPORT_INDEX 0x01CE > -#define VBE_DISPI_IOPORT_DATA 0x01CF > - > -#define VBE_DISPI_INDEX_ID 0x0 > -#define VBE_DISPI_INDEX_XRES 0x1 > -#define VBE_DISPI_INDEX_YRES 0x2 > -#define VBE_DISPI_INDEX_BPP 0x3 > -#define VBE_DISPI_INDEX_ENABLE 0x4 > -#define VBE_DISPI_INDEX_BANK 0x5 > -#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6 > -#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7 > -#define VBE_DISPI_INDEX_X_OFFSET 0x8 > -#define VBE_DISPI_INDEX_Y_OFFSET 0x9 > -#define VBE_DISPI_INDEX_VIDEO_MEMORY_64K 0xa > - > -#define VBE_DISPI_ID0 0xB0C0 > -#define VBE_DISPI_ID1 0xB0C1 > -#define VBE_DISPI_ID2 0xB0C2 > -#define VBE_DISPI_ID3 0xB0C3 > -#define VBE_DISPI_ID4 0xB0C4 > -#define VBE_DISPI_ID5 0xB0C5 > - > -#define VBE_DISPI_DISABLED 0x00 > -#define VBE_DISPI_ENABLED 0x01 > -#define VBE_DISPI_GETCAPS 0x02 > -#define VBE_DISPI_8BIT_DAC 0x20 > -#define VBE_DISPI_LFB_ENABLED 0x40 > -#define VBE_DISPI_NOCLEARMEM 0x80 > - > -/* ---------------------------------------------------------------------- */ > - > -enum bochs_types { > - BOCHS_QEMU_STDVGA, > - BOCHS_UNKNOWN, > -}; > - > -struct bochs_device { > - /* hw */ > - void __iomem *mmio; > - int ioports; > - void __iomem *fb_map; > - unsigned long fb_base; > - unsigned long fb_size; > - unsigned long qext_size; > - > - /* mode */ > - u16 xres; > - u16 yres; > - u16 yres_virtual; > - u32 stride; > - u32 bpp; > - struct edid *edid; > - > - /* drm */ > - struct drm_device *dev; > - struct drm_simple_display_pipe pipe; > - struct drm_connector connector; > -}; > - > -/* ---------------------------------------------------------------------- */ > - > -/* bochs_hw.c */ > -int bochs_hw_init(struct drm_device *dev); > -void bochs_hw_fini(struct drm_device *dev); > - > -void bochs_hw_blank(struct bochs_device *bochs, bool blank); > -void bochs_hw_setmode(struct bochs_device *bochs, > - struct drm_display_mode *mode); > -void bochs_hw_setformat(struct bochs_device *bochs, > - const struct drm_format_info *format); > -void bochs_hw_setbase(struct bochs_device *bochs, > - int x, int y, int stride, u64 addr); > -int bochs_hw_load_edid(struct bochs_device *bochs); > - > -/* bochs_mm.c */ > -int bochs_mm_init(struct bochs_device *bochs); > -void bochs_mm_fini(struct bochs_device *bochs); > - > -/* bochs_kms.c */ > -int bochs_kms_init(struct bochs_device *bochs); > - > -/* bochs_fbdev.c */ > -extern const struct drm_mode_config_funcs bochs_mode_funcs; > diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c > deleted file mode 100644 > index c828cadbabff..000000000000 > --- a/drivers/gpu/drm/bochs/bochs_drv.c > +++ /dev/null > @@ -1,205 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0-or-later > -/* > - */ > - > -#include > -#include > - > -#include > -#include > -#include > -#include > - > -#include "bochs.h" > - > -static int bochs_modeset = -1; > -module_param_named(modeset, bochs_modeset, int, 0444); > -MODULE_PARM_DESC(modeset, "enable/disable kernel modesetting"); > - > -/* ---------------------------------------------------------------------- */ > -/* drm interface */ > - > -static void bochs_unload(struct drm_device *dev) > -{ > - struct bochs_device *bochs = dev->dev_private; > - > - bochs_mm_fini(bochs); > -} > - > -static int bochs_load(struct drm_device *dev) > -{ > - struct bochs_device *bochs; > - int ret; > - > - bochs = drmm_kzalloc(dev, sizeof(*bochs), GFP_KERNEL); > - if (bochs == NULL) > - return -ENOMEM; > - dev->dev_private = bochs; > - bochs->dev = dev; > - > - ret = bochs_hw_init(dev); > - if (ret) > - goto err; > - > - ret = bochs_mm_init(bochs); > - if (ret) > - goto err; > - > - ret = bochs_kms_init(bochs); > - if (ret) > - goto err; > - > - return 0; > - > -err: > - bochs_unload(dev); > - return ret; > -} > - > -DEFINE_DRM_GEM_FOPS(bochs_fops); > - > -static const struct drm_driver bochs_driver = { > - .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, > - .fops = &bochs_fops, > - .name = "bochs-drm", > - .desc = "bochs dispi vga interface (qemu stdvga)", > - .date = "20130925", > - .major = 1, > - .minor = 0, > - DRM_GEM_VRAM_DRIVER, > - .release = bochs_unload, > -}; > - > -/* ---------------------------------------------------------------------- */ > -/* pm interface */ > - > -#ifdef CONFIG_PM_SLEEP > -static int bochs_pm_suspend(struct device *dev) > -{ > - struct drm_device *drm_dev = dev_get_drvdata(dev); > - > - return drm_mode_config_helper_suspend(drm_dev); > -} > - > -static int bochs_pm_resume(struct device *dev) > -{ > - struct drm_device *drm_dev = dev_get_drvdata(dev); > - > - return drm_mode_config_helper_resume(drm_dev); > -} > -#endif > - > -static const struct dev_pm_ops bochs_pm_ops = { > - SET_SYSTEM_SLEEP_PM_OPS(bochs_pm_suspend, > - bochs_pm_resume) > -}; > - > -/* ---------------------------------------------------------------------- */ > -/* pci interface */ > - > -static int bochs_pci_probe(struct pci_dev *pdev, > - const struct pci_device_id *ent) > -{ > - struct drm_device *dev; > - unsigned long fbsize; > - int ret; > - > - fbsize = pci_resource_len(pdev, 0); > - if (fbsize < 4 * 1024 * 1024) { > - DRM_ERROR("less than 4 MB video memory, ignoring device\n"); > - return -ENOMEM; > - } > - > - ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "bochsdrmfb"); > - if (ret) > - return ret; > - > - dev = drm_dev_alloc(&bochs_driver, &pdev->dev); > - if (IS_ERR(dev)) > - return PTR_ERR(dev); > - > - ret = pci_enable_device(pdev); > - if (ret) > - goto err_free_dev; > - > - pci_set_drvdata(pdev, dev); > - > - ret = bochs_load(dev); > - if (ret) > - goto err_free_dev; > - > - ret = drm_dev_register(dev, 0); > - if (ret) > - goto err_unload; > - > - drm_fbdev_generic_setup(dev, 32); > - return ret; > - > -err_unload: > - bochs_unload(dev); > -err_free_dev: > - drm_dev_put(dev); > - return ret; > -} > - > -static void bochs_pci_remove(struct pci_dev *pdev) > -{ > - struct drm_device *dev = pci_get_drvdata(pdev); > - > - drm_dev_unplug(dev); > - drm_atomic_helper_shutdown(dev); > - bochs_hw_fini(dev); > - drm_dev_put(dev); > -} > - > -static const struct pci_device_id bochs_pci_tbl[] = { > - { > - .vendor = 0x1234, > - .device = 0x1111, > - .subvendor = PCI_SUBVENDOR_ID_REDHAT_QUMRANET, > - .subdevice = PCI_SUBDEVICE_ID_QEMU, > - .driver_data = BOCHS_QEMU_STDVGA, > - }, > - { > - .vendor = 0x1234, > - .device = 0x1111, > - .subvendor = PCI_ANY_ID, > - .subdevice = PCI_ANY_ID, > - .driver_data = BOCHS_UNKNOWN, > - }, > - { /* end of list */ } > -}; > - > -static struct pci_driver bochs_pci_driver = { > - .name = "bochs-drm", > - .id_table = bochs_pci_tbl, > - .probe = bochs_pci_probe, > - .remove = bochs_pci_remove, > - .driver.pm = &bochs_pm_ops, > -}; > - > -/* ---------------------------------------------------------------------- */ > -/* module init/exit */ > - > -static int __init bochs_init(void) > -{ > - if (vgacon_text_force() && bochs_modeset == -1) > - return -EINVAL; > - > - if (bochs_modeset == 0) > - return -EINVAL; > - > - return pci_register_driver(&bochs_pci_driver); > -} > - > -static void __exit bochs_exit(void) > -{ > - pci_unregister_driver(&bochs_pci_driver); > -} > - > -module_init(bochs_init); > -module_exit(bochs_exit); > - > -MODULE_DEVICE_TABLE(pci, bochs_pci_tbl); > -MODULE_AUTHOR("Gerd Hoffmann "); > -MODULE_LICENSE("GPL"); > diff --git a/drivers/gpu/drm/bochs/bochs_hw.c b/drivers/gpu/drm/bochs/bochs_hw.c > deleted file mode 100644 > index 7d3426d8cc69..000000000000 > --- a/drivers/gpu/drm/bochs/bochs_hw.c > +++ /dev/null > @@ -1,323 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0-or-later > -/* > - */ > - > -#include > - > -#include > -#include > - > -#include