Re: [PATCH v3 09/13] device core: Introduce multiple dma pfn offsets
On Thu, Jun 04, 2020 at 10:35:12AM -0400, Jim Quinlan wrote: > On Thu, Jun 4, 2020 at 9:53 AM Nicolas Saenz Julienne > wrote: > > On Wed, 2020-06-03 at 15:20 -0400, Jim Quinlan wrote: ... > > > + phys = virt_to_phys(ret); > > > + pfn = phys >> PAGE_SHIFT; > > > > nit: not sure it really pays off to have a pfn variable here. > Did it for readability; the compiler's optimization should take care > of any extra variables. But I can switch if you insist. One side note: please, try to get familiar with existing helpers in the kernel. For example, above line is like pfn = PFN_DOWN(phys); ... > > > + if (!WARN_ON(!dev) && dev->dma_pfn_offset_map) > > > + *dma_handle -= PFN_PHYS( > > > + dma_pfn_offset_from_phys_addr(dev, phys)); Don't do such indentation, esp. we have now 100! :-) -- With Best Regards, Andy Shevchenko ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 004/105] clk: bcm: Add BCM2711 DVP driver
Hi Maxime, On Wed, 2020-05-27 at 17:47 +0200, Maxime Ripard wrote: > The HDMI block has a block that controls clocks and reset signals to the > HDMI0 and HDMI1 controllers. Why not having two separate drivers? > Let's expose that through a clock driver implementing a clock and reset > provider. > > Cc: Michael Turquette > Cc: Stephen Boyd > Cc: Rob Herring > Cc: linux-...@vger.kernel.org > Cc: devicet...@vger.kernel.org > Reviewed-by: Stephen Boyd > Signed-off-by: Maxime Ripard > --- > drivers/clk/bcm/Kconfig | 11 +++- > drivers/clk/bcm/Makefile | 1 +- > drivers/clk/bcm/clk-bcm2711-dvp.c | 127 +++- > 3 files changed, 139 insertions(+) > create mode 100644 drivers/clk/bcm/clk-bcm2711-dvp.c > > diff --git a/drivers/clk/bcm/Kconfig b/drivers/clk/bcm/Kconfig > index 8c83977a7dc4..784f12c72365 100644 > --- a/drivers/clk/bcm/Kconfig > +++ b/drivers/clk/bcm/Kconfig > @@ -1,4 +1,15 @@ > # SPDX-License-Identifier: GPL-2.0-only > + > +config CLK_BCM2711_DVP > + tristate "Broadcom BCM2711 DVP support" > + depends on ARCH_BCM2835 ||COMPILE_TEST > + depends on COMMON_CLK > + default ARCH_BCM2835 > + select RESET_SIMPLE > + help > + Enable common clock framework support for the Broadcom BCM2711 > + DVP Controller. > + > config CLK_BCM2835 > bool "Broadcom BCM2835 clock support" > depends on ARCH_BCM2835 || ARCH_BRCMSTB || COMPILE_TEST > diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile > index 0070ddf6cdd2..2c1349062147 100644 > --- a/drivers/clk/bcm/Makefile > +++ b/drivers/clk/bcm/Makefile > @@ -6,6 +6,7 @@ obj-$(CONFIG_CLK_BCM_KONA)+= clk-kona-setup.o > obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o > obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o > obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o > clk-iproc-asiu.o > +obj-$(CONFIG_CLK_BCM2835)+= clk-bcm2711-dvp.o > obj-$(CONFIG_CLK_BCM2835)+= clk-bcm2835.o > obj-$(CONFIG_CLK_BCM2835)+= clk-bcm2835-aux.o > obj-$(CONFIG_CLK_RASPBERRYPI)+= clk-raspberrypi.o > diff --git a/drivers/clk/bcm/clk-bcm2711-dvp.c b/drivers/clk/bcm/clk-bcm2711- > dvp.c > new file mode 100644 > index ..c1c4b5857d32 > --- /dev/null > +++ b/drivers/clk/bcm/clk-bcm2711-dvp.c > @@ -0,0 +1,127 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +// Copyright 2020 Cerno > + > +#include > +#include > +#include > +#include > +#include > + > +#define DVP_HT_RPI_SW_INIT 0x04 > +#define DVP_HT_RPI_MISC_CONFIG 0x08 > + > +#define NR_CLOCKS2 > +#define NR_RESETS6 > + > +struct clk_dvp { > + struct clk_hw_onecell_data *data; > + struct reset_simple_datareset; > +}; > + > +static const struct clk_parent_data clk_dvp_parent = { > + .index = 0, > +}; > + > +static int clk_dvp_probe(struct platform_device *pdev) > +{ > + struct clk_hw_onecell_data *data; > + struct resource *res; > + struct clk_dvp *dvp; > + void __iomem *base; > + int ret; > + > + dvp = devm_kzalloc(&pdev->dev, sizeof(*dvp), GFP_KERNEL); > + if (!dvp) > + return -ENOMEM; > + platform_set_drvdata(pdev, dvp); > + > + dvp->data = devm_kzalloc(&pdev->dev, > + struct_size(dvp->data, hws, NR_CLOCKS), > + GFP_KERNEL); > + if (!dvp->data) > + return -ENOMEM; > + data = dvp->data; > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + base = devm_ioremap_resource(&pdev->dev, res); I think the cool function to use these days is devm_platform_get_and_ioremap_resource(). Regards, Nicolas > + if (IS_ERR(base)) > + return PTR_ERR(base); > + > + dvp->reset.rcdev.owner = THIS_MODULE; > + dvp->reset.rcdev.nr_resets = NR_RESETS; > + dvp->reset.rcdev.ops = &reset_simple_ops; > + dvp->reset.rcdev.of_node = pdev->dev.of_node; > + dvp->reset.membase = base + DVP_HT_RPI_SW_INIT; > + spin_lock_init(&dvp->reset.lock); > + > + ret = reset_controller_register(&dvp->reset.rcdev); > + if (ret) > + return ret; > + > + data->hws[0] = clk_hw_register_gate_parent_data(&pdev->dev, > + "hdmi0-108MHz", > + &clk_dvp_parent, 0, > + base + > DVP_HT_RPI_MISC_CONFIG, 3, > + CLK_GATE_SET_TO_DISABLE, > + &dvp->reset.lock); > + if (IS_ERR(data->hws[0])) { > + ret = PTR_ERR(data->hws[0]); > + goto unregister_reset; > + } > + > + data->hws[1] = clk_hw_register_gate_parent_data(&pdev->dev, > + "hdmi1-108MHz", > + &clk_dvp_parent, 0, > +
[PATCH v12 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP
The ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed for portable device. It converts MIPI DSI/DPI to DisplayPort 1.3 4K. Signed-off-by: Xin Ji --- drivers/gpu/drm/bridge/analogix/Kconfig |9 + drivers/gpu/drm/bridge/analogix/Makefile |1 + drivers/gpu/drm/bridge/analogix/anx7625.c | 1961 + drivers/gpu/drm/bridge/analogix/anx7625.h | 397 ++ 4 files changed, 2368 insertions(+) create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig index e1fa7d8..024ea2a 100644 --- a/drivers/gpu/drm/bridge/analogix/Kconfig +++ b/drivers/gpu/drm/bridge/analogix/Kconfig @@ -25,3 +25,12 @@ config DRM_ANALOGIX_ANX78XX config DRM_ANALOGIX_DP tristate depends on DRM + +config DRM_ANALOGIX_ANX7625 + tristate "Analogix Anx7625 MIPI to DP interface support" + depends on DRM + depends on OF + help + ANX7625 is an ultra-low power 4K mobile HD transmitter + designed for portable devices. It converts MIPI/DPI to + DisplayPort1.3 4K. diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile index 97669b3..44da392 100644 --- a/drivers/gpu/drm/bridge/analogix/Makefile +++ b/drivers/gpu/drm/bridge/analogix/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o +obj-$(CONFIG_DRM_ANALOGIX_ANX7625) += anx7625.o obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c new file mode 100644 index 000..f1cc6bb --- /dev/null +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -0,0 +1,1961 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright(c) 2020, Analogix Semiconductor. All rights reserved. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "anx7625.h" + +/* + * There is a sync issue while access I2C register between AP(CPU) and + * internal firmware(OCM), to avoid the race condition, AP should access + * the reserved slave address before slave address occurs changes. + */ +static int i2c_access_workaround(struct anx7625_data *ctx, +struct i2c_client *client) +{ + u8 offset; + struct device *dev = &client->dev; + int ret; + + if (client == ctx->last_client) + return 0; + + ctx->last_client = client; + + if (client == ctx->i2c.tcpc_client) + offset = RSVD_00_ADDR; + else if (client == ctx->i2c.tx_p0_client) + offset = RSVD_D1_ADDR; + else if (client == ctx->i2c.tx_p1_client) + offset = RSVD_60_ADDR; + else if (client == ctx->i2c.rx_p0_client) + offset = RSVD_39_ADDR; + else if (client == ctx->i2c.rx_p1_client) + offset = RSVD_7F_ADDR; + else + offset = RSVD_00_ADDR; + + ret = i2c_smbus_write_byte_data(client, offset, 0x00); + if (ret < 0) + DRM_DEV_ERROR(dev, + "fail to access i2c id=%x\n:%x", + client->addr, offset); + + return ret; +} + +static int anx7625_reg_read(struct anx7625_data *ctx, + struct i2c_client *client, u8 reg_addr) +{ + int ret; + struct device *dev = &client->dev; + + i2c_access_workaround(ctx, client); + + ret = i2c_smbus_read_byte_data(client, reg_addr); + if (ret < 0) + DRM_DEV_ERROR(dev, "read i2c fail id=%x:%x\n", + client->addr, reg_addr); + + return ret; +} + +static int anx7625_reg_block_read(struct anx7625_data *ctx, + struct i2c_client *client, + u8 reg_addr, u8 len, u8 *buf) +{ + int ret; + struct device *dev = &client->dev; + + i2c_access_workaround(ctx, client); + + ret = i2c_smbus_read_i2c_block_data(client, reg_addr, len, buf); + if (ret < 0) + DRM_DEV_ERROR(dev, "read i2c block fail id=%x:%x\n", + client->addr, reg_addr); + + return ret; +} + +static int anx7625_reg_write(struct anx7625_data *ctx, +struct i2c_client *client, +u8 reg_addr, u8 reg_val) +{ + int ret; + struct device *dev = &client->dev; + + i2c_access_workaround(ctx, client); + + ret
Re: [PATCH 13/13] fs: move binfmt_misc sysctl to its own file
On 2020/5/29 15:41, Luis Chamberlain wrote: This moves the binfmt_misc sysctl to its own file to help remove clutter from kernel/sysctl.c. Signed-off-by: Luis Chamberlain --- fs/binfmt_misc.c | 1 + kernel/sysctl.c | 7 --- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index f69a043f562b..656b3f5f3bbf 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -821,6 +821,7 @@ static int __init init_misc_binfmt(void) int err = register_filesystem(&bm_fs_type); if (!err) insert_binfmt(&misc_format); + register_sysctl_empty_subdir("fs", "binfmt_misc"); return err; } build error when CONFIG_BINFMT_MISC=m ERROR: modpost: "register_sysctl_empty_subdir" [fs/binfmt_misc.ko] undefined! diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 27f0c9ea..4129dfb 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -2853,6 +2853,7 @@ void register_sysctl_empty_subdir(const char *base, { register_sysctl_subdir(base, subdir, sysctl_mount_point); } +EXPORT_SYMBOL_GPL(register_sysctl_empty_subdir); #endif /* CONFIG_SYSCTL */ Thanks Xiaoming Ni ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v12 0/2] Add initial support for slimport anx7625
Hi all, The following series add support for the Slimport ANX7625 transmitter, a ultra-low power Full-HD 4K MIPI to DP transmitter designed for portable device. This is the v12 version, any mistakes, please let me know, I will fix it in the next series. Change history: v12: Fix comments from Hsin-Yi Wang - Rebase the code on kernel 5.7, fix DRM interface not match issue. v11: Fix comments from Rob Herring - Update commit message. - Remove unused label. v10: Fix comments from Rob Herring, Daniel. - Fix dt_binding_check warning. - Update description. v9: Fix comments from Sam, Nicolas, Daniel - Remove extcon interface. - Remove DPI support. - Fix dt_binding_check complains. - Code clean up and update description. v8: Fix comments from Nicolas. - Fix several coding format. - Update description. v7: - Fix critical timing(eg:odd hfp/hbp) in "mode_fixup" interface, enhance MIPI RX tolerance by setting register MIPI_DIGITAL_ADJ_1 to 0x3D. Xin Ji (2): dt-bindings: drm/bridge: anx7625: MIPI to DP transmitter DT schema drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP .../bindings/display/bridge/analogix,anx7625.yaml | 95 + drivers/gpu/drm/bridge/analogix/Kconfig|9 + drivers/gpu/drm/bridge/analogix/Makefile |1 + drivers/gpu/drm/bridge/analogix/anx7625.c | 1961 drivers/gpu/drm/bridge/analogix/anx7625.h | 397 5 files changed, 2463 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] arch/{mips,sparc,microblaze,powerpc}: Don't enable pagefault/preempt twice
On 6/3/20 11:22 PM, Ira Weiny wrote: [ ... ] > > s390: (does not compile) > > :1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] > In file included from ./arch/sparc/include/asm/bug.h:6:0, > from ./include/linux/bug.h:5, > from ./include/linux/mmdebug.h:5, > from ./include/linux/mm.h:9, > from mm/huge_memory.c:8: > mm/huge_memory.c: In function 'hugepage_init': > ./include/linux/compiler.h:403:38: error: call to '__compiletime_assert_127' > declared with attribute error: BUILD_BUG_ON failed: ((13 + (13-3))-13) >= 9 > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > ^ > ./include/linux/compiler.h:384:4: note: in definition of macro > '__compiletime_assert' > prefix ## suffix();\ > ^~ > ./include/linux/compiler.h:403:2: note: in expansion of macro > '_compiletime_assert' > _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > ^~~ > ./include/linux/build_bug.h:39:37: note: in expansion of macro > 'compiletime_assert' > #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > ^~ > ./include/linux/build_bug.h:50:2: note: in expansion of macro > 'BUILD_BUG_ON_MSG' > BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) > ^~~~ > ./include/linux/bug.h:24:4: note: in expansion of macro 'BUILD_BUG_ON' > BUILD_BUG_ON(cond); \ > ^~~~ > mm/huge_memory.c:403:2: note: in expansion of macro 'MAYBE_BUILD_BUG_ON' > MAYBE_BUILD_BUG_ON(HPAGE_PMD_ORDER >= MAX_ORDER); > ^~ > make[1]: *** [scripts/Makefile.build:267: mm/huge_memory.o] Error 1 > make[1]: *** Waiting for unfinished jobs > make: *** [Makefile:1735: mm] Error 2 > make: *** Waiting for unfinished jobs > > > > The s390 error is the same on Linus' master and linux-next. So whatever is > causing that has slipped into mainline and/or is something I've broken in the > test scripts. > Compiler version related. gcc version 8.x and later no longer work. Bisect points to commit a148866489f ("sched: Replace rq::wake_list"). Oddly enough x86 images are broken as well. You'll have to use an older version of gcc (or presumably clang) until this is fixed. Guenter ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v12 1/2] dt-bindings: drm/bridge: anx7625: MIPI to DP transmitter DT schema
On Thu, Jun 04, 2020 at 04:24:02PM -0600, Rob Herring wrote: > On Thu, 04 Jun 2020 15:56:36 +0800, Xin Ji wrote: > > anx7625: MIPI to DP transmitter DT schema > > > > Signed-off-by: Xin Ji > > --- > > .../bindings/display/bridge/analogix,anx7625.yaml | 95 > > ++ > > 1 file changed, 95 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml > > > > > Please add Acked-by/Reviewed-by tags when posting new versions. However, > there's no need to repost patches *only* to add the tags. The upstream > maintainer will do that for acks received on the version they apply. > > If a tag was not added on purpose, please state why and what changed. Hi Rob Herring, thanks for your comment. I'll add tags in the next versions. Thanks, Xin ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 1/3] virtio: add dma-buf support for exported objects
On Fri, Jun 5, 2020 at 4:05 AM Michael S. Tsirkin wrote: > > On Tue, May 26, 2020 at 07:58:09PM +0900, David Stevens wrote: > > This change adds a new flavor of dma-bufs that can be used by virtio > > drivers to share exported objects. A virtio dma-buf can be queried by > > virtio drivers to obtain the UUID which identifies the underlying > > exported object. > > > > Signed-off-by: David Stevens > > Is this just for graphics? If yes I'd rather we put it in the graphics > driver. We can always move it later ... As stated in the cover letter, this will be used by virtio-video. The proposed virtio-video patches: https://markmail.org/thread/p5d3k566srtdtute The patch which imports these dma-bufs (slightly out of data, uses v3 of this patch set): https://markmail.org/thread/j4xlqaaim266qpks > > --- > > drivers/virtio/Makefile | 2 +- > > drivers/virtio/virtio.c | 6 +++ > > drivers/virtio/virtio_dma_buf.c | 89 + > > include/linux/virtio.h | 1 + > > include/linux/virtio_dma_buf.h | 58 + > > 5 files changed, 155 insertions(+), 1 deletion(-) > > create mode 100644 drivers/virtio/virtio_dma_buf.c > > create mode 100644 include/linux/virtio_dma_buf.h > > > > diff --git a/drivers/virtio/Makefile b/drivers/virtio/Makefile > > index 29a1386ecc03..ecdae5b596de 100644 > > --- a/drivers/virtio/Makefile > > +++ b/drivers/virtio/Makefile > > @@ -1,5 +1,5 @@ > > # SPDX-License-Identifier: GPL-2.0 > > -obj-$(CONFIG_VIRTIO) += virtio.o virtio_ring.o > > +obj-$(CONFIG_VIRTIO) += virtio.o virtio_ring.o virtio_dma_buf.o > > obj-$(CONFIG_VIRTIO_MMIO) += virtio_mmio.o > > obj-$(CONFIG_VIRTIO_PCI) += virtio_pci.o > > virtio_pci-y := virtio_pci_modern.o virtio_pci_common.o > > diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c > > index a977e32a88f2..5d46f0ded92d 100644 > > --- a/drivers/virtio/virtio.c > > +++ b/drivers/virtio/virtio.c > > @@ -357,6 +357,12 @@ int register_virtio_device(struct virtio_device *dev) > > } > > EXPORT_SYMBOL_GPL(register_virtio_device); > > > > +bool is_virtio_device(struct device *dev) > > +{ > > + return dev->bus == &virtio_bus; > > +} > > +EXPORT_SYMBOL_GPL(is_virtio_device); > > + > > void unregister_virtio_device(struct virtio_device *dev) > > { > > int index = dev->index; /* save for after device release */ > > diff --git a/drivers/virtio/virtio_dma_buf.c > > b/drivers/virtio/virtio_dma_buf.c > > new file mode 100644 > > index ..23e3399b11ed > > --- /dev/null > > +++ b/drivers/virtio/virtio_dma_buf.c > > @@ -0,0 +1,89 @@ > > +// SPDX-License-Identifier: GPL-2.0-or-later > > +/* > > + * dma-bufs for virtio exported objects > > + * > > + * Copyright (C) 2020 Google, Inc. > > + */ > > + > > +#include > > + > > +/** > > + * virtio_dma_buf_export - Creates a new dma-buf for a virtio exported > > object > > + * > > + * This wraps dma_buf_export() to allow virtio drivers to create a dma-buf > > + * for an virtio exported object that can be queried by other virtio > > drivers > > + * for the object's UUID. > > + */ > > +struct dma_buf *virtio_dma_buf_export( > > + const struct virtio_dma_buf_export_info *virtio_exp_info) > > +{ > > + struct dma_buf_export_info exp_info; > > + > > + if (!virtio_exp_info->ops > > + || virtio_exp_info->ops->ops.attach != &virtio_dma_buf_attach > > + || !virtio_exp_info->ops->get_uuid) { > > + return ERR_PTR(-EINVAL); > > + } > > + > > + exp_info.exp_name = virtio_exp_info->exp_name; > > + exp_info.owner = virtio_exp_info->owner; > > + exp_info.ops = &virtio_exp_info->ops->ops; > > + exp_info.size = virtio_exp_info->size; > > + exp_info.flags = virtio_exp_info->flags; > > + exp_info.resv = virtio_exp_info->resv; > > + exp_info.priv = virtio_exp_info->priv; > > + BUILD_BUG_ON(sizeof(struct virtio_dma_buf_export_info) > > + != sizeof(struct dma_buf_export_info)); > > This is the only part that gives me pause. Why do we need this hack? > What's wrong with just using dma_buf_export_info directly, > and if you want the virtio ops, just using container_off? This approach provides a more explicit type signature and a little more type safety, I think. If others don't think it's a worthwhile tradeoff, I can remove it. -David ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v12 1/2] dt-bindings: drm/bridge: anx7625: MIPI to DP transmitter DT schema
anx7625: MIPI to DP transmitter DT schema Signed-off-by: Xin Ji --- .../bindings/display/bridge/analogix,anx7625.yaml | 95 ++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml diff --git a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml new file mode 100644 index 000..60585a4 --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml @@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2019 Analogix Semiconductor, Inc. +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/display/bridge/analogix,anx7625.yaml#"; +$schema: "http://devicetree.org/meta-schemas/core.yaml#"; + +title: Analogix ANX7625 SlimPort (4K Mobile HD Transmitter) + +maintainers: + - Xin Ji + +description: | + The ANX7625 is an ultra-low power 4K Mobile HD Transmitter + designed for portable devices. + +properties: + compatible: +items: + - const: analogix,anx7625 + + reg: +maxItems: 1 + + interrupts: +description: used for interrupt pin B8. +maxItems: 1 + + enable-gpios: +description: used for power on chip control, POWER_EN pin D2. +maxItems: 1 + + reset-gpios: +description: used for reset chip control, RESET_N pin B7. +maxItems: 1 + + ports: +type: object + +properties: + port@0: +type: object +description: + Video port for MIPI DSI input. + + port@1: +type: object +description: + Video port for panel or connector. + +required: +- port@0 +- port@1 + +required: + - compatible + - reg + - ports + +additionalProperties: false + +examples: + - | +#include + +i2c0 { +#address-cells = <1>; +#size-cells = <0>; + +encoder@58 { +compatible = "analogix,anx7625"; +reg = <0x58>; +enable-gpios = <&pio 45 GPIO_ACTIVE_HIGH>; +reset-gpios = <&pio 73 GPIO_ACTIVE_HIGH>; + +ports { +#address-cells = <1>; +#size-cells = <0>; + +mipi2dp_bridge_in: port@0 { +reg = <0>; +anx7625_in: endpoint { +remote-endpoint = <&mipi_dsi>; +}; +}; + +mipi2dp_bridge_out: port@1 { +reg = <1>; +anx7625_out: endpoint { +remote-endpoint = <&panel_in>; +}; +}; +}; +}; +}; -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Freedreno] [PATCH] drm/msm/dpu: ensure device suspend happens during PM sleep
On 2020-05-28 03:41, Doug Anderson wrote: Hi, On Fri, May 15, 2020 at 9:37 AM Doug Anderson wrote: Hi, On Fri, May 15, 2020 at 5:06 AM wrote: > > On 2020-05-14 21:47, Doug Anderson wrote: > > Hi, > > > > On Fri, May 1, 2020 at 6:31 AM Kalyan Thota > > wrote: > >> > >> "The PM core always increments the runtime usage counter > >> before calling the ->suspend() callback and decrements it > >> after calling the ->resume() callback" > >> > >> DPU and DSI are managed as runtime devices. When > >> suspend is triggered, PM core adds a refcount on all the > >> devices and calls device suspend, since usage count is > >> already incremented, runtime suspend was not getting called > >> and it kept the clocks on which resulted in target not > >> entering into XO shutdown. > >> > >> Add changes to force suspend on runtime devices during pm sleep. > >> > >> Changes in v1: > >> - Remove unnecessary checks in the function > >> _dpu_kms_disable_dpu (Rob Clark). > >> > >> Changes in v2: > >> - Avoid using suspend_late to reset the usagecount > >>as suspend_late might not be called during suspend > >>call failures (Doug). > >> > >> Changes in v3: > >> - Use force suspend instead of managing device usage_count > >>via runtime put and get API's to trigger callbacks (Doug). > >> > >> Changes in v4: > >> - Check the return values of pm_runtime_force_suspend and > >>pm_runtime_force_resume API's and pass appropriately (Doug). > >> > >> Changes in v5: > > > > Can you please put the version number properly in your subject? It's > > really hard to tell one version of your patch from another. > > > > > >> - With v4 patch, test cycle has uncovered issues in device resume. > >> > >>On bubs: cmd tx failures were seen as SW is sending panel off > >>commands when the dsi resources are turned off. > >> > >>Upon suspend, DRM driver will issue a NULL composition to the > >>dpu, followed by turning off all the HW blocks. > >> > >>v5 changes will serialize the NULL commit and resource unwinding > >>by handling them under PM prepare and PM complete phases there by > >>ensuring that clks are on when panel off commands are being > >>processed. > > > > I'm still most definitely not an expert in how all the DRM pieces all > > hook up together, but the solution you have in this patch seems wrong > > to me. As far as I can tell the "prepare" state isn't supposed to be > > actually doing the suspend work and here that's exactly what you're > > doing. I think you should find a different solution to ensure > > ordering is correct. > > > > -Doug > > > > Hi, Quite honestly I'm probably not the right person to be reviewing this code. I mostly just noticed one of your early patches and it looked strange to me. Hopefully someone with actual experience in how all the DRM components work together can actually review and see if this makes sense. Maybe Sean would know better? That being said, let me at least look at what you're saying... > Prepare and Complete are callbacks defined as part of Sleep and Resume > sequence > > Entering PM SUSPEND the phases are : prepare --> suspend --> > suspend_late --> suspend_noirq. > While leaving PM SUSPEND the phases are: resume_noirq --> resume_early > --> resume --> complete. Sure, it's part of the sequence. It's also documented in pm.h as: * The principal role of this callback is to prevent new children of * the device from being registered after it has returned (the driver's * subsystem and generally the rest of the kernel is supposed to prevent * new calls to the probe method from being made too once @prepare() has * succeeded). It does not feel like that matches your usage of this call. > The reason to push drm suspend handling to PM prepare phase is that > parent here will trigger a modeset to turn off the timing and > subsequently the panel. > the child devices should not turn of their clocks before parent unwinds > the composition. Hence they are serialized as per the sequence mentioned > above. So the general model in Linux is that children suspend before their parents, right? So you're saying that, in this case, the parent needs to act on the child before the child suspends. Is that correct? Rather than hijacking the prepare/complete, I'd be at least slightly inclined to move the other driver to turn off its clocks in suspend_late and to turn them back on in resume_early? That seems to be what was done in "analogix_dp-rockchip.c" to solve a similar problem. > A similar approach is taken by other driver that use drm framework. In > this driver, the device registers for prepare and complete callbacks to > handle drm_suspend and drm_resume. > https://gitlab.freedesktop.org/drm/msm/-/blob/msm-next/drivers/gpu/drm/exynos/exynos_drm_drv.c#L163 OK, if there is another driver in DRM then I guess I won't object too strongly. Note that when searching for other drivers I noticed this bit in todo.rst: * Most drivers (except
Re: [PATCH v11 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver
On Mon, Jun 01, 2020 at 12:14:09PM +0800, Hsin-Yi Wang wrote: > On Fri, May 15, 2020 at 2:53 PM Xin Ji wrote: > > > + > > +static int anx7625_bridge_attach(struct drm_bridge *bridge) > > Latest drm_bridge api: > > int (*attach)(struct drm_bridge *bridge, > enum drm_bridge_attach_flags flags); > > https://elixir.bootlin.com/linux/v5.7-rc7/source/include/drm/drm_bridge.h#L70 > > > +{ > > + struct anx7625_data *ctx = bridge_to_anx7625(bridge); > > + int err; Hi Hsin-Yi, thanks for the comment, I'll fix it in the version v12 Thanks, Xin ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v12 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP
On Thu, Jun 04, 2020 at 11:08:05AM +0300, Laurent Pinchart wrote: > Hello Xin, > > Thank you for the patch. > > On Thu, Jun 04, 2020 at 03:58:05PM +0800, Xin Ji wrote: > > The ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed > > for portable device. It converts MIPI DSI/DPI to DisplayPort 1.3 4K. > > > > Signed-off-by: Xin Ji > > --- > > drivers/gpu/drm/bridge/analogix/Kconfig |9 + > > drivers/gpu/drm/bridge/analogix/Makefile |1 + > > drivers/gpu/drm/bridge/analogix/anx7625.c | 1961 > > + > > drivers/gpu/drm/bridge/analogix/anx7625.h | 397 ++ > > 4 files changed, 2368 insertions(+) > > create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c > > create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h > > > > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig > > b/drivers/gpu/drm/bridge/analogix/Kconfig > > index e1fa7d8..024ea2a 100644 > > --- a/drivers/gpu/drm/bridge/analogix/Kconfig > > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig > > @@ -25,3 +25,12 @@ config DRM_ANALOGIX_ANX78XX > > config DRM_ANALOGIX_DP > > tristate > > depends on DRM > > + > > +config DRM_ANALOGIX_ANX7625 > > + tristate "Analogix Anx7625 MIPI to DP interface support" > > + depends on DRM > > + depends on OF > > + help > > + ANX7625 is an ultra-low power 4K mobile HD transmitter > > + designed for portable devices. It converts MIPI/DPI to > > + DisplayPort1.3 4K. > > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile > > b/drivers/gpu/drm/bridge/analogix/Makefile > > index 97669b3..44da392 100644 > > --- a/drivers/gpu/drm/bridge/analogix/Makefile > > +++ b/drivers/gpu/drm/bridge/analogix/Makefile > > @@ -1,5 +1,6 @@ > > # SPDX-License-Identifier: GPL-2.0-only > > analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o > > analogix-i2c-dptx.o > > obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o > > +obj-$(CONFIG_DRM_ANALOGIX_ANX7625) += anx7625.o > > obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o > > obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o > > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c > > b/drivers/gpu/drm/bridge/analogix/anx7625.c > > new file mode 100644 > > index 000..f1cc6bb > > --- /dev/null > > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c > > @@ -0,0 +1,1961 @@ > > +// SPDX-License-Identifier: GPL-2.0-only > > +/* > > + * Copyright(c) 2020, Analogix Semiconductor. All rights reserved. > > + * > > + */ > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > + > > +#include "anx7625.h" > > + > > +/* > > + * There is a sync issue while access I2C register between AP(CPU) and > > + * internal firmware(OCM), to avoid the race condition, AP should access > > + * the reserved slave address before slave address occurs changes. > > + */ > > +static int i2c_access_workaround(struct anx7625_data *ctx, > > +struct i2c_client *client) > > +{ > > + u8 offset; > > + struct device *dev = &client->dev; > > + int ret; > > + > > + if (client == ctx->last_client) > > + return 0; > > + > > + ctx->last_client = client; > > + > > + if (client == ctx->i2c.tcpc_client) > > + offset = RSVD_00_ADDR; > > + else if (client == ctx->i2c.tx_p0_client) > > + offset = RSVD_D1_ADDR; > > + else if (client == ctx->i2c.tx_p1_client) > > + offset = RSVD_60_ADDR; > > + else if (client == ctx->i2c.rx_p0_client) > > + offset = RSVD_39_ADDR; > > + else if (client == ctx->i2c.rx_p1_client) > > + offset = RSVD_7F_ADDR; > > + else > > + offset = RSVD_00_ADDR; > > + > > + ret = i2c_smbus_write_byte_data(client, offset, 0x00); > > + if (ret < 0) > > + DRM_DEV_ERROR(dev, > > + "fail to access i2c id=%x\n:%x", > > + client->addr, offset); > > + > > + return ret; > > +} > > + > > +static int anx7625_reg_read(struct anx7625_data *ctx, > > + struct i2c_client *client, u8 reg_addr) > > +{ > > + int ret; > > + struct device *dev = &client->dev; > > + > > + i2c_access_workaround(ctx, client); > > + > > + ret = i2c_smbus_read_byte_data(client, reg_addr); > > + if (ret < 0) > > + DRM_DEV_ERROR(dev, "read i2c fail id=%x:%x\n", > > + client->addr, reg_addr); > > + > > + return ret; > > +} > > + > > +static int anx7625_reg_block_read(struct anx7625_data *ctx, > > + struct i2c_client *client, > > + u8 reg_addr, u8 len, u8 *buf) > > +{ > > + int ret; > > + struct device *dev = &client->dev; > > +
[v2] drm/bridge: ti-sn65dsi86: ensure bridge suspend happens during PM sleep
ti-sn65dsi86 bridge is enumerated as a runtime device. Adding sleep ops to force runtime_suspend when PM suspend is requested on the device. Signed-off-by: Harigovindan P --- Changes in v2: - Include bridge name in the commit message and remove dependent patchwork link from the commit text as bridge is independent of OEM(Stephen Boyd) drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 6ad688b320ae..2eef755b2917 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -159,6 +159,8 @@ static int __maybe_unused ti_sn_bridge_suspend(struct device *dev) static const struct dev_pm_ops ti_sn_bridge_pm_ops = { SET_RUNTIME_PM_OPS(ti_sn_bridge_suspend, ti_sn_bridge_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static int status_show(struct seq_file *s, void *data) -- 2.27.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 09/13] device core: Introduce multiple dma pfn offsets
Hi Jim, On Thu, 2020-06-04 at 10:35 -0400, Jim Quinlan wrote: [...] > > > --- a/arch/sh/kernel/dma-coherent.c > > > +++ b/arch/sh/kernel/dma-coherent.c > > > @@ -14,6 +14,8 @@ void *arch_dma_alloc(struct device *dev, size_t size, > > > dma_addr_t *dma_handle, > > > { > > > void *ret, *ret_nocache; > > > int order = get_order(size); > > > + unsigned long pfn; > > > + phys_addr_t phys; > > > > > > gfp |= __GFP_ZERO; > > > > > > @@ -34,11 +36,14 @@ void *arch_dma_alloc(struct device *dev, size_t size, > > > dma_addr_t *dma_handle, > > > return NULL; > > > } > > > > > > - split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order); > > > + phys = virt_to_phys(ret); > > > + pfn = phys >> PAGE_SHIFT; > > > > nit: not sure it really pays off to have a pfn variable here. > Did it for readability; the compiler's optimization should take care > of any extra variables. But I can switch if you insist. No need. [...] > > > diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > > b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > > index 055eb0b8e396..2d66d415b6c3 100644 > > > --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > > +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > > @@ -898,7 +898,10 @@ static int sun6i_csi_probe(struct platform_device > > > *pdev) > > > > > > sdev->dev = &pdev->dev; > > > /* The DMA bus has the memory mapped at 0 */ > > > - sdev->dev->dma_pfn_offset = PHYS_OFFSET >> PAGE_SHIFT; > > > + ret = attach_uniform_dma_pfn_offset(sdev->dev, > > > + PHYS_OFFSET >> PAGE_SHIFT); > > > + if (ret) > > > + return ret; > > > > > > ret = sun6i_csi_resource_request(sdev, pdev); > > > if (ret) > > > diff --git a/drivers/of/address.c b/drivers/of/address.c > > > index 96d8cfb14a60..c89333b0a5fb 100644 > > > --- a/drivers/of/address.c > > > +++ b/drivers/of/address.c > > > @@ -918,6 +918,70 @@ void __iomem *of_io_request_and_map(struct > > > device_node > > > *np, int index, > > > } > > > EXPORT_SYMBOL(of_io_request_and_map); > > > > > > +static int attach_dma_pfn_offset_map(struct device *dev, > > > + struct device_node *node, int > > > num_ranges) > > > > As with the previous review, please take this comment with a grain of salt. > > > > I think there should be a clear split between what belongs to OF and what > > belongs to the core device infrastructure. > > > > OF's job should be to parse DT and provide a list/array of ranges, whereas > > the > > core device infrastructure should provide an API to assign a list of > > ranges/offset to a device. > > > > As a concrete example, you're forcing devices like the sta2x11 to build with > > OF > > support, which, being an Intel device, it's pretty odd. But I'm also > > thinking > > of how will all this fit once an ACPI device wants to use it. > To fix this I only have to move attach_uniform_dma_pfn_offset() from > of/address.c to say include/linux/dma-mapping.h. It has no > dependencies on OF. Do you agree? Yes that seems nicer. In case you didn't had it in mind already, I'd change the function name to match the naming scheme they use there. On the other hand, I'd also move the non OF parts of the non unifom dma_offset version of the function there. > > Expanding on this idea, once you have a split between the OF's and device > > core > > roles, it transpires that of_dma_get_range()'s job should only be to provide > > the ranges in a device understandable structure and of_dma_configre()'s to > > actually assign the device's parameters. This would obsolete patch #7. > > I think you mean patch #8. Yes, my bad. > I agree with you. The reason I needed a "struct device *" in the call is > because I wanted to make sure the memory that is alloc'd belongs to the > device that needs it. If I do a regular kzalloc(), this memory will become > a leak once someone starts unbinding/binding their device. Also, in all > uses of of_dma_rtange() -- there is only one -- a dev is required as one > can't attach an offset map to NULL. > > I do see that there are a number of functions in drivers/of/*.c that > take 'struct device *dev' as an argument so there is precedent for > something like this. Regardless, I need an owner to the memory I > alloc(). I understand the need for dev to be around, devm_*() is key. But also it's important to keep the functions on purpose. And if of_dma_get_range() starts setting ranges it calls, for the very least, for a function rename. Although I'd rather split the parsing and setting of ranges as mentioned earlier. That said, I get that's a more drastic move. Talking about drastic moves. How about getting rid of the concept of dma_pfn_offset for drivers altogether. Let them provide dma_pfn_offset_regions (even when there is only one). I feel it's conceptually nicer, as you'd be dealing only in
Re: [PATCH v2 0/6] seqlock: seqcount_t call sites bugfixes
On Thu, Jun 04, 2020 at 09:28:41AM +0200, Daniel Vetter wrote: > On Wed, Jun 03, 2020 at 04:49:43PM +0200, Ahmed S. Darwish wrote: > > Hi, > > > > Since patch #7 and #8 from the series: > > > >[PATCH v1 00/25] seqlock: Extend seqcount API with associated locks > > > > https://lore.kernel.org/lkml/20200519214547.352050-1-a.darw...@linutronix.de > > > > are now pending on the lockdep/x86 IRQ state tracking patch series: > > > >[PATCH 00/14] x86/entry: disallow #DB more and x86/entry lockdep/nmi > >https://lkml.kernel.org/r/20200529212728.795169...@infradead.org > > > >[PATCH v3 0/5] lockdep: Change IRQ state tracking to use per-cpu > > variables > >https://lkml.kernel.org/r/20200529213550.683440...@infradead.org > > > > This is a repost only of the seqcount_t call sites bugfixes that were on > > top of the seqlock patch series. > > > > These fixes are independent, and can thus be merged on their own. I'm > > reposting them now so they can at least hit -rc2 or -rc3. > > I'm confused on what I should do with patch 6 here for dma-buf. Looks like > just a good cleanup/prep work, so I'd queue it for linux-next and 5.9, but > sounds like you want this in earlier. Do you need this in 5.8-rc for some > work meant for 5.9? Will this go in through some topic branch directly? > Should I apply it? > > Patch itself lgtm, I'm just confused what I should do with it. > My apologies for the confusion. The cover letter is indeed misleading w.r.t. the dma-buf patch. It isn't a bugfix, so it shouldn't hit -rc. Since without this patch compiling the seqcount series will fail, it will be best to merge it through tip instead. So all I need for now is a reviewed-by tag :) I will forwoard it to the tip tree afterwards. Thanks, -- Ahmed S. Darwish Linutronix GmbH ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
KASAN: vmalloc-out-of-bounds Read in trace_raw_output_sys_enter
Hello, syzbot found the following crash on: HEAD commit:86852175 Merge tag 'armsoc-fixes-v5.7' of git://git.kernel.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=125d79ce10 kernel config: https://syzkaller.appspot.com/x/.config?x=129ea1e5950835e5 dashboard link: https://syzkaller.appspot.com/bug?extid=a2196edd853f2b2eed30 compiler: gcc (GCC) 9.0.0 20181231 (experimental) Unfortunately, I don't have any reproducer for this crash yet. IMPORTANT: if you fix the bug, please add the following tag to the commit: Reported-by: syzbot+a2196edd853f2b2ee...@syzkaller.appspotmail.com == BUG: KASAN: vmalloc-out-of-bounds in trace_raw_output_sys_enter+0x1a8/0x230 include/trace/events/syscalls.h:18 Read of size 8 at addr c90006191510 by task syz-executor.1/3440 CPU: 1 PID: 3440 Comm: syz-executor.1 Not tainted 5.7.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x188/0x20d lib/dump_stack.c:118 print_address_description.constprop.0.cold+0x5/0x413 mm/kasan/report.c:382 __kasan_report.cold+0x20/0x38 mm/kasan/report.c:511 kasan_report+0x33/0x50 mm/kasan/common.c:625 trace_raw_output_sys_enter+0x1a8/0x230 include/trace/events/syscalls.h:18 interrupt_entry+0xb8/0xc0 arch/x86/entry/entry_64.S:578 RIP: 0010:bitfill_aligned drivers/video/fbdev/core/cfbfillrect.c:71 [inline] RIP: 0010:bitfill_aligned+0x11c/0x200 drivers/video/fbdev/core/cfbfillrect.c:35 Code: 89 e7 4c 89 ed e8 b4 04 b4 fd 48 89 5d 00 48 89 5d 08 48 89 5d 10 48 89 5d 18 48 89 5d 20 48 89 5d 28 48 8d 45 38 48 89 5d 30 <48> 83 c5 40 48 89 18 41 83 ef 08 bf 07 00 00 00 44 89 fe e8 ec 05 RSP: 0018:c9000618f480 EFLAGS: 0246 ORIG_RAX: ff13 RAX: 888001007a78 RBX: RCX: c9000a905000 RDX: 0004 RSI: 83bf3b1c RDI: 0005 RBP: 888001007a40 R08: 8880a7aa41c0 R09: 0040 R10: 8880a3ada55f R11: ed101475b4ab R12: 0050 R13: 888001007980 R14: R15: 0038 cfb_fillrect+0x418/0x7a0 drivers/video/fbdev/core/cfbfillrect.c:327 vga16fb_fillrect+0x68f/0x1960 drivers/video/fbdev/vga16fb.c:951 bit_clear_margins+0x2d5/0x4a0 drivers/video/fbdev/core/bitblit.c:232 fbcon_clear_margins+0x1de/0x240 drivers/video/fbdev/core/fbcon.c:1381 fbcon_switch+0xcde/0x16f0 drivers/video/fbdev/core/fbcon.c:2363 redraw_screen+0x2ae/0x770 drivers/tty/vt/vt.c:1015 fbcon_modechanged+0x581/0x720 drivers/video/fbdev/core/fbcon.c:3000 fbcon_set_all_vcs+0x3b3/0x460 drivers/video/fbdev/core/fbcon.c:3038 fbcon_update_vcs+0x26/0x50 drivers/video/fbdev/core/fbcon.c:3045 fb_set_var+0xad0/0xd40 drivers/video/fbdev/core/fbmem.c:1056 do_fb_ioctl+0x390/0x6e0 drivers/video/fbdev/core/fbmem.c:1109 fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1185 vfs_ioctl fs/ioctl.c:47 [inline] ksys_ioctl+0x11a/0x180 fs/ioctl.c:771 __do_sys_ioctl fs/ioctl.c:780 [inline] __se_sys_ioctl fs/ioctl.c:778 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:778 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x49/0xb3 RIP: 0033:0x45ca69 Code: 0d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 db b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:7f4c0e062c78 EFLAGS: 0246 ORIG_RAX: 0010 RAX: ffda RBX: 004e4b00 RCX: 0045ca69 RDX: 2000 RSI: 4601 RDI: 0004 RBP: 0078bf00 R08: R09: R10: R11: 0246 R12: R13: 02f2 R14: 004c5708 R15: 7f4c0e0636d4 Memory state around the buggy address: c90006191400: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 c90006191480: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 >c90006191500: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 ^ c90006191580: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 c90006191600: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 == --- This bug is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more information about syzbot. syzbot engineers can be reached at syzkal...@googlegroups.com. syzbot will keep track of this bug report. See: https://goo.gl/tpsmEJ#status for how to communicate with syzbot. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v6] drm/msm/dpu: ensure device suspend happens during PM sleep
"The PM core always increments the runtime usage counter before calling the ->suspend() callback and decrements it after calling the ->resume() callback" DPU and DSI are managed as runtime devices. When suspend is triggered, PM core adds a refcount on all the devices and calls device suspend, since usage count is already incremented, runtime suspend was not getting called and it kept the clocks on which resulted in target not entering into XO shutdown. Add changes to force suspend on runtime devices during pm sleep. Changes in v1: - Remove unnecessary checks in the function _dpu_kms_disable_dpu (Rob Clark). Changes in v2: - Avoid using suspend_late to reset the usagecount as suspend_late might not be called during suspend call failures (Doug). Changes in v3: - Use force suspend instead of managing device usage_count via runtime put and get API's to trigger callbacks (Doug). Changes in v4: - Check the return values of pm_runtime_force_suspend and pm_runtime_force_resume API's and pass appropriately (Doug). Changes in v5: - With v4 patch, test cycle has uncovered issues in device resume. On bubs: cmd tx failures were seen as SW is sending panel off commands when the dsi resources are turned off. Upon suspend, DRM driver will issue a NULL composition to the dpu, followed by turning off all the HW blocks. v5 changes will serialize the NULL commit and resource unwinding by handling them under PM prepare and PM complete phases there by ensuring that clks are on when panel off commands are being processed. Changes in v6: - Use drm_mode_config_helper_suspend/resume() instead of legacy API drm_atomic_helper_suspend/resume() (Doug). Trigger runtime callbacks from the suspend/resume call to turn off the resources. Signed-off-by: Kalyan Thota --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 + drivers/gpu/drm/msm/dsi/dsi.c | 2 + drivers/gpu/drm/msm/msm_drv.c | 67 - 3 files changed, 37 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index ce19f1d..b886d9d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1123,6 +1123,8 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev) static const struct dev_pm_ops dpu_pm_ops = { SET_RUNTIME_PM_OPS(dpu_runtime_suspend, dpu_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static const struct of_device_id dpu_dt_match[] = { diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 55ea4bc2..62704885 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -161,6 +161,8 @@ static int dsi_dev_remove(struct platform_device *pdev) static const struct dev_pm_ops dsi_pm_ops = { SET_RUNTIME_PM_OPS(msm_dsi_runtime_suspend, msm_dsi_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static struct platform_driver dsi_driver = { diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 7d985f8..da42ff7 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1035,75 +1035,74 @@ static int msm_ioctl_submitqueue_close(struct drm_device *dev, void *data, .patchlevel = MSM_VERSION_PATCHLEVEL, }; -#ifdef CONFIG_PM_SLEEP -static int msm_pm_suspend(struct device *dev) +#ifdef CONFIG_PM +static int msm_runtime_suspend(struct device *dev) { struct drm_device *ddev = dev_get_drvdata(dev); struct msm_drm_private *priv = ddev->dev_private; + struct msm_mdss *mdss = priv->mdss; - if (WARN_ON(priv->pm_state)) - drm_atomic_state_put(priv->pm_state); + DBG(""); - priv->pm_state = drm_atomic_helper_suspend(ddev); - if (IS_ERR(priv->pm_state)) { - int ret = PTR_ERR(priv->pm_state); - DRM_ERROR("Failed to suspend dpu, %d\n", ret); - return ret; - } + if (mdss && mdss->funcs) + return mdss->funcs->disable(mdss); return 0; } -static int msm_pm_resume(struct device *dev) +static int msm_runtime_resume(struct device *dev) { struct drm_device *ddev = dev_get_drvdata(dev); struct msm_drm_private *priv = ddev->dev_private; - int ret; + struct msm_mdss *mdss = priv->mdss; - if (WARN_ON(!priv->pm_state)) - return -ENOENT; + DBG(""); - ret = drm_atomic_helper_resume(ddev, priv->pm_state); - if (!ret) - priv->pm_state = NULL; + if (mdss && mdss->funcs) + return mdss->funcs->enable(mdss); - return ret; + return 0; } #endif -#ifdef CONFIG_PM -static int msm_runtime_suspend(stru
Re: [PATCH v3 09/13] device core: Introduce multiple dma pfn offsets
Hi Jim, On Wed, 2020-06-03 at 15:20 -0400, Jim Quinlan wrote: > The new field in struct device 'dma_pfn_offset_map' is used to facilitate > the use of multiple pfn offsets between cpu addrs and dma addrs. It > subsumes the role of dev->dma_pfn_offset -- a uniform offset -- and > designates the single offset a special case. > > of_dma_configure() is the typical manner to set pfn offsets but there > are a number of ad hoc assignments to dev->dma_pfn_offset in the > kernel code. These cases now invoke the function > attach_uniform_dma_pfn_offset(dev, pfn_offset). > > Signed-off-by: Jim Quinlan > --- > arch/arm/include/asm/dma-mapping.h| 9 +- > arch/arm/mach-keystone/keystone.c | 9 +- > arch/sh/drivers/pci/pcie-sh7786.c | 3 +- > arch/sh/kernel/dma-coherent.c | 17 ++-- > arch/x86/pci/sta2x11-fixup.c | 7 +- > drivers/acpi/arm64/iort.c | 5 +- > drivers/gpu/drm/sun4i/sun4i_backend.c | 7 +- > drivers/iommu/io-pgtable-arm.c| 2 +- > .../platform/sunxi/sun4i-csi/sun4i_csi.c | 5 +- > .../platform/sunxi/sun6i-csi/sun6i_csi.c | 5 +- > drivers/of/address.c | 93 +-- > drivers/of/device.c | 8 +- > drivers/remoteproc/remoteproc_core.c | 2 +- > .../staging/media/sunxi/cedrus/cedrus_hw.c| 7 +- > drivers/usb/core/message.c| 4 +- > drivers/usb/core/usb.c| 2 +- > include/linux/device.h| 4 +- > include/linux/dma-direct.h| 16 +++- > include/linux/dma-mapping.h | 45 + > kernel/dma/coherent.c | 11 ++- > 20 files changed, 210 insertions(+), 51 deletions(-) > > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma- > mapping.h > index bdd80ddbca34..f1e72f99468b 100644 > --- a/arch/arm/include/asm/dma-mapping.h > +++ b/arch/arm/include/asm/dma-mapping.h > @@ -35,8 +35,9 @@ static inline const struct dma_map_ops > *get_arch_dma_ops(struct bus_type *bus) > #ifndef __arch_pfn_to_dma > static inline dma_addr_t pfn_to_dma(struct device *dev, unsigned long pfn) > { > - if (dev) > - pfn -= dev->dma_pfn_offset; > + if (dev && dev->dma_pfn_offset_map) Would it make sense to move the dev->dma_pfn_offset_map check into dma_pfn_offset_from_phys_addr() and return 0 if not available? Same for the opposite variant of the function. I think it'd make the code a little simpler on some of the use cases, and overall less error prone if anyone starts using the function elsewhere. > + pfn -= dma_pfn_offset_from_phys_addr(dev, PFN_PHYS(pfn)); > + > return (dma_addr_t)__pfn_to_bus(pfn); > } > > @@ -44,8 +45,8 @@ static inline unsigned long dma_to_pfn(struct device *dev, > dma_addr_t addr) > { > unsigned long pfn = __bus_to_pfn(addr); > > - if (dev) > - pfn += dev->dma_pfn_offset; > + if (dev && dev->dma_pfn_offset_map) > + pfn += dma_pfn_offset_from_dma_addr(dev, addr); > > return pfn; > } > diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach- > keystone/keystone.c > index 638808c4e122..e7d3ee6e9cb5 100644 > --- a/arch/arm/mach-keystone/keystone.c > +++ b/arch/arm/mach-keystone/keystone.c > @@ -8,6 +8,7 @@ > */ > #include > #include > +#include > #include > #include > #include > @@ -38,9 +39,11 @@ static int keystone_platform_notifier(struct notifier_block > *nb, > return NOTIFY_BAD; > > if (!dev->of_node) { > - dev->dma_pfn_offset = keystone_dma_pfn_offset; > - dev_err(dev, "set dma_pfn_offset%08lx\n", > - dev->dma_pfn_offset); > + int ret = attach_uniform_dma_pfn_offset > + (dev, keystone_dma_pfn_offset); > + > + dev_err(dev, "set dma_pfn_offset%08lx%s\n", > + dev->dma_pfn_offset, ret ? " failed" : ""); > } > return NOTIFY_OK; > } > diff --git a/arch/sh/drivers/pci/pcie-sh7786.c b/arch/sh/drivers/pci/pcie- > sh7786.c > index e0b568aaa701..2e832a5c58c1 100644 > --- a/arch/sh/drivers/pci/pcie-sh7786.c > +++ b/arch/sh/drivers/pci/pcie-sh7786.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -487,7 +488,7 @@ int pcibios_map_platform_irq(const struct pci_dev *pdev, > u8 slot, u8 pin) > > void pcibios_bus_add_device(struct pci_dev *pdev) > { > - pdev->dev.dma_pfn_offset = dma_pfn_offset; > + attach_uniform_dma_pfn_offset(&pdev->dev, dma_pfn_offset); > } > > static int __init sh7786_pcie_core_init(void) > diff --git a/arch/sh/kernel/dma-coherent.c b/arch/sh/kernel/dma-coherent.c > index d4811691b93c..5fc9e358b6c7 100644 > --- a/arch/sh/kernel/dma-coherent.c > +++ b/arch/sh/kernel/dma-coherent.c > @@ -14,6 +14,8 @@ void
[PATCH v3 02/43] drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro
Rename the macro to DRM_GEM_CMA_DRIVER_OPS_VMAP to align naming with SHMEM helpers and drm_gem_cma_prime_import_sg_table_vmap(). An variant of the macro is provided for drivers that override the default .dumb_create callback. Adapt drivers to the changes. v3: * rename macro to signal implicit vmap on imported buffers v2: * provide DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE Signed-off-by: Thomas Zimmermann Reviewed-by: Sam Ravnborg Reviewed-by: Laurent Pinchart Acked-by: Emil Velikov --- drivers/gpu/drm/drm_gem_cma_helper.c | 2 +- drivers/gpu/drm/sun4i/sun4i_drv.c| 3 +-- drivers/gpu/drm/tidss/tidss_drv.c| 2 +- drivers/gpu/drm/tiny/hx8357d.c | 2 +- drivers/gpu/drm/tiny/ili9225.c | 2 +- drivers/gpu/drm/tiny/ili9341.c | 2 +- drivers/gpu/drm/tiny/ili9486.c | 2 +- drivers/gpu/drm/tiny/mi0283qt.c | 2 +- drivers/gpu/drm/tiny/repaper.c | 2 +- drivers/gpu/drm/tiny/st7586.c| 2 +- drivers/gpu/drm/tiny/st7735r.c | 2 +- include/drm/drm_gem_cma_helper.h | 30 12 files changed, 37 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index 842e2fa332354..06a5b9ee1fe07 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -620,7 +620,7 @@ EXPORT_SYMBOL(drm_gem_cma_create_object_default_funcs); * address set. This address is released when the object is freed. * * This function can be used as the &drm_driver.gem_prime_import_sg_table - * callback. The DRM_GEM_CMA_VMAP_DRIVER_OPS() macro provides a shortcut to set + * callback. The &DRM_GEM_CMA_DRIVER_OPS_VMAP macro provides a shortcut to set * the necessary DRM driver operations. * * Returns: diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 328272ff77d84..29861fc81b35f 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -52,8 +52,7 @@ static struct drm_driver sun4i_drv_driver = { .minor = 0, /* GEM Operations */ - DRM_GEM_CMA_VMAP_DRIVER_OPS, - .dumb_create= drm_sun4i_gem_dumb_create, + DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE(drm_sun4i_gem_dumb_create), }; static int sun4i_drv_bind(struct device *dev) diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c index 99edc66ebdef2..fee2f6fa35069 100644 --- a/drivers/gpu/drm/tidss/tidss_drv.c +++ b/drivers/gpu/drm/tidss/tidss_drv.c @@ -112,7 +112,7 @@ static struct drm_driver tidss_driver = { .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .fops = &tidss_fops, .release= tidss_release, - DRM_GEM_CMA_VMAP_DRIVER_OPS, + DRM_GEM_CMA_DRIVER_OPS_VMAP, .name = "tidss", .desc = "TI Keystone DSS", .date = "20180215", diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c index b4bc358a3269a..0998309b0d958 100644 --- a/drivers/gpu/drm/tiny/hx8357d.c +++ b/drivers/gpu/drm/tiny/hx8357d.c @@ -196,7 +196,7 @@ DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops); static struct drm_driver hx8357d_driver = { .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .fops = &hx8357d_fops, - DRM_GEM_CMA_VMAP_DRIVER_OPS, + DRM_GEM_CMA_DRIVER_OPS_VMAP, .debugfs_init = mipi_dbi_debugfs_init, .name = "hx8357d", .desc = "HX8357D", diff --git a/drivers/gpu/drm/tiny/ili9225.c b/drivers/gpu/drm/tiny/ili9225.c index d1a5ab6747d5c..16400064320f3 100644 --- a/drivers/gpu/drm/tiny/ili9225.c +++ b/drivers/gpu/drm/tiny/ili9225.c @@ -346,7 +346,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops); static struct drm_driver ili9225_driver = { .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .fops = &ili9225_fops, - DRM_GEM_CMA_VMAP_DRIVER_OPS, + DRM_GEM_CMA_DRIVER_OPS_VMAP, .name = "ili9225", .desc = "Ilitek ILI9225", .date = "20171106", diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c index bb819f45a5d3b..d39c39df56ada 100644 --- a/drivers/gpu/drm/tiny/ili9341.c +++ b/drivers/gpu/drm/tiny/ili9341.c @@ -152,7 +152,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops); static struct drm_driver ili9341_driver = { .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .fops = &ili9341_fops, - DRM_GEM_CMA_VMAP_DRIVER_OPS, + DRM_GEM_CMA_DRIVER_OPS_VMAP, .debugfs_init = mipi_dbi_debugfs_init, .name = "ili9341", .desc = "Ilitek ILI9341", diff --git a/drivers/gpu/
[PATCH v3 00/43] Convert most CMA-based drivers to GEM object functions
Most of the CMA-based drivers use the default implementation for the callbacks in struct drm_driver. With this patch, these interfaces are initialized with a common helper macro and GEM object functions replace several deprecated interfaces. To address Laurent's comment on the amount of changes per patch, I re- organized the series. 1) There are now DRIVER_OPS macros for drivers that require a virtual address on imported buffers, and macros for drivers that don't. Therefore, drivers don't switch to drm_gem_cma_prime_import_sg_table_vmap() implicitly when they begin using the DRIVER_OPS macro. 2) I split each driver's patch into two: the first converts the driver to GEM CMA object functions, the second introduces the DRIVER_OPS macro. Neither patch should result in a functional change. I kept existing R-b and A-b tags on both patches. Existing Tested-by tags are only on the final patch, as that's closest to what has been tested. 3) I dropped the conversion to drm_gem_prime_mmap() from the patchset. As part of this change, the CMA object functions could provide an mmap function, which is worth it's own series. The patch for aspeed requires drm_gem_prime_mmap(), so I removed it from the series. Patches 1 to 3 update the existing macro and helper to similar naming as with SHMEM, add a new DRIVER_OPS macro, and add helpers for drivers that override the default implementation for .dumb_create(). The remaining patches up to the final one convert the drivers. The kirin driver also changes to the default dumb_create function. The final patch deletes .gem_print_info from struct drm_driver. I don't have much of the hardware, so it's only compile-tested on aarch64, arm and x86-64 only. Several patches have Tested-by tags. v3: * reorganized the series * split each driver patch into two small ones (Laurent) * drop the conversion to drm_gem_prime_mmap() * remove the patch for aspeed v2: * add more detailed commit messages (Laurent, Sam) * use default .dumb_create implementation in kirin (Emil) * fix zte build error (Sam, Emil) * introduce DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE (everyone) Thomas Zimmermann (43): drm/cma-helper: Rename symbols from drm_cma_gem_ to drm_gem_cma_ drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macro drm/cma-helper: Add DRM_GEM_CMA_DRIVER_OPS to set default GEM CMA functions drm/arc: Use GEM CMA object functions drm/arc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/arm: Use GEM CMA object functions drm/arm: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/atmel-hlcdc: Use GEM CMA object functions drm/atmel-hlcdc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/fsl-dcu: Use GEM CMA object functions drm/fsl-dcu: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/hisilicon/kirin: Set .dumb_create to drm_gem_cma_dumb_create() drm/hisilicon/kirin: Use GEM CMA object functions drm/hisilicon/kirin: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/imx: Use GEM CMA object functions drm/imx: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/ingenic: Use GEM CMA object functions drm/ingenic: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/komeda: Use GEM CMA object functions drm/komeda: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE drm/malidp: Use GEM CMA object functions drm/malidp: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE drm/mcde: Use GEM CMA object functions drm/mcde: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/meson: Use GEM CMA object functions drm/meson: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE drm/mxsfb: Use GEM CMA object functions drm/mxsfb: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/rcar-du: Use GEM CMA object functions drm/rcar-du: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE drm/shmobile: Use GEM CMA object functions drm/shmobile: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/stm: Use GEM CMA object functions drm/stm: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE drm/sti: Use GEM CMA object functions drm/sti: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/tilcdc: Use GEM CMA object functions drm/tilcdc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/tve200: Use GEM CMA object functions drm/tve200: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm/zte: Use GEM CMA object functions drm/zte: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS drm: Remove struct drm_driver.gem_print_info drivers/gpu/drm/arc/arcpgu_drv.c | 12 +-- .../gpu/drm/arm/display/komeda/komeda_kms.c | 11 +-- drivers/gpu/drm/arm/hdlcd_drv.c | 12 +-- drivers/gpu/drm/arm/malidp_drv.c | 11 +-- drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 2 +- drivers/gpu/
[PATCH v3 06/43] drm/arm: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Liviu Dudau Acked-by: Emil Velikov --- drivers/gpu/drm/arm/hdlcd_drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index 194419f47c5e5..dd4db48ff6361 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -240,16 +240,11 @@ static struct drm_driver hdlcd_driver = { .irq_preinstall = hdlcd_irq_preinstall, .irq_postinstall = hdlcd_irq_postinstall, .irq_uninstall = hdlcd_irq_uninstall, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_print_info = drm_gem_cma_print_info, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create = drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, #ifdef CONFIG_DEBUG_FS .debugfs_init = hdlcd_debugfs_init, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 07/43] drm/arm: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Acked-by: Liviu Dudau Acked-by: Emil Velikov --- drivers/gpu/drm/arm/hdlcd_drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index dd4db48ff6361..c83b81a3a582a 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -240,12 +240,7 @@ static struct drm_driver hdlcd_driver = { .irq_preinstall = hdlcd_irq_preinstall, .irq_postinstall = hdlcd_irq_postinstall, .irq_uninstall = hdlcd_irq_uninstall, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create = drm_gem_cma_dumb_create, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS, #ifdef CONFIG_DEBUG_FS .debugfs_init = hdlcd_debugfs_init, #endif -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 05/43] drm/arc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/arc/arcpgu_drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 64ddd998aa44b..f164818ec477a 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -154,12 +154,7 @@ static struct drm_driver arcpgu_drm_driver = { .minor = 0, .patchlevel = 0, .fops = &arcpgu_drm_ops, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create = drm_gem_cma_dumb_create, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS, #ifdef CONFIG_DEBUG_FS .debugfs_init = arcpgu_debugfs_init, #endif -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 13/43] drm/hisilicon/kirin: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov Cc: Xu YiPing Cc: Rongrong Zou Cc: Xinliang Liu --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 18e57e571e054..a550e464153b6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -921,15 +921,11 @@ DEFINE_DRM_GEM_CMA_FOPS(ade_fops); static struct drm_driver ade_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .fops = &ade_fops, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create = drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, .name = "kirin", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 01/43] drm/cma-helper: Rename symbols from drm_cma_gem_ to drm_gem_cma_
This fixes the naming of several symbols within CMA helpers. No functional changes are made. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 2 +- drivers/gpu/drm/drm_gem_cma_helper.c| 10 +- include/drm/drm_gem_cma_helper.h| 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c index 6b27242b9ee3c..5e7ea0459d018 100644 --- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c +++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c @@ -188,7 +188,7 @@ DEFINE_DRM_GEM_CMA_FOPS(fops); static struct drm_driver aspeed_gfx_driver = { .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, - .gem_create_object = drm_cma_gem_create_object_default_funcs, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create= drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index b3db3ca7bd7a7..842e2fa332354 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -572,7 +572,7 @@ void drm_gem_cma_prime_vunmap(struct drm_gem_object *obj, void *vaddr) } EXPORT_SYMBOL_GPL(drm_gem_cma_prime_vunmap); -static const struct drm_gem_object_funcs drm_cma_gem_default_funcs = { +static const struct drm_gem_object_funcs drm_gem_cma_default_funcs = { .free = drm_gem_cma_free_object, .print_info = drm_gem_cma_print_info, .get_sg_table = drm_gem_cma_prime_get_sg_table, @@ -581,7 +581,7 @@ static const struct drm_gem_object_funcs drm_cma_gem_default_funcs = { }; /** - * drm_cma_gem_create_object_default_funcs - Create a CMA GEM object with a + * drm_gem_cma_create_object_default_funcs - Create a CMA GEM object with a * default function table * @dev: DRM device * @size: Size of the object to allocate @@ -593,7 +593,7 @@ static const struct drm_gem_object_funcs drm_cma_gem_default_funcs = { * A pointer to a allocated GEM object or an error pointer on failure. */ struct drm_gem_object * -drm_cma_gem_create_object_default_funcs(struct drm_device *dev, size_t size) +drm_gem_cma_create_object_default_funcs(struct drm_device *dev, size_t size) { struct drm_gem_cma_object *cma_obj; @@ -601,11 +601,11 @@ drm_cma_gem_create_object_default_funcs(struct drm_device *dev, size_t size) if (!cma_obj) return NULL; - cma_obj->base.funcs = &drm_cma_gem_default_funcs; + cma_obj->base.funcs = &drm_gem_cma_default_funcs; return &cma_obj->base; } -EXPORT_SYMBOL(drm_cma_gem_create_object_default_funcs); +EXPORT_SYMBOL(drm_gem_cma_create_object_default_funcs); /** * drm_gem_cma_prime_import_sg_table_vmap - PRIME import another driver's diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index 947ac95eb24a9..64b7e9d42129a 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -107,7 +107,7 @@ void *drm_gem_cma_prime_vmap(struct drm_gem_object *obj); void drm_gem_cma_prime_vunmap(struct drm_gem_object *obj, void *vaddr); struct drm_gem_object * -drm_cma_gem_create_object_default_funcs(struct drm_device *dev, size_t size); +drm_gem_cma_create_object_default_funcs(struct drm_device *dev, size_t size); /** * DRM_GEM_CMA_VMAP_DRIVER_OPS - CMA GEM driver operations ensuring a virtual @@ -118,7 +118,7 @@ drm_cma_gem_create_object_default_funcs(struct drm_device *dev, size_t size); * imported buffers. */ #define DRM_GEM_CMA_VMAP_DRIVER_OPS \ - .gem_create_object = drm_cma_gem_create_object_default_funcs, \ + .gem_create_object = drm_gem_cma_create_object_default_funcs, \ .dumb_create= drm_gem_cma_dumb_create, \ .prime_handle_to_fd = drm_gem_prime_handle_to_fd, \ .prime_fd_to_handle = drm_gem_prime_fd_to_handle, \ -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 03/43] drm/cma-helper: Add DRM_GEM_CMA_DRIVER_OPS to set default GEM CMA functions
The macro to DRM_GEM_CMA_DRIVER_OPS sets GEM callbacks in struct drm_driver to their defaults for CMA. An variant of the macro is provided for drivers that override the default .dumb_create callback. Adapt drivers to the changes. Signed-off-by: Thomas Zimmermann Reviewed-by: Sam Ravnborg Reviewed-by: Laurent Pinchart Acked-by: Emil Velikov --- include/drm/drm_gem_cma_helper.h | 46 +--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index 2cdf333ae585d..5e1e595c0e72d 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -109,6 +109,42 @@ void drm_gem_cma_prime_vunmap(struct drm_gem_object *obj, void *vaddr); struct drm_gem_object * drm_gem_cma_create_object_default_funcs(struct drm_device *dev, size_t size); +/** + * DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE - CMA GEM driver operations + * @dumb_create_func: callback function for .dumb_create + * + * This macro provides a shortcut for setting the default GEM operations in the + * &drm_driver structure. + * + * This macro is a variant of DRM_GEM_CMA_DRIVER_OPS for drivers that + * override the default implementation of &struct rm_driver.dumb_create. Use + * DRM_GEM_CMA_DRIVER_OPS if possible. Drivers that require a virtual address + * on imported buffers should use + * DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE() instead. + */ +#define DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(dumb_create_func) \ + .gem_create_object = drm_gem_cma_create_object_default_funcs, \ + .dumb_create= (dumb_create_func), \ + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, \ + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, \ + .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, \ + .gem_prime_mmap = drm_gem_cma_prime_mmap + +/** + * DRM_GEM_CMA_DRIVER_OPS - CMA GEM driver operations + * + * This macro provides a shortcut for setting the default GEM operations in the + * &drm_driver structure. + * + * Drivers that come with their own implementation of + * &struct drm_driver.dumb_create should use + * DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE() instead. Use + * DRM_GEM_CMA_DRIVER_OPS if possible. Drivers that require a virtual address + * on imported buffers should use DRM_GEM_CMA_DRIVER_OPS_VMAP instead. + */ +#define DRM_GEM_CMA_DRIVER_OPS \ + DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(drm_gem_cma_dumb_create) + /** * DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE - CMA GEM driver operations *ensuring a virtual address @@ -120,8 +156,10 @@ drm_gem_cma_create_object_default_funcs(struct drm_device *dev, size_t size); * imported buffers. * * This macro is a variant of DRM_GEM_CMA_DRIVER_OPS_VMAP for drivers that - * override the default implementation of &struct rm_driver.dumb_create. Use - * DRM_GEM_CMA_DRIVER_OPS_VMAP if possible. + * override the default implementation of &struct drm_driver.dumb_create. Use + * DRM_GEM_CMA_DRIVER_OPS_VMAP if possible. Drivers that do not require a + * virtual address on imported buffers should use + * DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE() instead. */ #define DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE(dumb_create_func) \ .gem_create_object = drm_gem_cma_create_object_default_funcs, \ @@ -142,7 +180,9 @@ drm_gem_cma_create_object_default_funcs(struct drm_device *dev, size_t size); * Drivers that come with their own implementation of * &struct drm_driver.dumb_create should use * DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE() instead. Use - * DRM_GEM_CMA_DRIVER_OPS_VMAP if possible. + * DRM_GEM_CMA_DRIVER_OPS_VMAP if possible. Drivers that do not require a + * virtual address on imported buffers should use DRM_GEM_CMA_DRIVER_OPS + * instead. */ #define DRM_GEM_CMA_DRIVER_OPS_VMAP \ DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE(drm_gem_cma_dumb_create) -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 11/43] drm/fsl-dcu: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index 113d2e30cf952..abbc1ddbf27f0 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c @@ -141,12 +141,7 @@ static struct drm_driver fsl_dcu_drm_driver = { .irq_handler= fsl_dcu_drm_irq, .irq_preinstall = fsl_dcu_irq_uninstall, .irq_uninstall = fsl_dcu_irq_uninstall, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, - .dumb_create= drm_gem_cma_dumb_create, + DRM_GEM_CMA_DRIVER_OPS, .fops = &fsl_dcu_drm_fops, .name = "fsl-dcu-drm", .desc = "Freescale DCU DRM", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 22/43] drm/malidp: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE
DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE sets the functions in struct drm_driver to their defaults. No functional changes are made. v2: * update for DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE Signed-off-by: Thomas Zimmermann Acked-by: Liviu Dudau Acked-by: Emil Velikov --- drivers/gpu/drm/arm/malidp_drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index a56a93fc7bc2e..cbd35fd305803 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -563,12 +563,7 @@ static void malidp_debugfs_init(struct drm_minor *minor) static struct drm_driver malidp_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create = malidp_dumb_create, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(malidp_dumb_create), #ifdef CONFIG_DEBUG_FS .debugfs_init = malidp_debugfs_init, #endif -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 37/43] drm/tilcdc: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index a5e9ee4c7fbf4..a6582325651bd 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -496,17 +496,12 @@ DEFINE_DRM_GEM_CMA_FOPS(fops); static struct drm_driver tilcdc_driver = { .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .irq_handler= tilcdc_irq, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_print_info = drm_gem_cma_print_info, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create= drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, #ifdef CONFIG_DEBUG_FS .debugfs_init = tilcdc_debugfs_init, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 31/43] drm/shmobile: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c index ae9d6b8d3ca87..e209610d4b8a1 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c @@ -131,14 +131,10 @@ DEFINE_DRM_GEM_CMA_FOPS(shmob_drm_fops); static struct drm_driver shmob_drm_driver = { .driver_features= DRIVER_GEM | DRIVER_MODESET, .irq_handler= shmob_drm_irq, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, .dumb_create= drm_gem_cma_dumb_create, .fops = &shmob_drm_fops, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 29/43] drm/rcar-du: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 3e67cf70f0402..43610d5bf8820 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -476,14 +476,10 @@ DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops); static struct drm_driver rcar_du_driver = { .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, .dumb_create= rcar_du_dumb_create, .fops = &rcar_du_fops, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 16/43] drm/imx: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/imx/imx-drm-core.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index f13e7cd9b7d16..36037b2e65647 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -146,13 +146,7 @@ static const struct drm_ioctl_desc imx_drm_ioctls[] = { static struct drm_driver imx_drm_driver = { .driver_features= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create= drm_gem_cma_dumb_create, - - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS, .ioctls = imx_drm_ioctls, .num_ioctls = ARRAY_SIZE(imx_drm_ioctls), .fops = &imx_drm_driver_fops, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 10/43] drm/fsl-dcu: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index f15d2e7967a3e..113d2e30cf952 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c @@ -141,14 +141,10 @@ static struct drm_driver fsl_dcu_drm_driver = { .irq_handler= fsl_dcu_drm_irq, .irq_preinstall = fsl_dcu_irq_uninstall, .irq_uninstall = fsl_dcu_irq_uninstall, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, .dumb_create= drm_gem_cma_dumb_create, .fops = &fsl_dcu_drm_fops, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 43/43] drm: Remove struct drm_driver.gem_print_info
The .gem_print_info callback in struct drm_driver is obsolete and has no users left. Remove it. Signed-off-by: Thomas Zimmermann Suggested-by: Emil Velikov --- drivers/gpu/drm/drm_gem.c | 2 -- include/drm/drm_drv.h | 17 - 2 files changed, 19 deletions(-) diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index efc0367841e2b..08b3fa27ec406 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -1191,8 +1191,6 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent, if (obj->funcs && obj->funcs->print_info) obj->funcs->print_info(p, indent, obj); - else if (obj->dev->driver->gem_print_info) - obj->dev->driver->gem_print_info(p, indent, obj); } int drm_gem_pin(struct drm_gem_object *obj) diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index bb924cddc09c1..8f110a28b6a23 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -353,23 +353,6 @@ struct drm_driver { */ void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); - /** -* @gem_print_info: -* -* This callback is deprecated in favour of -* &drm_gem_object_funcs.print_info. -* -* If driver subclasses struct &drm_gem_object, it can implement this -* optional hook for printing additional driver specific info. -* -* drm_printf_indent() should be used in the callback passing it the -* indent argument. -* -* This callback is called from drm_gem_print_info(). -*/ - void (*gem_print_info)(struct drm_printer *p, unsigned int indent, - const struct drm_gem_object *obj); - /** * @gem_create_object: constructor for gem objects * -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 18/43] drm/ingenic: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Tested-by: Paul Cercueil Reviewed-by: Paul Cercueil Acked-by: Emil Velikov --- drivers/gpu/drm/ingenic/ingenic-drm.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c index 7f02debaf5a0d..16f0740df507c 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm.c @@ -519,14 +519,7 @@ static struct drm_driver ingenic_drm_driver_data = { .patchlevel = 0, .fops = &ingenic_drm_fops, - - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create= drm_gem_cma_dumb_create, - - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS, .irq_handler= ingenic_drm_irq_handler, }; -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 23/43] drm/mcde: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Reviewed-by: Linus Walleij Acked-by: Emil Velikov --- drivers/gpu/drm/mcde/mcde_drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c index 84f3e2dbd77bd..1a715b9e698ad 100644 --- a/drivers/gpu/drm/mcde/mcde_drv.c +++ b/drivers/gpu/drm/mcde/mcde_drv.c @@ -228,16 +228,12 @@ static struct drm_driver mcde_drm_driver = { .major = 1, .minor = 0, .patchlevel = 0, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create = drm_gem_cma_dumb_create, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, }; -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 36/43] drm/sti: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/sti/sti_drv.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index 1e9dba309f12e..3f54efa360981 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -132,14 +132,8 @@ DEFINE_DRM_GEM_CMA_FOPS(sti_driver_fops); static struct drm_driver sti_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create = drm_gem_cma_dumb_create, .fops = &sti_driver_fops, - - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS, .debugfs_init = sti_drm_dbg_init, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 28/43] drm/mxsfb: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index afdf1e0accba6..47c7dce03da4a 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -356,12 +356,7 @@ static struct drm_driver mxsfb_driver = { .irq_handler= mxsfb_irq_handler, .irq_preinstall = mxsfb_irq_preinstall, .irq_uninstall = mxsfb_irq_preinstall, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create= drm_gem_cma_dumb_create, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS, .fops = &fops, .name = "mxsfb-drm", .desc = "MXSFB Controller DRM", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 41/43] drm/zte: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/zte/zx_drm_drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c index 1141c1ed1ed04..305394923e04c 100644 --- a/drivers/gpu/drm/zte/zx_drm_drv.c +++ b/drivers/gpu/drm/zte/zx_drm_drv.c @@ -36,15 +36,11 @@ DEFINE_DRM_GEM_CMA_FOPS(zx_drm_fops); static struct drm_driver zx_drm_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create = drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, .fops = &zx_drm_fops, .name = "zx-vou", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 04/43] drm/arc: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/arc/arcpgu_drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index c05d001163e0e..64ddd998aa44b 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -154,16 +154,11 @@ static struct drm_driver arcpgu_drm_driver = { .minor = 0, .patchlevel = 0, .fops = &arcpgu_drm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create = drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_print_info = drm_gem_cma_print_info, - .gem_vm_ops = &drm_gem_cma_vm_ops, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, #ifdef CONFIG_DEBUG_FS .debugfs_init = arcpgu_debugfs_init, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 39/43] drm/tve200: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Reviewed-by: Linus Walleij Acked-by: Emil Velikov --- drivers/gpu/drm/tve200/tve200_drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c index 00ba9e5ce1307..f10d5bb1323ca 100644 --- a/drivers/gpu/drm/tve200/tve200_drv.c +++ b/drivers/gpu/drm/tve200/tve200_drv.c @@ -147,16 +147,12 @@ static struct drm_driver tve200_drm_driver = { .major = 1, .minor = 0, .patchlevel = 0, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create = drm_gem_cma_dumb_create, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, }; -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 34/43] drm/stm: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE
DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE sets the functions in struct drm_driver to their defaults. No functional changes are made. v2: * update for DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE Signed-off-by: Thomas Zimmermann Reviewed-by: Philippe Cornu Acked-by: Emil Velikov --- drivers/gpu/drm/stm/drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c index 441c5b2af9698..411103f013e25 100644 --- a/drivers/gpu/drm/stm/drv.c +++ b/drivers/gpu/drm/stm/drv.c @@ -62,12 +62,7 @@ static struct drm_driver drv_driver = { .minor = 0, .patchlevel = 0, .fops = &drv_driver_fops, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create = stm_gem_cma_dumb_create, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(stm_gem_cma_dumb_create), }; static int drv_load(struct drm_device *ddev) -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 38/43] drm/tilcdc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index a6582325651bd..0d74a64432633 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -496,13 +496,7 @@ DEFINE_DRM_GEM_CMA_FOPS(fops); static struct drm_driver tilcdc_driver = { .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .irq_handler= tilcdc_irq, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create= drm_gem_cma_dumb_create, - - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS, #ifdef CONFIG_DEBUG_FS .debugfs_init = tilcdc_debugfs_init, #endif -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 35/43] drm/sti: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/sti/sti_drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index 3f9db3e3f3978..1e9dba309f12e 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -132,17 +132,13 @@ DEFINE_DRM_GEM_CMA_FOPS(sti_driver_fops); static struct drm_driver sti_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create = drm_gem_cma_dumb_create, .fops = &sti_driver_fops, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, .debugfs_init = sti_drm_dbg_init, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 08/43] drm/atmel-hlcdc: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Reviewed-by: Sam Ravnborg Acked-by: Emil Velikov --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index 112aa5066ceed..e028c58f56c93 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c @@ -821,14 +821,10 @@ static struct drm_driver atmel_hlcdc_dc_driver = { .irq_preinstall = atmel_hlcdc_dc_irq_uninstall, .irq_postinstall = atmel_hlcdc_dc_irq_postinstall, .irq_uninstall = atmel_hlcdc_dc_irq_uninstall, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, .dumb_create = drm_gem_cma_dumb_create, .fops = &fops, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 19/43] drm/komeda: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Liviu Dudau Acked-by: Emil Velikov --- drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index 6b85d5f4caa85..af24dca1cab63 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -61,15 +61,11 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data) static struct drm_driver komeda_kms_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .lastclose = drm_fb_helper_lastclose, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create= komeda_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, .fops = &komeda_cma_fops, .name = "komeda", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 24/43] drm/mcde: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Reviewed-by: Linus Walleij Acked-by: Emil Velikov --- drivers/gpu/drm/mcde/mcde_drv.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c index 1a715b9e698ad..d300be5ee463d 100644 --- a/drivers/gpu/drm/mcde/mcde_drv.c +++ b/drivers/gpu/drm/mcde/mcde_drv.c @@ -228,13 +228,7 @@ static struct drm_driver mcde_drm_driver = { .major = 1, .minor = 0, .patchlevel = 0, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create = drm_gem_cma_dumb_create, - - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS, }; static int mcde_drm_bind(struct device *dev) -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 40/43] drm/tve200: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Reviewed-by: Linus Walleij Acked-by: Emil Velikov --- drivers/gpu/drm/tve200/tve200_drv.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c index f10d5bb1323ca..c3aa39bd38ecd 100644 --- a/drivers/gpu/drm/tve200/tve200_drv.c +++ b/drivers/gpu/drm/tve200/tve200_drv.c @@ -147,13 +147,7 @@ static struct drm_driver tve200_drm_driver = { .major = 1, .minor = 0, .patchlevel = 0, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create = drm_gem_cma_dumb_create, - - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS, }; static int tve200_probe(struct platform_device *pdev) -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 25/43] drm/meson: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov Acked-by: Neil Armstrong --- drivers/gpu/drm/meson/meson_drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 4c5aafcec7991..036af6e69bb78 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -99,16 +99,12 @@ static struct drm_driver meson_driver = { /* PRIME Ops */ .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, /* GEM Ops */ + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create= meson_dumb_create, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, /* Misc */ .fops = &fops, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 32/43] drm/shmobile: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c index e209610d4b8a1..26a15c214bd3f 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c @@ -131,12 +131,7 @@ DEFINE_DRM_GEM_CMA_FOPS(shmob_drm_fops); static struct drm_driver shmob_drm_driver = { .driver_features= DRIVER_GEM | DRIVER_MODESET, .irq_handler= shmob_drm_irq, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, - .dumb_create= drm_gem_cma_dumb_create, + DRM_GEM_CMA_DRIVER_OPS, .fops = &shmob_drm_fops, .name = "shmob-drm", .desc = "Renesas SH Mobile DRM", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 27/43] drm/mxsfb: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 497cf443a9afa..afdf1e0accba6 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -356,15 +356,11 @@ static struct drm_driver mxsfb_driver = { .irq_handler= mxsfb_irq_handler, .irq_preinstall = mxsfb_irq_preinstall, .irq_uninstall = mxsfb_irq_preinstall, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create= drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, .fops = &fops, .name = "mxsfb-drm", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 33/43] drm/stm: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Reviewed-by: Philippe Cornu Acked-by: Emil Velikov --- drivers/gpu/drm/stm/drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c index 0f85dd86cafa7..441c5b2af9698 100644 --- a/drivers/gpu/drm/stm/drv.c +++ b/drivers/gpu/drm/stm/drv.c @@ -62,15 +62,11 @@ static struct drm_driver drv_driver = { .minor = 0, .patchlevel = 0, .fops = &drv_driver_fops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create = stm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, }; -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 21/43] drm/malidp: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Liviu Dudau Acked-by: Emil Velikov --- drivers/gpu/drm/arm/malidp_drv.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c index c2507b7d8512b..a56a93fc7bc2e 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -563,15 +563,11 @@ static void malidp_debugfs_init(struct drm_minor *minor) static struct drm_driver malidp_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create = malidp_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, #ifdef CONFIG_DEBUG_FS .debugfs_init = malidp_debugfs_init, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 20/43] drm/komeda: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE
DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE sets the functions in struct drm_driver to their defaults. No functional changes are made. v2: * update for DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE Signed-off-by: Thomas Zimmermann Acked-by: Liviu Dudau Acked-by: Emil Velikov --- drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index af24dca1cab63..1f6682032ca49 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -61,12 +61,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data) static struct drm_driver komeda_kms_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .lastclose = drm_fb_helper_lastclose, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create= komeda_gem_cma_dumb_create, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(komeda_gem_cma_dumb_create), .fops = &komeda_cma_fops, .name = "komeda", .desc = "Arm Komeda Display Processor driver", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 15/43] drm/imx: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/imx/imx-drm-core.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 2e38f1a5cf8da..f13e7cd9b7d16 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -146,16 +146,12 @@ static const struct drm_ioctl_desc imx_drm_ioctls[] = { static struct drm_driver imx_drm_driver = { .driver_features= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create= drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, .ioctls = imx_drm_ioctls, .num_ioctls = ARRAY_SIZE(imx_drm_ioctls), -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 12/43] drm/hisilicon/kirin: Set .dumb_create to drm_gem_cma_dumb_create()
The kirin drivers uses drm_gem_cma_dumb_create_internal() for its .dumb_create implementation. The function is meant for internal use only by drivers that require additional buffer setup. Kirin does not do an additional setup, so convert it over to drm_gem_cma_dumb_create(). Signed-off-by: Thomas Zimmermann Tested-by: John Stultz Acked-by: Emil Velikov Cc: Xu YiPing Cc: Rongrong Zou Cc: Xinliang Liu --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index c339e632522a9..18e57e571e054 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -923,7 +923,7 @@ static struct drm_driver ade_driver = { .fops = &ade_fops, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, - .dumb_create = drm_gem_cma_dumb_create_internal, + .dumb_create = drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 09/43] drm/atmel-hlcdc: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Reviewed-by: Sam Ravnborg Acked-by: Emil Velikov --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index e028c58f56c93..871293d1aeeba 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c @@ -821,12 +821,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = { .irq_preinstall = atmel_hlcdc_dc_irq_uninstall, .irq_postinstall = atmel_hlcdc_dc_irq_postinstall, .irq_uninstall = atmel_hlcdc_dc_irq_uninstall, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, - .dumb_create = drm_gem_cma_dumb_create, + DRM_GEM_CMA_DRIVER_OPS, .fops = &fops, .name = "atmel-hlcdc", .desc = "Atmel HLCD Controller DRM", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 26/43] drm/meson: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE
DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE sets the functions in struct drm_driver to their defaults. No functional changes are made. v2: * update for DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov Acked-by: Neil Armstrong --- drivers/gpu/drm/meson/meson_drv.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 036af6e69bb78..8b9c8dd788c41 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -96,15 +96,8 @@ static struct drm_driver meson_driver = { /* IRQ */ .irq_handler= meson_irq, - /* PRIME Ops */ - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, - - /* GEM Ops */ - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create= meson_dumb_create, + /* CMA Ops */ + DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(meson_dumb_create), /* Misc */ .fops = &fops, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 17/43] drm/ingenic: Use GEM CMA object functions
Create GEM objects with drm_gem_cma_create_object_default_funcs(), which allocates the object and sets CMA's default object functions. Corresponding callbacks in struct drm_driver are cleared. No functional changes are made. Driver and object-function instances use the same callback functions, with the exception of vunmap. The implementation of vunmap is empty and left out in CMA's default object functions. v3: * convert to DRIVER_OPS macro in a separate patch Signed-off-by: Thomas Zimmermann Reviewed-by: Paul Cercueil Acked-by: Emil Velikov --- drivers/gpu/drm/ingenic/ingenic-drm.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c index 55b49a31729bf..7f02debaf5a0d 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm.c @@ -520,16 +520,12 @@ static struct drm_driver ingenic_drm_driver_data = { .fops = &ingenic_drm_fops, + .gem_create_object = drm_gem_cma_create_object_default_funcs, .dumb_create= drm_gem_cma_dumb_create, - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, .irq_handler= ingenic_drm_irq_handler, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 14/43] drm/hisilicon/kirin: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. v2: * use DRM_GEM_CMA_DRIVER_OPS Signed-off-by: Thomas Zimmermann Tested-by: John Stultz Acked-by: Emil Velikov Cc: Xu YiPing Cc: Rongrong Zou Cc: Xinliang Liu --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index a550e464153b6..e1108c1735ad0 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -921,13 +921,7 @@ DEFINE_DRM_GEM_CMA_FOPS(ade_fops); static struct drm_driver ade_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .fops = &ade_fops, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create = drm_gem_cma_dumb_create, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, - + DRM_GEM_CMA_DRIVER_OPS, .name = "kirin", .desc = "Hisilicon Kirin620 SoC DRM Driver", .date = "20150718", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 42/43] drm/zte: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver to their defaults. No functional changes are made. Signed-off-by: Thomas Zimmermann Acked-by: Emil Velikov --- drivers/gpu/drm/zte/zx_drm_drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c index 305394923e04c..31014a451f8bd 100644 --- a/drivers/gpu/drm/zte/zx_drm_drv.c +++ b/drivers/gpu/drm/zte/zx_drm_drv.c @@ -36,12 +36,7 @@ DEFINE_DRM_GEM_CMA_FOPS(zx_drm_fops); static struct drm_driver zx_drm_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .dumb_create = drm_gem_cma_dumb_create, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, + DRM_GEM_CMA_DRIVER_OPS, .fops = &zx_drm_fops, .name = "zx-vou", .desc = "ZTE VOU Controller DRM", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 30/43] drm/rcar-du: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE
DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE sets the functions in struct drm_driver to their defaults. No functional changes are made. v2: * update for DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE Signed-off-by: Thomas Zimmermann Tested-by: Kieran Bingham Acked-by: Emil Velikov --- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 43610d5bf8820..f53b0ec710850 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -476,12 +476,7 @@ DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops); static struct drm_driver rcar_du_driver = { .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, - .gem_create_object = drm_gem_cma_create_object_default_funcs, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_mmap = drm_gem_cma_prime_mmap, - .dumb_create= rcar_du_dumb_create, + DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(rcar_du_dumb_create), .fops = &rcar_du_fops, .name = "rcar-du", .desc = "Renesas R-Car Display Unit", -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/1] drm/mm: add ig_frag selftest
Am 03.06.20 um 12:32 schrieb Nirmoy Das: This patch introduces fragmentation in the address range and measures time taken by 10k and 20k insertions. ig_frag() will fail if the time taken by 20k insertions takes more than 4 times of 10k insertions as we know that insertions should at most scale quadratically. v2: introduce fragmentation by freeing every other node. only test bottom-up and top-down for now. Signed-off-by: Nirmoy Das --- drivers/gpu/drm/selftests/drm_mm_selftests.h | 1 + drivers/gpu/drm/selftests/test-drm_mm.c | 124 +++ 2 files changed, 125 insertions(+) diff --git a/drivers/gpu/drm/selftests/drm_mm_selftests.h b/drivers/gpu/drm/selftests/drm_mm_selftests.h index 6b943ea1c57d..8c87c964176b 100644 --- a/drivers/gpu/drm/selftests/drm_mm_selftests.h +++ b/drivers/gpu/drm/selftests/drm_mm_selftests.h @@ -14,6 +14,7 @@ selftest(insert, igt_insert) selftest(replace, igt_replace) selftest(insert_range, igt_insert_range) selftest(align, igt_align) +selftest(frag, igt_frag) selftest(align32, igt_align32) selftest(align64, igt_align64) selftest(evict, igt_evict) diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c index 9aabe82dcd3a..34231baacd87 100644 --- a/drivers/gpu/drm/selftests/test-drm_mm.c +++ b/drivers/gpu/drm/selftests/test-drm_mm.c @@ -10,6 +10,7 @@ #include #include #include +#include #include @@ -1033,6 +1034,129 @@ static int igt_insert_range(void *ignored) return 0; } +static int prepare_igt_frag(struct drm_mm *mm, + struct drm_mm_node *nodes, + unsigned int num_insert, + const struct insert_mode *mode) +{ + unsigned int size = 4096; + unsigned int i; + u64 ret = -EINVAL; + + for (i = 0; i < num_insert; i++) { + if (!expect_insert(mm, &nodes[i], size, 0, i, + mode) != 0) { + pr_err("%s insert failed\n", mode->name); + goto out; + } + } + + /* introduce fragmentation by freeing every other node */ + for (i = 0; i < num_insert; i++) { + if (i % 2 == 0) + drm_mm_remove_node(&nodes[i]); + } + +out: + return ret; + +} + +static u64 get_insert_time(struct drm_mm *mm, + unsigned int num_insert, + struct drm_mm_node *nodes, + const struct insert_mode *mode) +{ + unsigned int size = 8192; + ktime_t start; + unsigned int i; + u64 ret = -EINVAL; + + start = ktime_get(); + for (i = 0; i < num_insert; i++) { + if (!expect_insert(mm, &nodes[i], size, 0, i, mode) != 0) { + pr_err("%s insert failed\n", mode->name); + goto out; + } + } + + ret = ktime_to_ns(ktime_sub(ktime_get(), start)); + +out: + return ret; + +} + +static int igt_frag(void *ignored) +{ + struct drm_mm mm; + const struct insert_mode *mode; + struct drm_mm_node *nodes, *node, *next; + unsigned int insert_size = 1; + unsigned int scale_factor = 4; + int ret = -EINVAL; + + /* We need 4 * insert_size nodes to hold intermediate allocated +* drm_mm nodes. +* 1 times for prepare_igt_frag() +* 1 times for get_insert_time() +* 2 times for get_insert_time() +*/ + nodes = vzalloc(array_size(insert_size * 4, sizeof(*nodes))); + if (!nodes) + return -ENOMEM; + + /* For BOTTOMUP and TOPDOWN, we first fragment the +* address space using prepare_igt_frag() and then try to verify +* that that insertions scale quadratically from 10k to 20k insertions +*/ + drm_mm_init(&mm, 1, U64_MAX - 2); + for (mode = insert_modes; mode->name; mode++) { + u64 insert_time1, insert_time2; + + if (mode->mode != DRM_MM_INSERT_LOW || + mode->mode != DRM_MM_INSERT_HIGH) + continue; This check here is wrong, that needs to be && instead of || or the test wouldn't execute at all. Christian. + + ret = prepare_igt_frag(&mm, nodes, insert_size, mode); + if (!ret) + goto err; + + insert_time1 = get_insert_time(&mm, insert_size, + nodes + insert_size, mode); + if (insert_time1 < 0) + goto err; + + insert_time2 = get_insert_time(&mm, (insert_size * 2), + nodes + insert_size * 2, mode); + if (insert_time2 < 0) + goto err; + + pr_info("%s fragmented insert of %u and %u insertions took %llu and %llu nsecs\n", +
Re: Dynamically change enumeration list of DRM enumeration property
On Wed, 03 Jun 2020 20:20:44 + (UTC) Jonas Karlman wrote: > Hi, > > On 2020-06-03 11:12, Pekka Paalanen wrote: > > On Wed, 3 Jun 2020 10:50:28 +0530 > > Yogish Kulkarni wrote: > > ... > >> The primary reason for why content producer masters video/gfx content as > >> limited range is for compatibility with sinks which only support limited > >> range, and not because video decoders are not capable of decoding > >> full-range content. > > > > What I was asking is, even if the video content is limited range, why > > would one not decode it into full-range pixels always and if the sink > > need limited range, then convert again in hardware? When done right, it > > makes no difference in output compared to using limited range > > through-out if both content and sink use limited range. > > For the Allwinner/Amlogic/Rockchip arm devices I mainly play with the > video decoder does not support range conversion (to my knowledge) and will > produce NV12/YU12 framebuffers in the range the video was encoded in. > > These devices typically lack a high-performance GPU/3D-accelerator > and may have limited CSC capabilities in the display controller. > The HDMI block can usually do simple RGB/YUV and full/limited conversions, > but using these conversions typically produce banding effects. > > Being able to passthrough decoded framebuffers in the entire pipeline from > decoder, display controller and hdmi block typically produce best results. This is very helpful. It means I really do need to take range into account in Wayland protocol and make sure it can be communicated. Thanks, pq pgpepNdQ3HDtN.pgp Description: OpenPGP digital signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 32/43] drm/shmobile: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS
Hi Thomas, Thank you for the patch. On Fri, Jun 05, 2020 at 09:32:36AM +0200, Thomas Zimmermann wrote: > DRM_GEM_CMA_DRIVER_OPS sets the functions in struct drm_driver > to their defaults. No functional changes are made. > > Signed-off-by: Thomas Zimmermann > Acked-by: Emil Velikov Reviewed-by: Laurent Pinchart > --- > drivers/gpu/drm/shmobile/shmob_drm_drv.c | 7 +-- > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c > b/drivers/gpu/drm/shmobile/shmob_drm_drv.c > index e209610d4b8a1..26a15c214bd3f 100644 > --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c > +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c > @@ -131,12 +131,7 @@ DEFINE_DRM_GEM_CMA_FOPS(shmob_drm_fops); > static struct drm_driver shmob_drm_driver = { > .driver_features= DRIVER_GEM | DRIVER_MODESET, > .irq_handler= shmob_drm_irq, > - .gem_create_object = drm_gem_cma_create_object_default_funcs, > - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, > - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, > - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, > - .gem_prime_mmap = drm_gem_cma_prime_mmap, > - .dumb_create= drm_gem_cma_dumb_create, > + DRM_GEM_CMA_DRIVER_OPS, > .fops = &shmob_drm_fops, > .name = "shmob-drm", > .desc = "Renesas SH Mobile DRM", -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 30/43] drm/rcar-du: Set GEM CMA functions with DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE
Hi Thomas, Thank you for the patch. On Fri, Jun 05, 2020 at 09:32:34AM +0200, Thomas Zimmermann wrote: > DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE sets the functions in > struct drm_driver to their defaults. No functional changes are > made. > > v2: > * update for DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE > > Signed-off-by: Thomas Zimmermann > Tested-by: Kieran Bingham > Acked-by: Emil Velikov Reviewed-by: Laurent Pinchart > --- > drivers/gpu/drm/rcar-du/rcar_du_drv.c | 7 +-- > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > index 43610d5bf8820..f53b0ec710850 100644 > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > @@ -476,12 +476,7 @@ DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops); > > static struct drm_driver rcar_du_driver = { > .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, > - .gem_create_object = drm_gem_cma_create_object_default_funcs, > - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, > - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, > - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, > - .gem_prime_mmap = drm_gem_cma_prime_mmap, > - .dumb_create= rcar_du_dumb_create, > + DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(rcar_du_dumb_create), > .fops = &rcar_du_fops, > .name = "rcar-du", > .desc = "Renesas R-Car Display Unit", -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 03/43] drm/cma-helper: Add DRM_GEM_CMA_DRIVER_OPS to set default GEM CMA functions
Hi Thomas, Thank you for the patch. On Fri, Jun 05, 2020 at 09:32:07AM +0200, Thomas Zimmermann wrote: > The macro to DRM_GEM_CMA_DRIVER_OPS sets GEM callbacks in struct drm_driver > to their defaults for CMA. An variant of the macro is provided for drivers s/An variant/A variant/ > that override the default .dumb_create callback. Adapt drivers to the changes. > > Signed-off-by: Thomas Zimmermann > Reviewed-by: Sam Ravnborg > Reviewed-by: Laurent Pinchart > Acked-by: Emil Velikov > --- > include/drm/drm_gem_cma_helper.h | 46 +--- > 1 file changed, 43 insertions(+), 3 deletions(-) > > diff --git a/include/drm/drm_gem_cma_helper.h > b/include/drm/drm_gem_cma_helper.h > index 2cdf333ae585d..5e1e595c0e72d 100644 > --- a/include/drm/drm_gem_cma_helper.h > +++ b/include/drm/drm_gem_cma_helper.h > @@ -109,6 +109,42 @@ void drm_gem_cma_prime_vunmap(struct drm_gem_object > *obj, void *vaddr); > struct drm_gem_object * > drm_gem_cma_create_object_default_funcs(struct drm_device *dev, size_t size); > > +/** > + * DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE - CMA GEM driver operations > + * @dumb_create_func: callback function for .dumb_create > + * > + * This macro provides a shortcut for setting the default GEM operations in > the > + * &drm_driver structure. > + * > + * This macro is a variant of DRM_GEM_CMA_DRIVER_OPS for drivers that > + * override the default implementation of &struct rm_driver.dumb_create. Use > + * DRM_GEM_CMA_DRIVER_OPS if possible. Drivers that require a virtual address > + * on imported buffers should use > + * DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE() instead. > + */ > +#define DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(dumb_create_func) \ > + .gem_create_object = drm_gem_cma_create_object_default_funcs, \ > + .dumb_create= (dumb_create_func), \ Do we need parentheses here ? > + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, \ > + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, \ > + .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, \ > + .gem_prime_mmap = drm_gem_cma_prime_mmap > + > +/** > + * DRM_GEM_CMA_DRIVER_OPS - CMA GEM driver operations > + * > + * This macro provides a shortcut for setting the default GEM operations in > the > + * &drm_driver structure. > + * > + * Drivers that come with their own implementation of > + * &struct drm_driver.dumb_create should use > + * DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE() instead. Use > + * DRM_GEM_CMA_DRIVER_OPS if possible. Drivers that require a virtual address > + * on imported buffers should use DRM_GEM_CMA_DRIVER_OPS_VMAP instead. > + */ > +#define DRM_GEM_CMA_DRIVER_OPS \ > + DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(drm_gem_cma_dumb_create) > + > /** > * DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE - CMA GEM driver operations > *ensuring a virtual address > @@ -120,8 +156,10 @@ drm_gem_cma_create_object_default_funcs(struct > drm_device *dev, size_t size); > * imported buffers. > * > * This macro is a variant of DRM_GEM_CMA_DRIVER_OPS_VMAP for drivers that > - * override the default implementation of &struct rm_driver.dumb_create. Use > - * DRM_GEM_CMA_DRIVER_OPS_VMAP if possible. > + * override the default implementation of &struct drm_driver.dumb_create. Use > + * DRM_GEM_CMA_DRIVER_OPS_VMAP if possible. Drivers that do not require a > + * virtual address on imported buffers should use > + * DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE() instead. > */ > #define DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE(dumb_create_func) \ > .gem_create_object = drm_gem_cma_create_object_default_funcs, \ > @@ -142,7 +180,9 @@ drm_gem_cma_create_object_default_funcs(struct drm_device > *dev, size_t size); > * Drivers that come with their own implementation of > * &struct drm_driver.dumb_create should use > * DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE() instead. Use > - * DRM_GEM_CMA_DRIVER_OPS_VMAP if possible. > + * DRM_GEM_CMA_DRIVER_OPS_VMAP if possible. Drivers that do not require a > + * virtual address on imported buffers should use DRM_GEM_CMA_DRIVER_OPS > + * instead. > */ > #define DRM_GEM_CMA_DRIVER_OPS_VMAP \ > DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE(drm_gem_cma_dumb_create) > -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/1] drm/mm: add ig_frag selftest
On 6/5/20 9:45 AM, Christian König wrote: Am 03.06.20 um 12:32 schrieb Nirmoy Das: This patch introduces fragmentation in the address range and measures time taken by 10k and 20k insertions. ig_frag() will fail if the time taken by 20k insertions takes more than 4 times of 10k insertions as we know that insertions should at most scale quadratically. v2: introduce fragmentation by freeing every other node. only test bottom-up and top-down for now. Signed-off-by: Nirmoy Das --- drivers/gpu/drm/selftests/drm_mm_selftests.h | 1 + drivers/gpu/drm/selftests/test-drm_mm.c | 124 +++ 2 files changed, 125 insertions(+) diff --git a/drivers/gpu/drm/selftests/drm_mm_selftests.h b/drivers/gpu/drm/selftests/drm_mm_selftests.h index 6b943ea1c57d..8c87c964176b 100644 --- a/drivers/gpu/drm/selftests/drm_mm_selftests.h +++ b/drivers/gpu/drm/selftests/drm_mm_selftests.h @@ -14,6 +14,7 @@ selftest(insert, igt_insert) selftest(replace, igt_replace) selftest(insert_range, igt_insert_range) selftest(align, igt_align) +selftest(frag, igt_frag) selftest(align32, igt_align32) selftest(align64, igt_align64) selftest(evict, igt_evict) diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c index 9aabe82dcd3a..34231baacd87 100644 --- a/drivers/gpu/drm/selftests/test-drm_mm.c +++ b/drivers/gpu/drm/selftests/test-drm_mm.c @@ -10,6 +10,7 @@ #include #include #include +#include #include @@ -1033,6 +1034,129 @@ static int igt_insert_range(void *ignored) return 0; } +static int prepare_igt_frag(struct drm_mm *mm, + struct drm_mm_node *nodes, + unsigned int num_insert, + const struct insert_mode *mode) +{ + unsigned int size = 4096; + unsigned int i; + u64 ret = -EINVAL; + + for (i = 0; i < num_insert; i++) { + if (!expect_insert(mm, &nodes[i], size, 0, i, + mode) != 0) { + pr_err("%s insert failed\n", mode->name); + goto out; + } + } + + /* introduce fragmentation by freeing every other node */ + for (i = 0; i < num_insert; i++) { + if (i % 2 == 0) + drm_mm_remove_node(&nodes[i]); + } + +out: + return ret; + +} + +static u64 get_insert_time(struct drm_mm *mm, + unsigned int num_insert, + struct drm_mm_node *nodes, + const struct insert_mode *mode) +{ + unsigned int size = 8192; + ktime_t start; + unsigned int i; + u64 ret = -EINVAL; + + start = ktime_get(); + for (i = 0; i < num_insert; i++) { + if (!expect_insert(mm, &nodes[i], size, 0, i, mode) != 0) { + pr_err("%s insert failed\n", mode->name); + goto out; + } + } + + ret = ktime_to_ns(ktime_sub(ktime_get(), start)); + +out: + return ret; + +} + +static int igt_frag(void *ignored) +{ + struct drm_mm mm; + const struct insert_mode *mode; + struct drm_mm_node *nodes, *node, *next; + unsigned int insert_size = 1; + unsigned int scale_factor = 4; + int ret = -EINVAL; + + /* We need 4 * insert_size nodes to hold intermediate allocated + * drm_mm nodes. + * 1 times for prepare_igt_frag() + * 1 times for get_insert_time() + * 2 times for get_insert_time() + */ + nodes = vzalloc(array_size(insert_size * 4, sizeof(*nodes))); + if (!nodes) + return -ENOMEM; + + /* For BOTTOMUP and TOPDOWN, we first fragment the + * address space using prepare_igt_frag() and then try to verify + * that that insertions scale quadratically from 10k to 20k insertions + */ + drm_mm_init(&mm, 1, U64_MAX - 2); + for (mode = insert_modes; mode->name; mode++) { + u64 insert_time1, insert_time2; + + if (mode->mode != DRM_MM_INSERT_LOW || + mode->mode != DRM_MM_INSERT_HIGH) + continue; This check here is wrong, that needs to be && instead of || or the test wouldn't execute at all. I didn't bother to check dmesg after adding that "simple" check and the test ran fine. :/ Sending again. Nirmoy Christian. + + ret = prepare_igt_frag(&mm, nodes, insert_size, mode); + if (!ret) + goto err; + + insert_time1 = get_insert_time(&mm, insert_size, + nodes + insert_size, mode); + if (insert_time1 < 0) + goto err; + + insert_time2 = get_insert_time(&mm, (insert_size * 2), + nodes + insert_size * 2, mode); + if (insert_time2 < 0) + goto err; + + pr_info("%s fragmented insert of %u and %u insertions took %llu and %llu nsecs\n", + mode->name, insert_size, insert_size * 2, + insert_time1, insert_time2); + + if (insert_time2 > (scale_factor * insert_time1)) { + pr_err("%s fragmented insert took %llu nsecs more\n", + mode->name, + insert_time2 -
Re: [PATCH v3 31/43] drm/shmobile: Use GEM CMA object functions
Hi Thomas, Thank you for the patch. On Fri, Jun 05, 2020 at 09:32:35AM +0200, Thomas Zimmermann wrote: > Create GEM objects with drm_gem_cma_create_object_default_funcs(), which > allocates the object and sets CMA's default object functions. Corresponding > callbacks in struct drm_driver are cleared. No functional changes are made. > > Driver and object-function instances use the same callback functions, with > the exception of vunmap. The implementation of vunmap is empty and left out > in CMA's default object functions. > > v3: > * convert to DRIVER_OPS macro in a separate patch > > Signed-off-by: Thomas Zimmermann > Acked-by: Emil Velikov Reviewed-by: Laurent Pinchart > --- > drivers/gpu/drm/shmobile/shmob_drm_drv.c | 6 +- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c > b/drivers/gpu/drm/shmobile/shmob_drm_drv.c > index ae9d6b8d3ca87..e209610d4b8a1 100644 > --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c > +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c > @@ -131,14 +131,10 @@ DEFINE_DRM_GEM_CMA_FOPS(shmob_drm_fops); > static struct drm_driver shmob_drm_driver = { > .driver_features= DRIVER_GEM | DRIVER_MODESET, > .irq_handler= shmob_drm_irq, > - .gem_free_object_unlocked = drm_gem_cma_free_object, > - .gem_vm_ops = &drm_gem_cma_vm_ops, > + .gem_create_object = drm_gem_cma_create_object_default_funcs, > .prime_handle_to_fd = drm_gem_prime_handle_to_fd, > .prime_fd_to_handle = drm_gem_prime_fd_to_handle, > - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, > .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, > - .gem_prime_vmap = drm_gem_cma_prime_vmap, > - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, > .gem_prime_mmap = drm_gem_cma_prime_mmap, > .dumb_create= drm_gem_cma_dumb_create, > .fops = &shmob_drm_fops, > -- > 2.26.2 > -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 29/43] drm/rcar-du: Use GEM CMA object functions
Hi Thomas, Thank you for the patch. On Fri, Jun 05, 2020 at 09:32:33AM +0200, Thomas Zimmermann wrote: > Create GEM objects with drm_gem_cma_create_object_default_funcs(), which > allocates the object and sets CMA's default object functions. Corresponding > callbacks in struct drm_driver are cleared. No functional changes are made. > > Driver and object-function instances use the same callback functions, with > the exception of vunmap. The implementation of vunmap is empty and left out > in CMA's default object functions. > > v3: > * convert to DRIVER_OPS macro in a separate patch > > Signed-off-by: Thomas Zimmermann > Acked-by: Emil Velikov Reviewed-by: Laurent Pinchart > --- > drivers/gpu/drm/rcar-du/rcar_du_drv.c | 6 +- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > index 3e67cf70f0402..43610d5bf8820 100644 > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > @@ -476,14 +476,10 @@ DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops); > > static struct drm_driver rcar_du_driver = { > .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, > - .gem_free_object_unlocked = drm_gem_cma_free_object, > - .gem_vm_ops = &drm_gem_cma_vm_ops, > + .gem_create_object = drm_gem_cma_create_object_default_funcs, > .prime_handle_to_fd = drm_gem_prime_handle_to_fd, > .prime_fd_to_handle = drm_gem_prime_fd_to_handle, > - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, > .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, > - .gem_prime_vmap = drm_gem_cma_prime_vmap, > - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, > .gem_prime_mmap = drm_gem_cma_prime_mmap, > .dumb_create= rcar_du_dumb_create, > .fops = &rcar_du_fops, -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 13/18] drm/amdgpu/dc: Stop dma_resv_lock inversion in commit_tail
Hi Daniel, On 04/06/2020 10:12, Daniel Vetter wrote: [...] > @@ -6910,7 +6910,11 @@ static void amdgpu_dm_commit_planes(struct > drm_atomic_state *state, >* explicitly on fences instead >* and in general should be called for >* blocking commit to as per framework helpers > + * > + * Yes, this deadlocks, since you're calling dma_resv_lock in a > + * path that leads to a dma_fence_signal(). Don't do that. >*/ > +#if 0 > r = amdgpu_bo_reserve(abo, true); > if (unlikely(r != 0)) > DRM_ERROR("failed to reserve buffer before flip\n"); > @@ -6920,6 +6924,12 @@ static void amdgpu_dm_commit_planes(struct > drm_atomic_state *state, > tmz_surface = amdgpu_bo_encrypted(abo); > > amdgpu_bo_unreserve(abo); > +#endif > + /* > + * this races anyway, so READ_ONCE isn't any better or worse > + * than the stuff above. Except the stuff above can deadlock. > + */ > + tiling_flags = READ_ONCE(abo->tiling_flags); With this change "tmz_surface" won't be initialized properly. Adding the following line should fix it: tmz_surface = READ_ONCE(abo->flags) & AMDGPU_GEM_CREATE_ENCRYPTED; Pierre-Eric > > fill_dc_plane_info_and_addr( > dm->adev, new_plane_state, tiling_flags, > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 43/43] drm: Remove struct drm_driver.gem_print_info
Hi Thomas, Thank you for the patch. On Fri, Jun 05, 2020 at 09:32:47AM +0200, Thomas Zimmermann wrote: > The .gem_print_info callback in struct drm_driver is obsolete and has > no users left. Remove it. I like code removal :-) Looking forward to the removal of more GEM-related fields from struct drm_driver. > Signed-off-by: Thomas Zimmermann > Suggested-by: Emil Velikov Reviewed-by: Laurent Pinchart > --- > drivers/gpu/drm/drm_gem.c | 2 -- > include/drm/drm_drv.h | 17 - > 2 files changed, 19 deletions(-) > > diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c > index efc0367841e2b..08b3fa27ec406 100644 > --- a/drivers/gpu/drm/drm_gem.c > +++ b/drivers/gpu/drm/drm_gem.c > @@ -1191,8 +1191,6 @@ void drm_gem_print_info(struct drm_printer *p, unsigned > int indent, > > if (obj->funcs && obj->funcs->print_info) > obj->funcs->print_info(p, indent, obj); > - else if (obj->dev->driver->gem_print_info) > - obj->dev->driver->gem_print_info(p, indent, obj); > } > > int drm_gem_pin(struct drm_gem_object *obj) > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index bb924cddc09c1..8f110a28b6a23 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -353,23 +353,6 @@ struct drm_driver { >*/ > void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); > > - /** > - * @gem_print_info: > - * > - * This callback is deprecated in favour of > - * &drm_gem_object_funcs.print_info. > - * > - * If driver subclasses struct &drm_gem_object, it can implement this > - * optional hook for printing additional driver specific info. > - * > - * drm_printf_indent() should be used in the callback passing it the > - * indent argument. > - * > - * This callback is called from drm_gem_print_info(). > - */ > - void (*gem_print_info)(struct drm_printer *p, unsigned int indent, > -const struct drm_gem_object *obj); > - > /** >* @gem_create_object: constructor for gem objects >* -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/1] drm/mm: add ig_frag selftest
Am 05.06.20 um 10:18 schrieb Nirmoy: On 6/5/20 9:45 AM, Christian König wrote: Am 03.06.20 um 12:32 schrieb Nirmoy Das: This patch introduces fragmentation in the address range and measures time taken by 10k and 20k insertions. ig_frag() will fail if the time taken by 20k insertions takes more than 4 times of 10k insertions as we know that insertions should at most scale quadratically. v2: introduce fragmentation by freeing every other node. only test bottom-up and top-down for now. Signed-off-by: Nirmoy Das --- drivers/gpu/drm/selftests/drm_mm_selftests.h | 1 + drivers/gpu/drm/selftests/test-drm_mm.c | 124 +++ 2 files changed, 125 insertions(+) diff --git a/drivers/gpu/drm/selftests/drm_mm_selftests.h b/drivers/gpu/drm/selftests/drm_mm_selftests.h index 6b943ea1c57d..8c87c964176b 100644 --- a/drivers/gpu/drm/selftests/drm_mm_selftests.h +++ b/drivers/gpu/drm/selftests/drm_mm_selftests.h @@ -14,6 +14,7 @@ selftest(insert, igt_insert) selftest(replace, igt_replace) selftest(insert_range, igt_insert_range) selftest(align, igt_align) +selftest(frag, igt_frag) selftest(align32, igt_align32) selftest(align64, igt_align64) selftest(evict, igt_evict) diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c index 9aabe82dcd3a..34231baacd87 100644 --- a/drivers/gpu/drm/selftests/test-drm_mm.c +++ b/drivers/gpu/drm/selftests/test-drm_mm.c @@ -10,6 +10,7 @@ #include #include #include +#include #include @@ -1033,6 +1034,129 @@ static int igt_insert_range(void *ignored) return 0; } +static int prepare_igt_frag(struct drm_mm *mm, + struct drm_mm_node *nodes, + unsigned int num_insert, + const struct insert_mode *mode) +{ + unsigned int size = 4096; + unsigned int i; + u64 ret = -EINVAL; + + for (i = 0; i < num_insert; i++) { + if (!expect_insert(mm, &nodes[i], size, 0, i, + mode) != 0) { + pr_err("%s insert failed\n", mode->name); + goto out; + } + } + + /* introduce fragmentation by freeing every other node */ + for (i = 0; i < num_insert; i++) { + if (i % 2 == 0) + drm_mm_remove_node(&nodes[i]); + } + +out: + return ret; + +} + +static u64 get_insert_time(struct drm_mm *mm, + unsigned int num_insert, + struct drm_mm_node *nodes, + const struct insert_mode *mode) +{ + unsigned int size = 8192; + ktime_t start; + unsigned int i; + u64 ret = -EINVAL; + + start = ktime_get(); + for (i = 0; i < num_insert; i++) { + if (!expect_insert(mm, &nodes[i], size, 0, i, mode) != 0) { + pr_err("%s insert failed\n", mode->name); + goto out; + } + } + + ret = ktime_to_ns(ktime_sub(ktime_get(), start)); + +out: + return ret; + +} + +static int igt_frag(void *ignored) +{ + struct drm_mm mm; + const struct insert_mode *mode; + struct drm_mm_node *nodes, *node, *next; + unsigned int insert_size = 1; + unsigned int scale_factor = 4; + int ret = -EINVAL; + + /* We need 4 * insert_size nodes to hold intermediate allocated + * drm_mm nodes. + * 1 times for prepare_igt_frag() + * 1 times for get_insert_time() + * 2 times for get_insert_time() + */ + nodes = vzalloc(array_size(insert_size * 4, sizeof(*nodes))); + if (!nodes) + return -ENOMEM; + + /* For BOTTOMUP and TOPDOWN, we first fragment the + * address space using prepare_igt_frag() and then try to verify + * that that insertions scale quadratically from 10k to 20k insertions + */ + drm_mm_init(&mm, 1, U64_MAX - 2); + for (mode = insert_modes; mode->name; mode++) { + u64 insert_time1, insert_time2; + + if (mode->mode != DRM_MM_INSERT_LOW || + mode->mode != DRM_MM_INSERT_HIGH) + continue; This check here is wrong, that needs to be && instead of || or the test wouldn't execute at all. I didn't bother to check dmesg after adding that "simple" check and the test ran fine. :/ Yeah, after that the test seems to work. But there are is another issues. We only cut of the right or the left branch of the tree and that still makes the implementation rather inefficient. In other words we first go down leftmost or rightmost even if we know that this way is no valuable candidate and then back off again towards the top. Going to look into this, but your patches already improves insertion time by a factor of nearly 30 in a fragmented address space. That is rather nice. Regards, Christian. Sending again. Nirmoy Christian. + + ret = prepare_igt_frag(&mm, nodes, insert_size, mode); + if (!ret) + goto err; + + insert_time1 = get_insert_time(&mm, insert_size, + nodes + insert_size, mode); + if (insert_time1 < 0) + goto err; + +
Re: [PATCH v3 01/43] drm/cma-helper: Rename symbols from drm_cma_gem_ to drm_gem_cma_
Hi Thomas, Thank you for the patch. On Fri, Jun 05, 2020 at 09:32:05AM +0200, Thomas Zimmermann wrote: > This fixes the naming of several symbols within CMA helpers. No functional > changes are made. > > Signed-off-by: Thomas Zimmermann Thank you for the patch. Speaking of naming, I wish we could rename drm_gem_cma_* to something else, as those helpers don't use CMA directly (and may not use it at all), but I think that would be too much intrusive changes for too little gain :-( > --- > drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 2 +- > drivers/gpu/drm/drm_gem_cma_helper.c| 10 +- > include/drm/drm_gem_cma_helper.h| 4 ++-- > 3 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c > b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c > index 6b27242b9ee3c..5e7ea0459d018 100644 > --- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c > +++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c > @@ -188,7 +188,7 @@ DEFINE_DRM_GEM_CMA_FOPS(fops); > > static struct drm_driver aspeed_gfx_driver = { > .driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, > - .gem_create_object = drm_cma_gem_create_object_default_funcs, > + .gem_create_object = drm_gem_cma_create_object_default_funcs, > .dumb_create= drm_gem_cma_dumb_create, > .prime_handle_to_fd = drm_gem_prime_handle_to_fd, > .prime_fd_to_handle = drm_gem_prime_fd_to_handle, > diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c > b/drivers/gpu/drm/drm_gem_cma_helper.c > index b3db3ca7bd7a7..842e2fa332354 100644 > --- a/drivers/gpu/drm/drm_gem_cma_helper.c > +++ b/drivers/gpu/drm/drm_gem_cma_helper.c > @@ -572,7 +572,7 @@ void drm_gem_cma_prime_vunmap(struct drm_gem_object *obj, > void *vaddr) > } > EXPORT_SYMBOL_GPL(drm_gem_cma_prime_vunmap); > > -static const struct drm_gem_object_funcs drm_cma_gem_default_funcs = { > +static const struct drm_gem_object_funcs drm_gem_cma_default_funcs = { > .free = drm_gem_cma_free_object, > .print_info = drm_gem_cma_print_info, > .get_sg_table = drm_gem_cma_prime_get_sg_table, > @@ -581,7 +581,7 @@ static const struct drm_gem_object_funcs > drm_cma_gem_default_funcs = { > }; > > /** > - * drm_cma_gem_create_object_default_funcs - Create a CMA GEM object with a > + * drm_gem_cma_create_object_default_funcs - Create a CMA GEM object with a > * default function table > * @dev: DRM device > * @size: Size of the object to allocate > @@ -593,7 +593,7 @@ static const struct drm_gem_object_funcs > drm_cma_gem_default_funcs = { > * A pointer to a allocated GEM object or an error pointer on failure. > */ > struct drm_gem_object * > -drm_cma_gem_create_object_default_funcs(struct drm_device *dev, size_t size) > +drm_gem_cma_create_object_default_funcs(struct drm_device *dev, size_t size) > { > struct drm_gem_cma_object *cma_obj; > > @@ -601,11 +601,11 @@ drm_cma_gem_create_object_default_funcs(struct > drm_device *dev, size_t size) > if (!cma_obj) > return NULL; > > - cma_obj->base.funcs = &drm_cma_gem_default_funcs; > + cma_obj->base.funcs = &drm_gem_cma_default_funcs; > > return &cma_obj->base; > } > -EXPORT_SYMBOL(drm_cma_gem_create_object_default_funcs); > +EXPORT_SYMBOL(drm_gem_cma_create_object_default_funcs); > > /** > * drm_gem_cma_prime_import_sg_table_vmap - PRIME import another driver's > diff --git a/include/drm/drm_gem_cma_helper.h > b/include/drm/drm_gem_cma_helper.h > index 947ac95eb24a9..64b7e9d42129a 100644 > --- a/include/drm/drm_gem_cma_helper.h > +++ b/include/drm/drm_gem_cma_helper.h > @@ -107,7 +107,7 @@ void *drm_gem_cma_prime_vmap(struct drm_gem_object *obj); > void drm_gem_cma_prime_vunmap(struct drm_gem_object *obj, void *vaddr); > > struct drm_gem_object * > -drm_cma_gem_create_object_default_funcs(struct drm_device *dev, size_t size); > +drm_gem_cma_create_object_default_funcs(struct drm_device *dev, size_t size); > > /** > * DRM_GEM_CMA_VMAP_DRIVER_OPS - CMA GEM driver operations ensuring a virtual > @@ -118,7 +118,7 @@ drm_cma_gem_create_object_default_funcs(struct drm_device > *dev, size_t size); > * imported buffers. > */ > #define DRM_GEM_CMA_VMAP_DRIVER_OPS \ > - .gem_create_object = drm_cma_gem_create_object_default_funcs, \ > + .gem_create_object = drm_gem_cma_create_object_default_funcs, \ > .dumb_create= drm_gem_cma_dumb_create, \ > .prime_handle_to_fd = drm_gem_prime_handle_to_fd, \ > .prime_fd_to_handle = drm_gem_prime_fd_to_handle, \ -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 09/13] device core: Introduce multiple dma pfn offsets
On Thu, Jun 4, 2020 at 10:20 AM Dan Carpenter wrote: > > On Thu, Jun 04, 2020 at 09:48:49AM -0400, Jim Quinlan wrote: > > > > + r = devm_kcalloc(dev, 1, sizeof(struct dma_pfn_offset_region), > > > > + GFP_KERNEL); > > > > > > Use:r = devm_kzalloc(dev, sizeof(*r), GFP_KERNEL); > > Will fix. > > > > > > > > > > > > + if (!r) > > > > + return -ENOMEM; > > > > + > > > > + r->uniform_offset = true; > > > > + r->pfn_offset = pfn_offset; > > > > + > > > > + return 0; > > > > +} > > > > > > This function doesn't seem to do anything useful. Is part of it > > > missing? > > No, the uniform pfn offset is a special case. > > Sorry, I wasn't clear. We're talking about different things. The code > does: > > r = devm_kzalloc(dev, sizeof(*r), GFP_KERNEL); > if (!r) > return -ENOMEM; > > r->uniform_offset = true; > r->pfn_offset = pfn_offset; > > return 0; > > The code allocates "r" and then doesn't save it anywhere so there is > no point. You are absolutely right, sorry I missed your point. Will fix. Thanks, Jim Quinlan > > regards, > dan carpenter > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 09/13] device core: Introduce multiple dma pfn offsets
Hi Nicolas, On Thu, Jun 4, 2020 at 12:52 PM Nicolas Saenz Julienne wrote: > > Hi Jim, > > On Thu, 2020-06-04 at 10:35 -0400, Jim Quinlan wrote: > > [...] > > > > > --- a/arch/sh/kernel/dma-coherent.c > > > > +++ b/arch/sh/kernel/dma-coherent.c > > > > @@ -14,6 +14,8 @@ void *arch_dma_alloc(struct device *dev, size_t size, > > > > dma_addr_t *dma_handle, > > > > { > > > > void *ret, *ret_nocache; > > > > int order = get_order(size); > > > > + unsigned long pfn; > > > > + phys_addr_t phys; > > > > > > > > gfp |= __GFP_ZERO; > > > > > > > > @@ -34,11 +36,14 @@ void *arch_dma_alloc(struct device *dev, size_t > > > > size, > > > > dma_addr_t *dma_handle, > > > > return NULL; > > > > } > > > > > > > > - split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order); > > > > + phys = virt_to_phys(ret); > > > > + pfn = phys >> PAGE_SHIFT; > > > > > > nit: not sure it really pays off to have a pfn variable here. > > Did it for readability; the compiler's optimization should take care > > of any extra variables. But I can switch if you insist. > > No need. > > [...] > > > > > diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > > > b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > > > index 055eb0b8e396..2d66d415b6c3 100644 > > > > --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > > > +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > > > @@ -898,7 +898,10 @@ static int sun6i_csi_probe(struct platform_device > > > > *pdev) > > > > > > > > sdev->dev = &pdev->dev; > > > > /* The DMA bus has the memory mapped at 0 */ > > > > - sdev->dev->dma_pfn_offset = PHYS_OFFSET >> PAGE_SHIFT; > > > > + ret = attach_uniform_dma_pfn_offset(sdev->dev, > > > > + PHYS_OFFSET >> PAGE_SHIFT); > > > > + if (ret) > > > > + return ret; > > > > > > > > ret = sun6i_csi_resource_request(sdev, pdev); > > > > if (ret) > > > > diff --git a/drivers/of/address.c b/drivers/of/address.c > > > > index 96d8cfb14a60..c89333b0a5fb 100644 > > > > --- a/drivers/of/address.c > > > > +++ b/drivers/of/address.c > > > > @@ -918,6 +918,70 @@ void __iomem *of_io_request_and_map(struct > > > > device_node > > > > *np, int index, > > > > } > > > > EXPORT_SYMBOL(of_io_request_and_map); > > > > > > > > +static int attach_dma_pfn_offset_map(struct device *dev, > > > > + struct device_node *node, int > > > > num_ranges) > > > > > > As with the previous review, please take this comment with a grain of > > > salt. > > > > > > I think there should be a clear split between what belongs to OF and what > > > belongs to the core device infrastructure. > > > > > > OF's job should be to parse DT and provide a list/array of ranges, whereas > > > the > > > core device infrastructure should provide an API to assign a list of > > > ranges/offset to a device. > > > > > > As a concrete example, you're forcing devices like the sta2x11 to build > > > with > > > OF > > > support, which, being an Intel device, it's pretty odd. But I'm also > > > thinking > > > of how will all this fit once an ACPI device wants to use it. > > To fix this I only have to move attach_uniform_dma_pfn_offset() from > > of/address.c to say include/linux/dma-mapping.h. It has no > > dependencies on OF. Do you agree? > > Yes that seems nicer. In case you didn't had it in mind already, I'd change > the > function name to match the naming scheme they use there. > > On the other hand, I'd also move the non OF parts of the non unifom dma_offset > version of the function there. > > > > Expanding on this idea, once you have a split between the OF's and device > > > core > > > roles, it transpires that of_dma_get_range()'s job should only be to > > > provide > > > the ranges in a device understandable structure and of_dma_configre()'s to > > > actually assign the device's parameters. This would obsolete patch #7. > > > > I think you mean patch #8. > > Yes, my bad. > > > I agree with you. The reason I needed a "struct device *" in the call is > > because I wanted to make sure the memory that is alloc'd belongs to the > > device that needs it. If I do a regular kzalloc(), this memory will become > > a leak once someone starts unbinding/binding their device. Also, in all > > uses of of_dma_rtange() -- there is only one -- a dev is required as one > > can't attach an offset map to NULL. > > > > I do see that there are a number of functions in drivers/of/*.c that > > take 'struct device *dev' as an argument so there is precedent for > > something like this. Regardless, I need an owner to the memory I > > alloc(). > > I understand the need for dev to be around, devm_*() is key. But also it's > important to keep the functions on purpose. And if of_dma_get_range() starts > setting ranges it calls, for the very least, for a function rename. Although > I'd rather split the parsing and set
Re: [PATCH v3 09/13] device core: Introduce multiple dma pfn offsets
On Thu, Jun 4, 2020 at 9:53 AM Nicolas Saenz Julienne wrote: > > Hi Jim, > > On Wed, 2020-06-03 at 15:20 -0400, Jim Quinlan wrote: > > The new field in struct device 'dma_pfn_offset_map' is used to facilitate > > the use of multiple pfn offsets between cpu addrs and dma addrs. It > > subsumes the role of dev->dma_pfn_offset -- a uniform offset -- and > > designates the single offset a special case. > > > > of_dma_configure() is the typical manner to set pfn offsets but there > > are a number of ad hoc assignments to dev->dma_pfn_offset in the > > kernel code. These cases now invoke the function > > attach_uniform_dma_pfn_offset(dev, pfn_offset). > > > > Signed-off-by: Jim Quinlan > > --- > > arch/arm/include/asm/dma-mapping.h| 9 +- > > arch/arm/mach-keystone/keystone.c | 9 +- > > arch/sh/drivers/pci/pcie-sh7786.c | 3 +- > > arch/sh/kernel/dma-coherent.c | 17 ++-- > > arch/x86/pci/sta2x11-fixup.c | 7 +- > > drivers/acpi/arm64/iort.c | 5 +- > > drivers/gpu/drm/sun4i/sun4i_backend.c | 7 +- > > drivers/iommu/io-pgtable-arm.c| 2 +- > > .../platform/sunxi/sun4i-csi/sun4i_csi.c | 5 +- > > .../platform/sunxi/sun6i-csi/sun6i_csi.c | 5 +- > > drivers/of/address.c | 93 +-- > > drivers/of/device.c | 8 +- > > drivers/remoteproc/remoteproc_core.c | 2 +- > > .../staging/media/sunxi/cedrus/cedrus_hw.c| 7 +- > > drivers/usb/core/message.c| 4 +- > > drivers/usb/core/usb.c| 2 +- > > include/linux/device.h| 4 +- > > include/linux/dma-direct.h| 16 +++- > > include/linux/dma-mapping.h | 45 + > > kernel/dma/coherent.c | 11 ++- > > 20 files changed, 210 insertions(+), 51 deletions(-) > > > > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma- > > mapping.h > > index bdd80ddbca34..f1e72f99468b 100644 > > --- a/arch/arm/include/asm/dma-mapping.h > > +++ b/arch/arm/include/asm/dma-mapping.h > > @@ -35,8 +35,9 @@ static inline const struct dma_map_ops > > *get_arch_dma_ops(struct bus_type *bus) > > #ifndef __arch_pfn_to_dma > > static inline dma_addr_t pfn_to_dma(struct device *dev, unsigned long pfn) > > { > > - if (dev) > > - pfn -= dev->dma_pfn_offset; > > + if (dev && dev->dma_pfn_offset_map) > > Would it make sense to move the dev->dma_pfn_offset_map check into > dma_pfn_offset_from_phys_addr() and return 0 if not available? Same for the > opposite variant of the function. I think it'd make the code a little simpler > on > some of the use cases, and overall less error prone if anyone starts using the > function elsewhere. Yes it makes sense and I was debating doing it but I just wanted to make it explicit that there was not much cost for this change for the fastpath -- no dma_pfn_offset whatsoever -- as the cost goes from a "pfn += dev->dma_pfn_offset" to a "if (dev->dma_pfn_offset_map)". I will do what you suggest. > > > + pfn -= dma_pfn_offset_from_phys_addr(dev, PFN_PHYS(pfn)); > > + > > return (dma_addr_t)__pfn_to_bus(pfn); > > } > > > > @@ -44,8 +45,8 @@ static inline unsigned long dma_to_pfn(struct device *dev, > > dma_addr_t addr) > > { > > unsigned long pfn = __bus_to_pfn(addr); > > > > - if (dev) > > - pfn += dev->dma_pfn_offset; > > + if (dev && dev->dma_pfn_offset_map) > > + pfn += dma_pfn_offset_from_dma_addr(dev, addr); > > > > return pfn; > > } > > diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach- > > keystone/keystone.c > > index 638808c4e122..e7d3ee6e9cb5 100644 > > --- a/arch/arm/mach-keystone/keystone.c > > +++ b/arch/arm/mach-keystone/keystone.c > > @@ -8,6 +8,7 @@ > > */ > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -38,9 +39,11 @@ static int keystone_platform_notifier(struct > > notifier_block > > *nb, > > return NOTIFY_BAD; > > > > if (!dev->of_node) { > > - dev->dma_pfn_offset = keystone_dma_pfn_offset; > > - dev_err(dev, "set dma_pfn_offset%08lx\n", > > - dev->dma_pfn_offset); > > + int ret = attach_uniform_dma_pfn_offset > > + (dev, keystone_dma_pfn_offset); > > + > > + dev_err(dev, "set dma_pfn_offset%08lx%s\n", > > + dev->dma_pfn_offset, ret ? " failed" : ""); > > } > > return NOTIFY_OK; > > } > > diff --git a/arch/sh/drivers/pci/pcie-sh7786.c b/arch/sh/drivers/pci/pcie- > > sh7786.c > > index e0b568aaa701..2e832a5c58c1 100644 > > --- a/arch/sh/drivers/pci/pcie-sh7786.c > > +++ b/arch/sh/drivers/pci/pcie-sh7786.c > > @@ -12,6 +12,7 @@ > > #include > > #include > > #include > > +#include > > #in
Re: [PATCH v3 09/13] device core: Introduce multiple dma pfn offsets
Hi Andy, On Thu, Jun 4, 2020 at 11:05 AM Andy Shevchenko wrote: > > On Thu, Jun 04, 2020 at 10:35:12AM -0400, Jim Quinlan wrote: > > On Thu, Jun 4, 2020 at 9:53 AM Nicolas Saenz Julienne > > wrote: > > > On Wed, 2020-06-03 at 15:20 -0400, Jim Quinlan wrote: > > ... > > > > > + phys = virt_to_phys(ret); > > > > + pfn = phys >> PAGE_SHIFT; > > > > > > nit: not sure it really pays off to have a pfn variable here. > > Did it for readability; the compiler's optimization should take care > > of any extra variables. But I can switch if you insist. > > One side note: please, try to get familiar with existing helpers in the > kernel. > For example, above line is like > > pfn = PFN_DOWN(phys); I just used the term in the original code; will change to PFN_DOWN(). > > ... > > > > > + if (!WARN_ON(!dev) && dev->dma_pfn_offset_map) > > > > > + *dma_handle -= PFN_PHYS( > > > > + dma_pfn_offset_from_phys_addr(dev, phys)); > > Don't do such indentation, esp. we have now 100! :-) Got it. Thanks, Jim Quinlan > > -- > With Best Regards, > Andy Shevchenko > > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 09/13] device core: Introduce multiple dma pfn offsets
Hi Dan, On Thu, Jun 4, 2020 at 7:06 AM Dan Carpenter wrote: > > On Wed, Jun 03, 2020 at 03:20:41PM -0400, Jim Quinlan wrote: > > @@ -786,7 +787,7 @@ static int sun4i_backend_bind(struct device *dev, > > struct device *master, > > const struct sun4i_backend_quirks *quirks; > > struct resource *res; > > void __iomem *regs; > > - int i, ret; > > + int i, ret = 0; > > No need for this. Will fix. > > > > > backend = devm_kzalloc(dev, sizeof(*backend), GFP_KERNEL); > > if (!backend) > > @@ -812,7 +813,9 @@ static int sun4i_backend_bind(struct device *dev, > > struct device *master, > >* on our device since the RAM mapping is at 0 for the DMA > > bus, > >* unlike the CPU. > >*/ > > - drm->dev->dma_pfn_offset = PHYS_PFN_OFFSET; > > + ret = attach_uniform_dma_pfn_offset(dev, PHYS_PFN_OFFSET); > > + if (ret) > > + return ret; > > } > > > > backend->engine.node = dev->of_node; > > diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c > > index 04fbd4bf0ff9..e9cc1c2d47cd 100644 > > --- a/drivers/iommu/io-pgtable-arm.c > > +++ b/drivers/iommu/io-pgtable-arm.c > > @@ -754,7 +754,7 @@ arm_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg) > > if (cfg->oas > ARM_LPAE_MAX_ADDR_BITS) > > return NULL; > > > > - if (!selftest_running && cfg->iommu_dev->dma_pfn_offset) { > > + if (!selftest_running && cfg->iommu_dev->dma_pfn_offset_map) { > > dev_err(cfg->iommu_dev, "Cannot accommodate DMA offset for > > IOMMU page tables\n"); > > return NULL; > > } > > diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c > > b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c > > index eff34ded6305..7212da5e1076 100644 > > --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c > > +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c > > @@ -7,6 +7,7 @@ > > */ > > > > #include > > +#include > > #include > > #include > > #include > > @@ -183,7 +184,9 @@ static int sun4i_csi_probe(struct platform_device *pdev) > > return ret; > > } else { > > #ifdef PHYS_PFN_OFFSET > > - csi->dev->dma_pfn_offset = PHYS_PFN_OFFSET; > > + ret = attach_uniform_dma_pfn_offset(dev, PHYS_PFN_OFFSET); > > + if (ret) > > + return ret; > > #endif > > } > > > > diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > index 055eb0b8e396..2d66d415b6c3 100644 > > --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > @@ -898,7 +898,10 @@ static int sun6i_csi_probe(struct platform_device > > *pdev) > > > > sdev->dev = &pdev->dev; > > /* The DMA bus has the memory mapped at 0 */ > > - sdev->dev->dma_pfn_offset = PHYS_OFFSET >> PAGE_SHIFT; > > + ret = attach_uniform_dma_pfn_offset(sdev->dev, > > + PHYS_OFFSET >> PAGE_SHIFT); > > + if (ret) > > + return ret; > > > > ret = sun6i_csi_resource_request(sdev, pdev); > > if (ret) > > diff --git a/drivers/of/address.c b/drivers/of/address.c > > index 96d8cfb14a60..c89333b0a5fb 100644 > > --- a/drivers/of/address.c > > +++ b/drivers/of/address.c > > @@ -918,6 +918,70 @@ void __iomem *of_io_request_and_map(struct device_node > > *np, int index, > > } > > EXPORT_SYMBOL(of_io_request_and_map); > > > > +static int attach_dma_pfn_offset_map(struct device *dev, > > + struct device_node *node, int num_ranges) > > +{ > > + struct of_range_parser parser; > > + struct of_range range; > > + struct dma_pfn_offset_region *r; > > + > > + r = devm_kcalloc(dev, num_ranges + 1, > > + sizeof(struct dma_pfn_offset_region), GFP_KERNEL); > > + if (!r) > > + return -ENOMEM; > > + dev->dma_pfn_offset_map = r; > > + of_dma_range_parser_init(&parser, node); > > + > > + /* > > + * Record all info for DMA ranges array. We could > > + * just use the of_range struct, but if we did that it > > + * would require more calculations for phys_to_dma and > > + * dma_to_phys conversions. > > + */ > > + for_each_of_range(&parser, &range) { > > + r->cpu_start = range.cpu_addr; > > + r->cpu_end = r->cpu_start + range.size - 1; > > + r->dma_start = range.bus_addr; > > + r->dma_end = r->dma_start + range.size - 1; > > + r->pfn_offset = PFN_DOWN(range.cpu_addr) > > + - PFN_DOWN(range.bus_addr); > > + r++; > > + } > > + return 0; > > +} > > + > > + > > + > > +/** > > + * attach_dma_pfn_offset - Assign scalar offset for all addresses. > > + * @dev: device pointer; only nee
Re: [PATCH v3 4/6] drm: Add Generic USB Display driver
Den 02.06.2020 20.38, skrev Peter Stuge: > Alan Stern wrote: A gadget driver can STALL in response to a control-OUT data packet, but only before it has seen the packet. >>> >>> How can it do that for OUT, and IN if possible there too? >> >> In the way described just above: The gadget driver's SETUP handler tells >> the UDC to stall the data packet. >> >>> Is it related to f->setup() returning < 0 ? >> >> Yes; the composite core interprets such a value as meaning to STALL >> endpoint 0. > > Thanks a lot for confirming this. > > >>> The spec also allows NAK, but the gadget code seems to not (need to?) >>> explicitly support that. Can you comment on this as well? >> >> If the gadget driver doesn't submit a usb_request then the UDC will >> reply with NAK. > > And thanks for this as well. > > >>> a status request so I can know the result of the operation the device has >>> performed. > .. >> There are two reasonable approaches you could use. One is to have a >> vendor-specific control request to get the result of the preceding >> operation. > .. >> The other approach is to send the status data over a bulk-IN endpoint. > > I've tried to explain a third approach, which I think fits well because the > status is only a "Ready" flag - ie. a memory barrier or flow control, > to make the host not send data OUT. > > I'm proposing that the gadget should NAK on data OUT when it isn't Ready, and > that the host driver shouldn't query status but simply send data when it has. > > Per Alans description the NAK happens automatically if the gadget driver has > no usb_request pending while it is processing previously received data. > > On the host that NAK makes the host controller retry automatically until > transfer success, timeout or fatal error. > > >> It would have to be formatted in such a way that the host could >> recognize it as a status packet and not some other sort of data packet. > > For host notification of status changes other than Ready I really like > such an IN endpoint, but preferably an interrupt endpoint. > > To avoid the formatting problem each data packet could be one full status > message. That way the host would always receive a known data structure. > Interrupt packets can be max 64 byte. Noralf, do you think that's enough > for everyone in the first version? > I'm going through some treatment that turned out to be worse than expected, so sadly I have to put this project on hold until my body recovers. Noralf. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/2] drm: cleanup on drm_mode_object_find
Redundant wrapper for drm_mode_object_find is removed. Signed-off-by: Ramalingam C --- drivers/gpu/drm/drm_crtc_internal.h | 6 ++--- drivers/gpu/drm/drm_framebuffer.c | 2 +- drivers/gpu/drm/drm_mode_object.c | 38 +++-- drivers/gpu/drm/drm_property.c | 6 ++--- 4 files changed, 21 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h index da96b2f64d7e..4bfde1367c1a 100644 --- a/drivers/gpu/drm/drm_crtc_internal.h +++ b/drivers/gpu/drm/drm_crtc_internal.h @@ -144,9 +144,9 @@ int drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj, uint32_t obj_type); void drm_mode_object_register(struct drm_device *dev, struct drm_mode_object *obj); -struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev, - struct drm_file *file_priv, - uint32_t id, uint32_t type); +struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, +struct drm_file *file_priv, +uint32_t id, uint32_t type); void drm_mode_object_unregister(struct drm_device *dev, struct drm_mode_object *object); int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic, diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 0375b3d7f8d0..023cea64e87d 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -888,7 +888,7 @@ struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev, struct drm_mode_object *obj; struct drm_framebuffer *fb = NULL; - obj = __drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_FB); + obj = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_FB); if (obj) fb = obj_to_fb(obj); return fb; diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c index 901b078abf40..6c5e689d8b60 100644 --- a/drivers/gpu/drm/drm_mode_object.c +++ b/drivers/gpu/drm/drm_mode_object.c @@ -133,9 +133,20 @@ bool drm_mode_object_lease_required(uint32_t type) } } -struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev, - struct drm_file *file_priv, - uint32_t id, uint32_t type) +/** + * drm_mode_object_find - look up a drm object with static lifetime + * @dev: drm device + * @file_priv: drm file + * @id: id of the mode object + * @type: type of the mode object + * + * This function is used to look up a modeset object. It will acquire a + * reference for reference counted objects. This reference must be dropped again + * by callind drm_mode_object_put(). + */ +struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, +struct drm_file *file_priv, +uint32_t id, uint32_t type) { struct drm_mode_object *obj = NULL; @@ -158,27 +169,6 @@ struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev, return obj; } - -/** - * drm_mode_object_find - look up a drm object with static lifetime - * @dev: drm device - * @file_priv: drm file - * @id: id of the mode object - * @type: type of the mode object - * - * This function is used to look up a modeset object. It will acquire a - * reference for reference counted objects. This reference must be dropped again - * by callind drm_mode_object_put(). - */ -struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, - struct drm_file *file_priv, - uint32_t id, uint32_t type) -{ - struct drm_mode_object *obj = NULL; - - obj = __drm_mode_object_find(dev, file_priv, id, type); - return obj; -} EXPORT_SYMBOL(drm_mode_object_find); /** diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index 6ee04803c362..f1e338f909f1 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c @@ -656,7 +656,7 @@ struct drm_property_blob *drm_property_lookup_blob(struct drm_device *dev, struct drm_mode_object *obj; struct drm_property_blob *blob = NULL; - obj = __drm_mode_object_find(dev, NULL, id, DRM_MODE_OBJECT_BLOB); + obj = drm_mode_object_find(dev, NULL, id, DRM_MODE_OBJECT_BLOB); if (obj) blob = obj_to_blob(obj); return blob; @@ -919,8 +919,8 @@ bool drm_property_change_valid_get(struct drm_property *property, if (value == 0) return true; - *ref = __drm_mode_object_find(property->dev, NULL, value, - property->values[0]); +
[PATCH 2/2] drm: Fix kdoc typo for drm_properties
Typo in the KDoc for the DRM_MODE_PROP_SIGNED_RANGE type of drm_properties is fixed. Signed-off-by: Ramalingam C --- include/drm/drm_property.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h index 4a0a80d658c7..5d1874b6ccfc 100644 --- a/include/drm/drm_property.h +++ b/include/drm/drm_property.h @@ -94,7 +94,7 @@ struct drm_property { * drm_property_create_range(). * * DRM_MODE_PROP_SIGNED_RANGE -* Range properties report their minimum and maximum admissible unsigned values. +* Range properties report their minimum and maximum admissible signed values. * The KMS core verifies that values set by application fit in that * range. The range is signed. Range properties are created using * drm_property_create_signed_range(). -- 2.20.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 13/18] drm/amdgpu/dc: Stop dma_resv_lock inversion in commit_tail
On Fri, Jun 5, 2020 at 10:30 AM Pierre-Eric Pelloux-Prayer wrote: > > Hi Daniel, > > On 04/06/2020 10:12, Daniel Vetter wrote: > [...] > > @@ -6910,7 +6910,11 @@ static void amdgpu_dm_commit_planes(struct > > drm_atomic_state *state, > >* explicitly on fences instead > >* and in general should be called for > >* blocking commit to as per framework helpers > > + * > > + * Yes, this deadlocks, since you're calling dma_resv_lock in > > a > > + * path that leads to a dma_fence_signal(). Don't do that. > >*/ > > +#if 0 > > r = amdgpu_bo_reserve(abo, true); > > if (unlikely(r != 0)) > > DRM_ERROR("failed to reserve buffer before flip\n"); > > @@ -6920,6 +6924,12 @@ static void amdgpu_dm_commit_planes(struct > > drm_atomic_state *state, > > tmz_surface = amdgpu_bo_encrypted(abo); > > > > amdgpu_bo_unreserve(abo); > > +#endif > > + /* > > + * this races anyway, so READ_ONCE isn't any better or worse > > + * than the stuff above. Except the stuff above can deadlock. > > + */ > > + tiling_flags = READ_ONCE(abo->tiling_flags); > > With this change "tmz_surface" won't be initialized properly. > Adding the following line should fix it: > > tmz_surface = READ_ONCE(abo->flags) & AMDGPU_GEM_CREATE_ENCRYPTED; So to make this clear, I'm not really proposing to fix up all the drivers in detail. There's a lot more bugs in all the other drivers, I'm pretty sure. The driver fixups really are just quick hacks to illustrate the problem, and at least in some cases, maybe illustrate a possible solution. For the real fixes I think this needs driver teams working on this, and make sure it's all solid. I can help a bit with review (especially for placing the annotations, e.g. the one I put in cs_submit() annotates a bit too much), but that's it. Also I think the patch is from before tmz landed, and I just blindly rebased over it :-) -Daniel > > > Pierre-Eric > > > > > > fill_dc_plane_info_and_addr( > > dm->adev, new_plane_state, tiling_flags, > > -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: MIPI DSI, DBI, and tinydrm drivers
Hi Emil, Den 03.06.2020 22.25, skrev Emil Velikov: > Hi Noralf, > > On Wed, 3 Jun 2020 at 13:15, Noralf Trønnes wrote: >> >> Den 28.05.2020 17.27, skrev Emil Velikov: >>> On Sun, 24 May 2020 at 19:35, Daniel Vetter wrote: On Sun, May 24, 2020 at 7:46 PM Noralf Trønnes wrote: > > > > Den 24.05.2020 18.13, skrev Paul Cercueil: >> Hi list, >> >> I'd like to open a discussion about the current support of MIPI DSI and >> DBI panels. >> >> Both are standards from the MIPI alliance, both are communication >> protocols between a LCD controller and a LCD panel, they generally both >> use the same commands (DCS), the main difference is that DSI is serial >> and DBI is generally parallel. >> >> In the kernel right now, DSI is pretty well implemented. All the >> infrastucture to register a DSI host, DSI device etc. is there. DSI >> panels are implemented as regular drm_panel instances, and their drivers >> go through the DSI API to communicate with the panel, which makes them >> independent of the DSI host driver. >> >> DBI, on the other hand, does not have any of this. All (?) DBI panels >> are implemented as tinydrm drivers, which make them impossible to use >> with regular DRM drivers. Writing a standard drm_panel driver is >> impossible, as there is no concept of host and device. All these tinydrm >> drivers register their own DBI host as they all do DBI over SPI. >> >> I think this needs a good cleanup. Given that DSI and DBI are so >> similar, it would probably make sense to fuse DBI support into the >> current DSI code, as trying to update DBI would result in a lot of code >> being duplicated. With the proper host/device registration mechanism >> from DSI code, it would be possible to turn most of the tinydrm drivers >> into regular drm_panel drivers. Do we have drivers with dbi support that actually want to reuse the tinydrm drivers? Good clean is all good, but we need a solid reason for changing stuff. Plus we need to make sure we're not just rediscovering all the old reasons for why we ended up where we are right now in the first place. >> The problem then is that these should still be available as tinydrm >> drivers. If the DSI/DBI panels can somehow register a .update_fb() >> callback, it would make it possible to have a panel-agnostic tinydrm >> driver, which would then probably open a lot of doors, and help a lot to >> clean the mess. >> >> I think I can help with that, I just need some guidance - I am fishing >> in exotic seas here. >> >> Thoughts, comments, are very welcome. > > I did look at this a few months back: > > drm/mipi-dbi: Support panel drivers > https://lists.freedesktop.org/archives/dri-devel/2019-August/228966.html > >>> Coming late to the party - the series looks like a great step forward. >>> > The problem with DBI is that it has reused other busses which means we > don't have DBI drivers, we have SPI drivers instead (6800/8080 is not > avail. as busses in Linux yet). DSI and DPI on the other hand has > dedicated hw controller drivers not shared with other subsystems. > > My initial tinydrm work used drm_panel, but I was not allowed to use it > (at least not the way I had done it). Hm, do we have a summary of all the discussions/reasons from back then? All I remember is that it's all that simple, you've done a lot of work exploring all the options, I'm fairly sure I suggested drm_panel even back then but somehow it didn't really work. Would be good if we make sure we don't at least repeat history too much :-) >>> This pretty much ^^. Does anyone have a link/summary of the concerns? >>> >> >> I found the thread where you Emil suggested I look at drm_panel: >> >> https://lists.freedesktop.org/archives/dri-devel/2015-September/091215.html >> > Guilty as charged ;-) > I guess it turns out that you were right :-) > Guess I should ask some silly questions first: > Was tinydrm modelled as a drm driver itself, because the idea of > drm_panel::update() callback seemed dirty? That's the only concern > raised that I can find on the list... It's effectively in the link you > provided. > > As far as I can tell, first RFC was already using the tiny drm driver model. > https://patchwork.freedesktop.org/patch/77161/ > > Yet again, do we actually need the callback? The mipi-dbi(?) spi > panels in panel/ get away w/o one, while pushing far more pixels onto > the screen (tiny has resolutions up-to 320x480, panel up-to 480x800). > > > That said, I'm a fan of lifting the tiny (panel) drivers into > drm-panel and exposing them via dbi-bus sounds reasonable IMHO. Seems > like Paul has the DT dbi/spi bus questions covered as well. > > Patches illustrating his ideas would be more than welcome. > +1 Wh
[PATCH] dma-fence: basic lockdep annotations
Design is similar to the lockdep annotations for workers, but with some twists: - We use a read-lock for the execution/worker/completion side, so that this explicit annotation can be more liberally sprinkled around. With read locks lockdep isn't going to complain if the read-side isn't nested the same way under all circumstances, so ABBA deadlocks are ok. Which they are, since this is an annotation only. - We're using non-recursive lockdep read lock mode, since in recursive read lock mode lockdep does not catch read side hazards. And we _very_ much want read side hazards to be caught. For full details of this limitation see commit e91498589746065e3ae95d9a00b068e525eec34f Author: Peter Zijlstra Date: Wed Aug 23 13:13:11 2017 +0200 locking/lockdep/selftests: Add mixed read-write ABBA tests - To allow nesting of the read-side explicit annotations we explicitly keep track of the nesting. lock_is_held() allows us to do that. - The wait-side annotation is a write lock, and entirely done within dma_fence_wait() for everyone by default. - To be able to freely annotate helper functions I want to make it ok to call dma_fence_begin/end_signalling from soft/hardirq context. First attempt was using the hardirq locking context for the write side in lockdep, but this forces all normal spinlocks nested within dma_fence_begin/end_signalling to be spinlocks. That bollocks. The approach now is to simple check in_atomic(), and for these cases entirely rely on the might_sleep() check in dma_fence_wait(). That will catch any wrong nesting against spinlocks from soft/hardirq contexts. The idea here is that every code path that's critical for eventually signalling a dma_fence should be annotated with dma_fence_begin/end_signalling. The annotation ideally starts right after a dma_fence is published (added to a dma_resv, exposed as a sync_file fd, attached to a drm_syncobj fd, or anything else that makes the dma_fence visible to other kernel threads), up to and including the dma_fence_wait(). Examples are irq handlers, the scheduler rt threads, the tail of execbuf (after the corresponding fences are visible), any workers that end up signalling dma_fences and really anything else. Not annotated should be code paths that only complete fences opportunistically as the gpu progresses, like e.g. shrinker/eviction code. The main class of deadlocks this is supposed to catch are: Thread A: mutex_lock(A); mutex_unlock(A); dma_fence_signal(); Thread B: mutex_lock(A); dma_fence_wait(); mutex_unlock(A); Thread B is blocked on A signalling the fence, but A never gets around to that because it cannot acquire the lock A. Note that dma_fence_wait() is allowed to be nested within dma_fence_begin/end_signalling sections. To allow this to happen the read lock needs to be upgraded to a write lock, which means that any other lock is acquired between the dma_fence_begin_signalling() call and the call to dma_fence_wait(), and still held, this will result in an immediate lockdep complaint. The only other option would be to not annotate such calls, defeating the point. Therefore these annotations cannot be sprinkled over the code entirely mindless to avoid false positives. Originally I hope that the cross-release lockdep extensions would alleviate the need for explicit annotations: https://lwn.net/Articles/709849/ But there's a few reasons why that's not an option: - It's not happening in upstream, since it got reverted due to too many false positives: commit e966eaeeb623f09975ef362c2866fae6f86844f9 Author: Ingo Molnar Date: Tue Dec 12 12:31:16 2017 +0100 locking/lockdep: Remove the cross-release locking checks This code (CONFIG_LOCKDEP_CROSSRELEASE=y and CONFIG_LOCKDEP_COMPLETIONS=y), while it found a number of old bugs initially, was also causing too many false positives that caused people to disable lockdep - which is arguably a worse overall outcome. - cross-release uses the complete() call to annotate the end of critical sections, for dma_fence that would be dma_fence_signal(). But we do not want all dma_fence_signal() calls to be treated as critical, since many are opportunistic cleanup of gpu requests. If these get stuck there's still the main completion interrupt and workers who can unblock everyone. Automatically annotating all dma_fence_signal() calls would hence cause false positives. - cross-release had some educated guesses for when a critical section starts, like fresh syscall or fresh work callback. This would again cause false positives without explicit annotations, since for dma_fence the critical sections only starts when we publish a fence. - Furthermore there can be cases where a thread never does a dma_fence_signal, but is still critical for reaching completion of fences. One example would be a schedule
Re: [PATCH v5 0/8] drm: rcar-du: Add Color Management Module (CMM)
Hello Eugeniu, sorry for the late reply On Wed, May 27, 2020 at 09:15:55AM +0200, Eugeniu Rosca wrote: > Hi Jacopo, > > On Tue, Oct 15, 2019 at 12:46:13PM +0200, Jacopo Mondi wrote: > 8<--- > > > * Testing > > I have tested by injecting a color inversion LUT table and > > enabling/disabling it > > every 50 displayed frames: > > https://jmondi.org/cgit/kmsxx/log/?h=gamma_lut > > Could you kindly share the cross compilation steps for your kmsxx fork? > I usually build it on the target :) > Just out of curiosity, have you ever tried to pull the display's HDMI > cable while reading from CM2_LUT_TBL? Ahem, not really :) Did I get you right, you mean disconnecting the HDMI cable from the board ? > > At least with the out-of-tree CMM implementation [*], this sends the > R-Car3 reference targets into an unrecoverable freeze, with no lockup > reported by the kernel (i.e. looks like an serious HW issue). > > > > > CMM functionalities are retained between suspend/resume cycles (tested with > > suspend-to-idle) without requiring a re-programming of the LUT tables. > > Hmm. Is this backed up by any statement in the HW User's manual? > This comes in contrast with the original Renesas CMM implementation [**] > which does make use of suspend (where the freeze actually happens). > > Can we infer, based on your statement, that we could also get rid of > the suspend callback in [**]? As Geert (thanks) explained what I've tested with is suspend-to-idle, which retains the state of the LUT tables (and I assume other not-yet-implemented CMM features, like CLU). I recall the out-of-tree driver has suspend/resume routines but I never really tested that. Thanks j > > [*] https://github.com/renesas-rcar/du_cmm > [**] > https://github.com/renesas-rcar/du_cmm/blob/c393ed49834bdbc/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-drm-rcar-du-Add-DU-CMM-support.patch#L1912 > > -- > Best regards, > Eugeniu Rosca ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 00/14] drm/mgag200: Use managed interfaces for auto-cleanup
This patchset cleans up mgag200 device initialization, embeds the DRM device instance in struct mga_device and finally converts device initialization to managed interfaces. Patches 1 and 2 are actually unrelated. Both remove artifacts that got lost from earlier patch series. We're fixing this before introducing new changes. Patches 3 to 7 cleanup the memory management code and convert it to managed. Specifically, all MM code is being moved into a the same file. That makes it more obvious what's going on and will allow for further cleanups later on. Modesetting is already cleaned up automatically, so there's nothing to do here. With modesetting and MM done, patches 8 to 14 convert the device initialization to managed interfaces. The allocation is split among several functions and we move it to the same place in patches 11 and 12. That is also a good opportunity to embed the DRM device instance in struct mga_device in patch 13. Patch 14 adds managed release of the device structure. Tested on Matrox G200SE HW. Thomas Zimmermann (14): drm/mgag200: Remove declaration of mgag200_mmap() from header file drm/mgag200: Remove mgag200_cursor.c drm/mgag200: Use pcim_enable_device() drm/mgag200: Rename mgag200_ttm.c to mgag200_mm.c drm/mgag200: Lookup VRAM PCI BAR start and length only once drm/mgag200: Merge VRAM setup into MM initialization drm/mgag200: Switch to managed MM drm/mgag200: Separate DRM and PCI functionality from each other drm/mgag200: Prefix global names in mgag200_drv.c with mgag200_ drm/mgag200: Move device init and cleanup to mgag200_drv.c drm/mgag200: Separate device initialization into allocation drm/mgag200: Allocate device structures in mgag200_driver_load() drm/mgag200: Embed instance of struct drm_device in struct mga_device drm/mgag200: Use managed device initialization drivers/gpu/drm/mgag200/Makefile | 3 +- drivers/gpu/drm/mgag200/mgag200_cursor.c | 319 -- drivers/gpu/drm/mgag200/mgag200_drv.c | 161 ++--- drivers/gpu/drm/mgag200/mgag200_drv.h | 11 +- drivers/gpu/drm/mgag200/mgag200_main.c| 155 - .../mgag200/{mgag200_ttm.c => mgag200_mm.c} | 99 -- drivers/gpu/drm/mgag200/mgag200_mode.c| 12 +- 7 files changed, 195 insertions(+), 565 deletions(-) delete mode 100644 drivers/gpu/drm/mgag200/mgag200_cursor.c delete mode 100644 drivers/gpu/drm/mgag200/mgag200_main.c rename drivers/gpu/drm/mgag200/{mgag200_ttm.c => mgag200_mm.c} (51%) -- 2.26.2 Thomas Zimmermann (14): drm/mgag200: Remove declaration of mgag200_mmap() from header file drm/mgag200: Remove mgag200_cursor.c drm/mgag200: Use pcim_enable_device() drm/mgag200: Rename mgag200_ttm.c to mgag200_mm.c drm/mgag200: Lookup VRAM PCI BAR start and length only once drm/mgag200: Merge VRAM setup into MM initialization drm/mgag200: Switch to managed MM drm/mgag200: Separate DRM and PCI functionality from each other drm/mgag200: Prefix global names in mgag200_drv.c with mgag200_ drm/mgag200: Move device init and cleanup to mgag200_drv.c drm/mgag200: Separate device initialization into allocation drm/mgag200: Allocate device structures in mgag200_driver_load() drm/mgag200: Embed instance of struct drm_device in struct mga_device drm/mgag200: Use managed device initialization drivers/gpu/drm/mgag200/Makefile | 3 +- drivers/gpu/drm/mgag200/mgag200_cursor.c | 319 -- drivers/gpu/drm/mgag200/mgag200_drv.c | 161 ++--- drivers/gpu/drm/mgag200/mgag200_drv.h | 11 +- drivers/gpu/drm/mgag200/mgag200_main.c| 155 - .../mgag200/{mgag200_ttm.c => mgag200_mm.c} | 99 -- drivers/gpu/drm/mgag200/mgag200_mode.c| 12 +- 7 files changed, 195 insertions(+), 565 deletions(-) delete mode 100644 drivers/gpu/drm/mgag200/mgag200_cursor.c delete mode 100644 drivers/gpu/drm/mgag200/mgag200_main.c rename drivers/gpu/drm/mgag200/{mgag200_ttm.c => mgag200_mm.c} (51%) -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 06/14] drm/mgag200: Merge VRAM setup into MM initialization
The VRAM setup in mgag200_drv.c is part of memory management and should be done in the same place. Merge the code into the memory management's init function. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_main.c | 75 -- drivers/gpu/drm/mgag200/mgag200_mm.c | 52 ++ 2 files changed, 52 insertions(+), 75 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c index 3298eff7bd1b4..e9ad783c2b44d 100644 --- a/drivers/gpu/drm/mgag200/mgag200_main.c +++ b/drivers/gpu/drm/mgag200/mgag200_main.c @@ -12,77 +12,6 @@ #include "mgag200_drv.h" -static int mga_probe_vram(struct mga_device *mdev, void __iomem *mem) -{ - int offset; - int orig; - int test1, test2; - int orig1, orig2; - unsigned int vram_size; - - /* Probe */ - orig = ioread16(mem); - iowrite16(0, mem); - - vram_size = mdev->mc.vram_window; - - if ((mdev->type == G200_EW3) && (vram_size >= 0x100)) { - vram_size = vram_size - 0x40; - } - - for (offset = 0x10; offset < vram_size; offset += 0x4000) { - orig1 = ioread8(mem + offset); - orig2 = ioread8(mem + offset + 0x100); - - iowrite16(0xaa55, mem + offset); - iowrite16(0xaa55, mem + offset + 0x100); - - test1 = ioread16(mem + offset); - test2 = ioread16(mem); - - iowrite16(orig1, mem + offset); - iowrite16(orig2, mem + offset + 0x100); - - if (test1 != 0xaa55) { - break; - } - - if (test2) { - break; - } - } - - iowrite16(orig, mem); - return offset - 65536; -} - -/* Map the framebuffer from the card and configure the core */ -static int mga_vram_init(struct mga_device *mdev) -{ - struct drm_device *dev = mdev->dev; - void __iomem *mem; - - /* BAR 0 is VRAM */ - mdev->mc.vram_base = pci_resource_start(dev->pdev, 0); - mdev->mc.vram_window = pci_resource_len(dev->pdev, 0); - - if (!devm_request_mem_region(dev->dev, mdev->mc.vram_base, -mdev->mc.vram_window, "mgadrmfb_vram")) { - DRM_ERROR("can't reserve VRAM\n"); - return -ENXIO; - } - - mem = pci_iomap(dev->pdev, 0, 0); - if (!mem) - return -ENOMEM; - - mdev->mc.vram_size = mga_probe_vram(mdev, mem); - - pci_iounmap(dev->pdev, mem); - - return 0; -} - int mgag200_driver_load(struct drm_device *dev, unsigned long flags) { struct mga_device *mdev; @@ -121,10 +50,6 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) mdev->unique_rev_id); } - ret = mga_vram_init(mdev); - if (ret) - return ret; - ret = mgag200_mm_init(mdev); if (ret) goto err_mm; diff --git a/drivers/gpu/drm/mgag200/mgag200_mm.c b/drivers/gpu/drm/mgag200/mgag200_mm.c index 73e30901e0631..f56b0456994f4 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mm.c +++ b/drivers/gpu/drm/mgag200/mgag200_mm.c @@ -30,6 +30,49 @@ #include "mgag200_drv.h" +static size_t mgag200_probe_vram(struct mga_device *mdev, void __iomem *mem, +size_t size) +{ + int offset; + int orig; + int test1, test2; + int orig1, orig2; + size_t vram_size; + + /* Probe */ + orig = ioread16(mem); + iowrite16(0, mem); + + vram_size = size; + + if ((mdev->type == G200_EW3) && (vram_size >= 0x100)) + vram_size = vram_size - 0x40; + + for (offset = 0x10; offset < vram_size; offset += 0x4000) { + orig1 = ioread8(mem + offset); + orig2 = ioread8(mem + offset + 0x100); + + iowrite16(0xaa55, mem + offset); + iowrite16(0xaa55, mem + offset + 0x100); + + test1 = ioread16(mem + offset); + test2 = ioread16(mem); + + iowrite16(orig1, mem + offset); + iowrite16(orig2, mem + offset + 0x100); + + if (test1 != 0xaa55) + break; + + if (test2) + break; + } + + iowrite16(orig, mem); + + return offset - 65536; +} + int mgag200_mm_init(struct mga_device *mdev) { struct drm_device *dev = mdev->dev; @@ -40,6 +83,11 @@ int mgag200_mm_init(struct mga_device *mdev) start = pci_resource_start(dev->pdev, 0); len = pci_resource_len(dev->pdev, 0); + if (!devm_request_mem_region(dev->dev, start, len, "mgadrmfb_vram")) { + drm_err(dev, "can't reserve VRAM\n"); + return -ENXIO; + } + arch_io_reserve_memtype_wc(start, len); mdev->fb_mtrr = arch_phys_wc_
[PATCH 07/14] drm/mgag200: Switch to managed MM
The memory-management code now cleans up automatically as part of device destruction. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_drv.h | 1 - drivers/gpu/drm/mgag200/mgag200_main.c | 5 + drivers/gpu/drm/mgag200/mgag200_mm.c | 28 ++ 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index cd786ffe319b8..7b6e6827a9a21 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -198,6 +198,5 @@ void mgag200_i2c_destroy(struct mga_i2c_chan *i2c); /* mgag200_mm.c */ int mgag200_mm_init(struct mga_device *mdev); -void mgag200_mm_fini(struct mga_device *mdev); #endif /* __MGAG200_DRV_H__ */ diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c index e9ad783c2b44d..49bcdfcb40a4e 100644 --- a/drivers/gpu/drm/mgag200/mgag200_main.c +++ b/drivers/gpu/drm/mgag200/mgag200_main.c @@ -57,13 +57,11 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) ret = mgag200_modeset_init(mdev); if (ret) { drm_err(dev, "Fatal error during modeset init: %d\n", ret); - goto err_mgag200_mm_fini; + goto err_mm; } return 0; -err_mgag200_mm_fini: - mgag200_mm_fini(mdev); err_mm: dev->dev_private = NULL; return ret; @@ -75,6 +73,5 @@ void mgag200_driver_unload(struct drm_device *dev) if (mdev == NULL) return; - mgag200_mm_fini(mdev); dev->dev_private = NULL; } diff --git a/drivers/gpu/drm/mgag200/mgag200_mm.c b/drivers/gpu/drm/mgag200/mgag200_mm.c index f56b0456994f4..1b1e5ec5d1ceb 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mm.c +++ b/drivers/gpu/drm/mgag200/mgag200_mm.c @@ -28,6 +28,8 @@ #include +#include + #include "mgag200_drv.h" static size_t mgag200_probe_vram(struct mga_device *mdev, void __iomem *mem, @@ -73,6 +75,18 @@ static size_t mgag200_probe_vram(struct mga_device *mdev, void __iomem *mem, return offset - 65536; } +static void mgag200_mm_release(struct drm_device *dev, void *ptr) +{ + struct mga_device *mdev = to_mga_device(dev); + + mdev->vram_fb_available = 0; + iounmap(mdev->vram); + arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0), + pci_resource_len(dev->pdev, 0)); + arch_phys_wc_del(mdev->fb_mtrr); + mdev->fb_mtrr = 0; +} + int mgag200_mm_init(struct mga_device *mdev) { struct drm_device *dev = mdev->dev; @@ -104,22 +118,10 @@ int mgag200_mm_init(struct mga_device *mdev) mdev->vram_fb_available = mdev->mc.vram_size; - return 0; + return drmm_add_action_or_reset(dev, mgag200_mm_release, NULL); err_arch_phys_wc_del: arch_phys_wc_del(mdev->fb_mtrr); arch_io_free_memtype_wc(start, len); return ret; } - -void mgag200_mm_fini(struct mga_device *mdev) -{ - struct drm_device *dev = mdev->dev; - - mdev->vram_fb_available = 0; - iounmap(mdev->vram); - arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0), - pci_resource_len(dev->pdev, 0)); - arch_phys_wc_del(mdev->fb_mtrr); - mdev->fb_mtrr = 0; -} -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 05/14] drm/mgag200: Lookup VRAM PCI BAR start and length only once
The MM setup code on mgag200 reads PCI BAR 0's start and length several times. Reusing these values makes the code more readable. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_mm.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_mm.c b/drivers/gpu/drm/mgag200/mgag200_mm.c index a683642fe4682..73e30901e0631 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mm.c +++ b/drivers/gpu/drm/mgag200/mgag200_mm.c @@ -33,16 +33,18 @@ int mgag200_mm_init(struct mga_device *mdev) { struct drm_device *dev = mdev->dev; + resource_size_t start, len; int ret; - arch_io_reserve_memtype_wc(pci_resource_start(dev->pdev, 0), - pci_resource_len(dev->pdev, 0)); + /* BAR 0 is VRAM */ + start = pci_resource_start(dev->pdev, 0); + len = pci_resource_len(dev->pdev, 0); - mdev->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0), -pci_resource_len(dev->pdev, 0)); + arch_io_reserve_memtype_wc(start, len); - mdev->vram = ioremap(pci_resource_start(dev->pdev, 0), -pci_resource_len(dev->pdev, 0)); + mdev->fb_mtrr = arch_phys_wc_add(start, len); + + mdev->vram = ioremap(start, len); if (!mdev->vram) { ret = -ENOMEM; goto err_arch_phys_wc_del; @@ -54,8 +56,7 @@ int mgag200_mm_init(struct mga_device *mdev) err_arch_phys_wc_del: arch_phys_wc_del(mdev->fb_mtrr); - arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0), - pci_resource_len(dev->pdev, 0)); + arch_io_free_memtype_wc(start, len); return ret; } -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 03/14] drm/mgag200: Use pcim_enable_device()
Using the managed function simplifies the error handling. After unloading the driver, the PCI device should now get disabled as well. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_drv.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 00ddea7d7d270..140ae86082c8e 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -52,15 +52,13 @@ static int mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "mgag200drmfb"); - ret = pci_enable_device(pdev); + ret = pcim_enable_device(pdev); if (ret) return ret; dev = drm_dev_alloc(&driver, &pdev->dev); - if (IS_ERR(dev)) { - ret = PTR_ERR(dev); - goto err_pci_disable_device; - } + if (IS_ERR(dev)) + return PTR_ERR(dev); dev->pdev = pdev; pci_set_drvdata(pdev, dev); @@ -81,8 +79,6 @@ static int mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) mgag200_driver_unload(dev); err_drm_dev_put: drm_dev_put(dev); -err_pci_disable_device: - pci_disable_device(pdev); return ret; } -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 12/14] drm/mgag200: Allocate device structures in mgag200_driver_load()
Instances of struct drm_device and struct mga_device are now allocated next to each other in mgag200_driver_load(). Yet another preparation before embedding the DRM device instance in struct mga_device. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_drv.c | 38 +++ 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 926437a27a228..592e484f87ee7 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -88,26 +88,36 @@ static int mgag200_device_init(struct mga_device *mdev, unsigned long flags) return 0; } -static int mgag200_driver_load(struct drm_device *dev, unsigned long flags) +static struct mga_device * +mgag200_driver_load(struct pci_dev *pdev, unsigned long flags) { + struct drm_device *dev; struct mga_device *mdev; int ret; + dev = drm_dev_alloc(&mgag200_driver, &pdev->dev); + if (IS_ERR(dev)) + return ERR_CAST(dev); + + dev->pdev = pdev; + pci_set_drvdata(pdev, dev); + mdev = devm_kzalloc(dev->dev, sizeof(struct mga_device), GFP_KERNEL); if (mdev == NULL) - return -ENOMEM; + return ERR_PTR(-ENOMEM); dev->dev_private = (void *)mdev; mdev->dev = dev; ret = mgag200_device_init(mdev, flags); if (ret) - goto err_mm; + goto err_drm_dev_put; - return 0; + return mdev; -err_mm: +err_drm_dev_put: + drm_dev_put(dev); dev->dev_private = NULL; - return ret; + return ERR_PTR(ret); } static void mgag200_driver_unload(struct drm_device *dev) @@ -141,6 +151,7 @@ MODULE_DEVICE_TABLE(pci, mgag200_pciidlist); static int mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { + struct mga_device *mdev; struct drm_device *dev; int ret; @@ -150,16 +161,10 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (ret) return ret; - dev = drm_dev_alloc(&mgag200_driver, &pdev->dev); - if (IS_ERR(dev)) - return PTR_ERR(dev); - - dev->pdev = pdev; - pci_set_drvdata(pdev, dev); - - ret = mgag200_driver_load(dev, ent->driver_data); - if (ret) - goto err_drm_dev_put; + mdev = mgag200_driver_load(pdev, ent->driver_data); + if (IS_ERR(mdev)) + return PTR_ERR(mdev); + dev = mdev->dev; ret = drm_dev_register(dev, ent->driver_data); if (ret) @@ -171,7 +176,6 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err_mgag200_driver_unload: mgag200_driver_unload(dev); -err_drm_dev_put: drm_dev_put(dev); return ret; } -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 02/14] drm/mgag200: Remove mgag200_cursor.c
Support for HW cursors got remove by commit 5a77e2bfdd4f ("drm/mgag200: Remove HW cursor") Apparently the source file was not deleted. Removed it now. Signed-off-by: Thomas Zimmermann Fixes: 5a77e2bfdd4f ("drm/mgag200: Remove HW cursor") Cc: Sam Ravnborg Cc: Emil Velikov Cc: Dave Airlie Cc: "Noralf Trønnes" Cc: Gerd Hoffmann Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Thomas Gleixner Cc: Kate Stewart Cc: Allison Randal Cc: Andrzej Pietrasiewicz Cc: "José Roberto de Souza" --- drivers/gpu/drm/mgag200/mgag200_cursor.c | 319 --- 1 file changed, 319 deletions(-) delete mode 100644 drivers/gpu/drm/mgag200/mgag200_cursor.c diff --git a/drivers/gpu/drm/mgag200/mgag200_cursor.c b/drivers/gpu/drm/mgag200/mgag200_cursor.c deleted file mode 100644 index c6932dc8acf2e..0 --- a/drivers/gpu/drm/mgag200/mgag200_cursor.c +++ /dev/null @@ -1,319 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright 2013 Matrox Graphics - * - * Author: Christopher Harvey - */ - -#include - -#include "mgag200_drv.h" - -static bool warn_transparent = true; -static bool warn_palette = true; - -static int mgag200_cursor_update(struct mga_device *mdev, void *dst, void *src, -unsigned int width, unsigned int height) -{ - struct drm_device *dev = mdev->dev; - unsigned int i, row, col; - uint32_t colour_set[16]; - uint32_t *next_space = &colour_set[0]; - uint32_t *palette_iter; - uint32_t this_colour; - bool found = false; - int colour_count = 0; - u8 reg_index; - u8 this_row[48]; - - memset(&colour_set[0], 0, sizeof(uint32_t)*16); - /* width*height*4 = 16384 */ - for (i = 0; i < 16384; i += 4) { - this_colour = ioread32(src + i); - /* No transparency */ - if (this_colour>>24 != 0xff && - this_colour>>24 != 0x0) { - if (warn_transparent) { - dev_info(&dev->pdev->dev, "Video card doesn't support cursors with partial transparency.\n"); - dev_info(&dev->pdev->dev, "Not enabling hardware cursor.\n"); - warn_transparent = false; /* Only tell the user once. */ - } - return -EINVAL; - } - /* Don't need to store transparent pixels as colours */ - if (this_colour>>24 == 0x0) - continue; - found = false; - for (palette_iter = &colour_set[0]; palette_iter != next_space; palette_iter++) { - if (*palette_iter == this_colour) { - found = true; - break; - } - } - if (found) - continue; - /* We only support 4bit paletted cursors */ - if (colour_count >= 16) { - if (warn_palette) { - dev_info(&dev->pdev->dev, "Video card only supports cursors with up to 16 colours.\n"); - dev_info(&dev->pdev->dev, "Not enabling hardware cursor.\n"); - warn_palette = false; /* Only tell the user once. */ - } - return -EINVAL; - } - *next_space = this_colour; - next_space++; - colour_count++; - } - - /* Program colours from cursor icon into palette */ - for (i = 0; i < colour_count; i++) { - if (i <= 2) - reg_index = 0x8 + i*0x4; - else - reg_index = 0x60 + i*0x3; - WREG_DAC(reg_index, colour_set[i] & 0xff); - WREG_DAC(reg_index+1, colour_set[i]>>8 & 0xff); - WREG_DAC(reg_index+2, colour_set[i]>>16 & 0xff); - BUG_ON((colour_set[i]>>24 & 0xff) != 0xff); - } - - /* now write colour indices into hardware cursor buffer */ - for (row = 0; row < 64; row++) { - memset(&this_row[0], 0, 48); - for (col = 0; col < 64; col++) { - this_colour = ioread32(src + 4*(col + 64*row)); - /* write transparent pixels */ - if (this_colour>>24 == 0x0) { - this_row[47 - col/8] |= 0x80>>(col%8); - continue; - } - - /* write colour index here */ - for (i = 0; i < colour_count; i++) { - if (colour_set[i] == this_colour) { - if (col % 2) - this_row[col/2] |= i<<4; - else -
[PATCH 11/14] drm/mgag200: Separate device initialization into allocation
Embedding the DRM device instance in struct mga_device will require changes to device allocation. Moving the device initialization into its own functions gets it out of the way. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_drv.c | 32 ++- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index f8bb24199643d..926437a27a228 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -43,17 +43,11 @@ static struct drm_driver mgag200_driver = { * DRM device */ -static int mgag200_driver_load(struct drm_device *dev, unsigned long flags) +static int mgag200_device_init(struct mga_device *mdev, unsigned long flags) { - struct mga_device *mdev; + struct drm_device *dev = mdev->dev; int ret, option; - mdev = devm_kzalloc(dev->dev, sizeof(struct mga_device), GFP_KERNEL); - if (mdev == NULL) - return -ENOMEM; - dev->dev_private = (void *)mdev; - mdev->dev = dev; - mdev->flags = mgag200_flags_from_driver_data(flags); mdev->type = mgag200_type_from_driver_data(flags); @@ -83,15 +77,33 @@ static int mgag200_driver_load(struct drm_device *dev, unsigned long flags) ret = mgag200_mm_init(mdev); if (ret) - goto err_mm; + return ret; ret = mgag200_modeset_init(mdev); if (ret) { drm_err(dev, "Fatal error during modeset init: %d\n", ret); - goto err_mm; + return ret; } return 0; +} + +static int mgag200_driver_load(struct drm_device *dev, unsigned long flags) +{ + struct mga_device *mdev; + int ret; + + mdev = devm_kzalloc(dev->dev, sizeof(struct mga_device), GFP_KERNEL); + if (mdev == NULL) + return -ENOMEM; + dev->dev_private = (void *)mdev; + mdev->dev = dev; + + ret = mgag200_device_init(mdev, flags); + if (ret) + goto err_mm; + + return 0; err_mm: dev->dev_private = NULL; -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 08/14] drm/mgag200: Separate DRM and PCI functionality from each other
Moving the DRM driver structures from the middle of the PCI code to the top of the file makes it more readable. Also remove an obsolete comment. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_drv.c | 42 +-- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 140ae86082c8e..670e12d57dea8 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -17,17 +17,31 @@ #include "mgag200_drv.h" -/* - * This is the generic driver code. This binds the driver to the drm core, - * which then performs further device association and calls our graphics init - * functions - */ - int mgag200_modeset = -1; MODULE_PARM_DESC(modeset, "Disable/Enable modesetting"); module_param_named(modeset, mgag200_modeset, int, 0400); -static struct drm_driver driver; +/* + * DRM driver + */ + +DEFINE_DRM_GEM_FOPS(mgag200_driver_fops); + +static struct drm_driver driver = { + .driver_features = DRIVER_ATOMIC | DRIVER_GEM | DRIVER_MODESET, + .fops = &mgag200_driver_fops, + .name = DRIVER_NAME, + .desc = DRIVER_DESC, + .date = DRIVER_DATE, + .major = DRIVER_MAJOR, + .minor = DRIVER_MINOR, + .patchlevel = DRIVER_PATCHLEVEL, + DRM_GEM_SHMEM_DRIVER_OPS, +}; + +/* + * PCI driver + */ static const struct pci_device_id pciidlist[] = { { PCI_VENDOR_ID_MATROX, 0x522, PCI_ANY_ID, PCI_ANY_ID, 0, 0, @@ -91,20 +105,6 @@ static void mga_pci_remove(struct pci_dev *pdev) drm_dev_put(dev); } -DEFINE_DRM_GEM_FOPS(mgag200_driver_fops); - -static struct drm_driver driver = { - .driver_features = DRIVER_ATOMIC | DRIVER_GEM | DRIVER_MODESET, - .fops = &mgag200_driver_fops, - .name = DRIVER_NAME, - .desc = DRIVER_DESC, - .date = DRIVER_DATE, - .major = DRIVER_MAJOR, - .minor = DRIVER_MINOR, - .patchlevel = DRIVER_PATCHLEVEL, - DRM_GEM_SHMEM_DRIVER_OPS, -}; - static struct pci_driver mgag200_pci_driver = { .name = DRIVER_NAME, .id_table = pciidlist, -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 13/14] drm/mgag200: Embed instance of struct drm_device in struct mga_device
Following current best practice, the instance of struct drm_device is now embedded in struct mga_device. The respective field has been renamed from 'dev' to 'base' to reflect the relationship. Conversion from DRM device is done via upcast. Using dev_private is no longer possible. The patch also open-codes drm_dev_alloc() and DRM device initialization is now performed by a call to drm_device_init(). Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_drv.c | 47 ++ drivers/gpu/drm/mgag200/mgag200_drv.h | 4 +-- drivers/gpu/drm/mgag200/mgag200_mm.c | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 12 +++ 4 files changed, 27 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 592e484f87ee7..6dfb7c5f79e3c 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -45,7 +45,7 @@ static struct drm_driver mgag200_driver = { static int mgag200_device_init(struct mga_device *mdev, unsigned long flags) { - struct drm_device *dev = mdev->dev; + struct drm_device *dev = &mdev->base; int ret, option; mdev->flags = mgag200_flags_from_driver_data(flags); @@ -89,25 +89,24 @@ static int mgag200_device_init(struct mga_device *mdev, unsigned long flags) } static struct mga_device * -mgag200_driver_load(struct pci_dev *pdev, unsigned long flags) +mgag200_device_create(struct pci_dev *pdev, unsigned long flags) { struct drm_device *dev; struct mga_device *mdev; int ret; - dev = drm_dev_alloc(&mgag200_driver, &pdev->dev); - if (IS_ERR(dev)) - return ERR_CAST(dev); + mdev = devm_kzalloc(&pdev->dev, sizeof(*mdev), GFP_KERNEL); + if (!mdev) + return ERR_PTR(-ENOMEM); + dev = &mdev->base; + + ret = drm_dev_init(dev, &mgag200_driver, &pdev->dev); + if (ret) + return ERR_PTR(ret); dev->pdev = pdev; pci_set_drvdata(pdev, dev); - mdev = devm_kzalloc(dev->dev, sizeof(struct mga_device), GFP_KERNEL); - if (mdev == NULL) - return ERR_PTR(-ENOMEM); - dev->dev_private = (void *)mdev; - mdev->dev = dev; - ret = mgag200_device_init(mdev, flags); if (ret) goto err_drm_dev_put; @@ -116,19 +115,9 @@ mgag200_driver_load(struct pci_dev *pdev, unsigned long flags) err_drm_dev_put: drm_dev_put(dev); - dev->dev_private = NULL; return ERR_PTR(ret); } -static void mgag200_driver_unload(struct drm_device *dev) -{ - struct mga_device *mdev = to_mga_device(dev); - - if (mdev == NULL) - return; - dev->dev_private = NULL; -} - /* * PCI driver */ @@ -161,21 +150,22 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (ret) return ret; - mdev = mgag200_driver_load(pdev, ent->driver_data); - if (IS_ERR(mdev)) - return PTR_ERR(mdev); - dev = mdev->dev; + mdev = mgag200_device_create(pdev, ent->driver_data); + if (IS_ERR(mdev)) { + ret = PTR_ERR(mdev); + goto err_drm_dev_put; + } + dev = &mdev->base; ret = drm_dev_register(dev, ent->driver_data); if (ret) - goto err_mgag200_driver_unload; + goto err_drm_dev_put; drm_fbdev_generic_setup(dev, 0); return 0; -err_mgag200_driver_unload: - mgag200_driver_unload(dev); +err_drm_dev_put: drm_dev_put(dev); return ret; } @@ -185,7 +175,6 @@ static void mgag200_pci_remove(struct pci_dev *pdev) struct drm_device *dev = pci_get_drvdata(pdev); drm_dev_unregister(dev); - mgag200_driver_unload(dev); drm_dev_put(dev); } diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index b38e5ce4ee20b..270c2f9a67666 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -142,7 +142,7 @@ enum mga_type { #define IS_G200_SE(mdev) (mdev->type == G200_SE_A || mdev->type == G200_SE_B) struct mga_device { - struct drm_device *dev; + struct drm_device base; unsigned long flags; resource_size_t rmmio_base; @@ -170,7 +170,7 @@ struct mga_device { static inline struct mga_device *to_mga_device(struct drm_device *dev) { - return dev->dev_private; + return container_of(dev, struct mga_device, base); } static inline enum mga_type diff --git a/drivers/gpu/drm/mgag200/mgag200_mm.c b/drivers/gpu/drm/mgag200/mgag200_mm.c index 1b1e5ec5d1ceb..7b69392bcb891 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mm.c +++ b/drivers/gpu/drm/mgag200/mgag200_mm.c @@ -89,7 +89,7 @@ static void mgag200_mm_release(struct drm_device *dev, void *ptr) in
[PATCH 04/14] drm/mgag200: Rename mgag200_ttm.c to mgag200_mm.c
The mgag200 driver does not use TTM any longer. Rename the related file to mgag200_mm.c (as in 'memory management'). Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/Makefile| 4 ++-- drivers/gpu/drm/mgag200/mgag200_drv.h | 1 + drivers/gpu/drm/mgag200/{mgag200_ttm.c => mgag200_mm.c} | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename drivers/gpu/drm/mgag200/{mgag200_ttm.c => mgag200_mm.c} (100%) diff --git a/drivers/gpu/drm/mgag200/Makefile b/drivers/gpu/drm/mgag200/Makefile index 63403133638a3..e6a933874a88c 100644 --- a/drivers/gpu/drm/mgag200/Makefile +++ b/drivers/gpu/drm/mgag200/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -mgag200-y := mgag200_main.o mgag200_mode.o \ - mgag200_drv.o mgag200_i2c.o mgag200_ttm.o +mgag200-y := mgag200_drv.o mgag200_i2c.o mgag200_main.o mgag200_mm.o \ + mgag200_mode.o obj-$(CONFIG_DRM_MGAG200) += mgag200.o diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index 92b6679029fe5..cd786ffe319b8 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -196,6 +196,7 @@ void mgag200_driver_unload(struct drm_device *dev); struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev); void mgag200_i2c_destroy(struct mga_i2c_chan *i2c); + /* mgag200_mm.c */ int mgag200_mm_init(struct mga_device *mdev); void mgag200_mm_fini(struct mga_device *mdev); diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_mm.c similarity index 100% rename from drivers/gpu/drm/mgag200/mgag200_ttm.c rename to drivers/gpu/drm/mgag200/mgag200_mm.c -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 09/14] drm/mgag200: Prefix global names in mgag200_drv.c with mgag200_
The naming of global symbols in mgag200_drv.c is inconsistent. Fix that by prefixing all names with mgag200_. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_drv.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 670e12d57dea8..ad74e02d8f251 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -27,7 +27,7 @@ module_param_named(modeset, mgag200_modeset, int, 0400); DEFINE_DRM_GEM_FOPS(mgag200_driver_fops); -static struct drm_driver driver = { +static struct drm_driver mgag200_driver = { .driver_features = DRIVER_ATOMIC | DRIVER_GEM | DRIVER_MODESET, .fops = &mgag200_driver_fops, .name = DRIVER_NAME, @@ -43,7 +43,7 @@ static struct drm_driver driver = { * PCI driver */ -static const struct pci_device_id pciidlist[] = { +static const struct pci_device_id mgag200_pciidlist[] = { { PCI_VENDOR_ID_MATROX, 0x522, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_A | MGAG200_FLAG_HW_BUG_NO_STARTADD}, { PCI_VENDOR_ID_MATROX, 0x524, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_B }, @@ -56,10 +56,10 @@ static const struct pci_device_id pciidlist[] = { {0,} }; -MODULE_DEVICE_TABLE(pci, pciidlist); +MODULE_DEVICE_TABLE(pci, mgag200_pciidlist); - -static int mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) +static int +mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct drm_device *dev; int ret; @@ -70,7 +70,7 @@ static int mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (ret) return ret; - dev = drm_dev_alloc(&driver, &pdev->dev); + dev = drm_dev_alloc(&mgag200_driver, &pdev->dev); if (IS_ERR(dev)) return PTR_ERR(dev); @@ -96,7 +96,7 @@ static int mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return ret; } -static void mga_pci_remove(struct pci_dev *pdev) +static void mgag200_pci_remove(struct pci_dev *pdev) { struct drm_device *dev = pci_get_drvdata(pdev); @@ -107,9 +107,9 @@ static void mga_pci_remove(struct pci_dev *pdev) static struct pci_driver mgag200_pci_driver = { .name = DRIVER_NAME, - .id_table = pciidlist, - .probe = mga_pci_probe, - .remove = mga_pci_remove, + .id_table = mgag200_pciidlist, + .probe = mgag200_pci_probe, + .remove = mgag200_pci_remove, }; static int __init mgag200_init(void) -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 14/14] drm/mgag200: Use managed device initialization
The mgag200 driver now uses managed functions for DRM devices. The individual helpers for modesetting and memory managed are already covered, so only device allocation and initialization is left for conversion. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/mgag200_drv.c | 30 +++ 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 6dfb7c5f79e3c..e19660f4a6371 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -95,27 +95,20 @@ mgag200_device_create(struct pci_dev *pdev, unsigned long flags) struct mga_device *mdev; int ret; - mdev = devm_kzalloc(&pdev->dev, sizeof(*mdev), GFP_KERNEL); - if (!mdev) - return ERR_PTR(-ENOMEM); + mdev = devm_drm_dev_alloc(&pdev->dev, &mgag200_driver, + struct mga_device, base); + if (IS_ERR(mdev)) + return mdev; dev = &mdev->base; - ret = drm_dev_init(dev, &mgag200_driver, &pdev->dev); - if (ret) - return ERR_PTR(ret); - dev->pdev = pdev; pci_set_drvdata(pdev, dev); ret = mgag200_device_init(mdev, flags); if (ret) - goto err_drm_dev_put; + return ERR_PTR(ret); return mdev; - -err_drm_dev_put: - drm_dev_put(dev); - return ERR_PTR(ret); } /* @@ -151,23 +144,17 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return ret; mdev = mgag200_device_create(pdev, ent->driver_data); - if (IS_ERR(mdev)) { - ret = PTR_ERR(mdev); - goto err_drm_dev_put; - } + if (IS_ERR(mdev)) + return PTR_ERR(mdev); dev = &mdev->base; ret = drm_dev_register(dev, ent->driver_data); if (ret) - goto err_drm_dev_put; + return ret; drm_fbdev_generic_setup(dev, 0); return 0; - -err_drm_dev_put: - drm_dev_put(dev); - return ret; } static void mgag200_pci_remove(struct pci_dev *pdev) @@ -175,7 +162,6 @@ static void mgag200_pci_remove(struct pci_dev *pdev) struct drm_device *dev = pci_get_drvdata(pdev); drm_dev_unregister(dev); - drm_dev_put(dev); } static struct pci_driver mgag200_pci_driver = { -- 2.26.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 10/14] drm/mgag200: Move device init and cleanup to mgag200_drv.c
Moving the initializer and cleanup functions for device instances to mgag200_drv.c prepares for the conversion to managed code. No functional changes are made. Remove mgag200_main.c, which is now empty. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/mgag200/Makefile | 3 +- drivers/gpu/drm/mgag200/mgag200_drv.c | 68 +++ drivers/gpu/drm/mgag200/mgag200_drv.h | 4 -- drivers/gpu/drm/mgag200/mgag200_main.c | 77 -- 4 files changed, 69 insertions(+), 83 deletions(-) delete mode 100644 drivers/gpu/drm/mgag200/mgag200_main.c diff --git a/drivers/gpu/drm/mgag200/Makefile b/drivers/gpu/drm/mgag200/Makefile index e6a933874a88c..42fedef538826 100644 --- a/drivers/gpu/drm/mgag200/Makefile +++ b/drivers/gpu/drm/mgag200/Makefile @@ -1,5 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -mgag200-y := mgag200_drv.o mgag200_i2c.o mgag200_main.o mgag200_mm.o \ - mgag200_mode.o +mgag200-y := mgag200_drv.o mgag200_i2c.o mgag200_mm.o mgag200_mode.o obj-$(CONFIG_DRM_MGAG200) += mgag200.o diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index ad74e02d8f251..f8bb24199643d 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -39,6 +39,74 @@ static struct drm_driver mgag200_driver = { DRM_GEM_SHMEM_DRIVER_OPS, }; +/* + * DRM device + */ + +static int mgag200_driver_load(struct drm_device *dev, unsigned long flags) +{ + struct mga_device *mdev; + int ret, option; + + mdev = devm_kzalloc(dev->dev, sizeof(struct mga_device), GFP_KERNEL); + if (mdev == NULL) + return -ENOMEM; + dev->dev_private = (void *)mdev; + mdev->dev = dev; + + mdev->flags = mgag200_flags_from_driver_data(flags); + mdev->type = mgag200_type_from_driver_data(flags); + + pci_read_config_dword(dev->pdev, PCI_MGA_OPTION, &option); + mdev->has_sdram = !(option & (1 << 14)); + + /* BAR 0 is the framebuffer, BAR 1 contains registers */ + mdev->rmmio_base = pci_resource_start(dev->pdev, 1); + mdev->rmmio_size = pci_resource_len(dev->pdev, 1); + + if (!devm_request_mem_region(dev->dev, mdev->rmmio_base, +mdev->rmmio_size, "mgadrmfb_mmio")) { + drm_err(dev, "can't reserve mmio registers\n"); + return -ENOMEM; + } + + mdev->rmmio = pcim_iomap(dev->pdev, 1, 0); + if (mdev->rmmio == NULL) + return -ENOMEM; + + /* stash G200 SE model number for later use */ + if (IS_G200_SE(mdev)) { + mdev->unique_rev_id = RREG32(0x1e24); + drm_dbg(dev, "G200 SE unique revision id is 0x%x\n", + mdev->unique_rev_id); + } + + ret = mgag200_mm_init(mdev); + if (ret) + goto err_mm; + + ret = mgag200_modeset_init(mdev); + if (ret) { + drm_err(dev, "Fatal error during modeset init: %d\n", ret); + goto err_mm; + } + + return 0; + +err_mm: + dev->dev_private = NULL; + return ret; +} + +static void mgag200_driver_unload(struct drm_device *dev) +{ + struct mga_device *mdev = to_mga_device(dev); + + if (mdev == NULL) + return; + dev->dev_private = NULL; +} + /* * PCI driver */ diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index 7b6e6827a9a21..b38e5ce4ee20b 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -188,10 +188,6 @@ mgag200_flags_from_driver_data(kernel_ulong_t driver_data) /* mgag200_mode.c */ int mgag200_modeset_init(struct mga_device *mdev); - /* mgag200_main.c */ -int mgag200_driver_load(struct drm_device *dev, unsigned long flags); -void mgag200_driver_unload(struct drm_device *dev); - /* mgag200_i2c.c */ struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev); void mgag200_i2c_destroy(struct mga_i2c_chan *i2c); diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c deleted file mode 100644 index 49bcdfcb40a4e..0 --- a/drivers/gpu/drm/mgag200/mgag200_main.c +++ /dev/null @@ -1,77 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright 2010 Matt Turner. - * Copyright 2012 Red Hat - * - * Authors: Matthew Garrett - * Matt Turner - * Dave Airlie - */ - -#include - -#include "mgag200_drv.h" - -int mgag200_driver_load(struct drm_device *dev, unsigned long flags) -{ - struct mga_device *mdev; - int ret, option; - - mdev = devm_kzalloc(dev->dev, sizeof(struct mga_device), GFP_KERNEL); - if (mdev == NULL) - return -ENOMEM; - dev->dev_private = (void *)mdev; - mdev->dev = dev; - - mdev->flags = mgag200_flag