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

Merge tag 'drm/tegra/for-5.13-rc5' of ssh://git.freedesktop.org/git/tegra/linux into drm-fixes

drm/tegra: Fixes for v5.13-rc5

The most important change here fixes a race condition that causes either
HDA or (more frequently) display to malfunction because they race for
enabling the SOR power domain at probe time.

Other than that, there's a couple of build warnings for issues
introduced in v5.13 as well as some minor fixes, such as reference leak
plugs.

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Thierry Reding <thierry.reding@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210603144624.788861-1-thierry.reding@gmail.com

+92 -42
+1 -1
drivers/gpu/drm/tegra/drm.h
··· 25 25 #include "trace.h" 26 26 27 27 /* XXX move to include/uapi/drm/drm_fourcc.h? */ 28 - #define DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT BIT(22) 28 + #define DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT BIT_ULL(22) 29 29 30 30 struct reset_control; 31 31
+1 -1
drivers/gpu/drm/tegra/hub.c
··· 510 510 * dGPU sector layout. 511 511 */ 512 512 if (tegra_plane_state->tiling.sector_layout == TEGRA_BO_SECTOR_LAYOUT_GPU) 513 - base |= BIT(39); 513 + base |= BIT_ULL(39); 514 514 #endif 515 515 516 516 tegra_plane_writel(p, tegra_plane_state->format, DC_WIN_COLOR_DEPTH);
+42 -28
drivers/gpu/drm/tegra/sor.c
··· 3125 3125 if (err < 0) { 3126 3126 dev_err(sor->dev, "failed to acquire SOR reset: %d\n", 3127 3127 err); 3128 - return err; 3128 + goto rpm_put; 3129 3129 } 3130 3130 3131 3131 err = reset_control_assert(sor->rst); 3132 3132 if (err < 0) { 3133 3133 dev_err(sor->dev, "failed to assert SOR reset: %d\n", 3134 3134 err); 3135 - return err; 3135 + goto rpm_put; 3136 3136 } 3137 3137 } 3138 3138 3139 3139 err = clk_prepare_enable(sor->clk); 3140 3140 if (err < 0) { 3141 3141 dev_err(sor->dev, "failed to enable clock: %d\n", err); 3142 - return err; 3142 + goto rpm_put; 3143 3143 } 3144 3144 3145 3145 usleep_range(1000, 3000); ··· 3150 3150 dev_err(sor->dev, "failed to deassert SOR reset: %d\n", 3151 3151 err); 3152 3152 clk_disable_unprepare(sor->clk); 3153 - return err; 3153 + goto rpm_put; 3154 3154 } 3155 3155 3156 3156 reset_control_release(sor->rst); ··· 3171 3171 } 3172 3172 3173 3173 return 0; 3174 + 3175 + rpm_put: 3176 + if (sor->rst) 3177 + pm_runtime_put(sor->dev); 3178 + 3179 + return err; 3174 3180 } 3175 3181 3176 3182 static int tegra_sor_exit(struct host1x_client *client) ··· 3745 3739 if (!sor->aux) 3746 3740 return -EPROBE_DEFER; 3747 3741 3748 - if (get_device(&sor->aux->ddc.dev)) { 3749 - if (try_module_get(sor->aux->ddc.owner)) 3750 - sor->output.ddc = &sor->aux->ddc; 3751 - else 3752 - put_device(&sor->aux->ddc.dev); 3753 - } 3742 + if (get_device(sor->aux->dev)) 3743 + sor->output.ddc = &sor->aux->ddc; 3754 3744 } 3755 3745 3756 3746 if (!sor->aux) { ··· 3774 3772 3775 3773 err = tegra_sor_parse_dt(sor); 3776 3774 if (err < 0) 3777 - return err; 3775 + goto put_aux; 3778 3776 3779 3777 err = tegra_output_probe(&sor->output); 3780 - if (err < 0) 3781 - return dev_err_probe(&pdev->dev, err, 3782 - "failed to probe output\n"); 3778 + if (err < 0) { 3779 + dev_err_probe(&pdev->dev, err, "failed to probe output\n"); 3780 + goto put_aux; 3781 + } 3783 3782 3784 3783 if (sor->ops && sor->ops->probe) { 3785 3784 err = sor->ops->probe(sor); ··· 3919 3916 platform_set_drvdata(pdev, sor); 3920 3917 pm_runtime_enable(&pdev->dev); 3921 3918 3922 - INIT_LIST_HEAD(&sor->client.list); 3919 + host1x_client_init(&sor->client); 3923 3920 sor->client.ops = &sor_client_ops; 3924 3921 sor->client.dev = &pdev->dev; 3925 - 3926 - err = host1x_client_register(&sor->client); 3927 - if (err < 0) { 3928 - dev_err(&pdev->dev, "failed to register host1x client: %d\n", 3929 - err); 3930 - goto rpm_disable; 3931 - } 3932 3922 3933 3923 /* 3934 3924 * On Tegra210 and earlier, provide our own implementation for the ··· 3934 3938 sor->index); 3935 3939 if (!name) { 3936 3940 err = -ENOMEM; 3937 - goto unregister; 3941 + goto uninit; 3938 3942 } 3939 3943 3940 3944 err = host1x_client_resume(&sor->client); 3941 3945 if (err < 0) { 3942 3946 dev_err(sor->dev, "failed to resume: %d\n", err); 3943 - goto unregister; 3947 + goto uninit; 3944 3948 } 3945 3949 3946 3950 sor->clk_pad = tegra_clk_sor_pad_register(sor, name); ··· 3951 3955 err = PTR_ERR(sor->clk_pad); 3952 3956 dev_err(sor->dev, "failed to register SOR pad clock: %d\n", 3953 3957 err); 3954 - goto unregister; 3958 + goto uninit; 3959 + } 3960 + 3961 + err = __host1x_client_register(&sor->client); 3962 + if (err < 0) { 3963 + dev_err(&pdev->dev, "failed to register host1x client: %d\n", 3964 + err); 3965 + goto uninit; 3955 3966 } 3956 3967 3957 3968 return 0; 3958 3969 3959 - unregister: 3960 - host1x_client_unregister(&sor->client); 3961 - rpm_disable: 3970 + uninit: 3971 + host1x_client_exit(&sor->client); 3962 3972 pm_runtime_disable(&pdev->dev); 3963 3973 remove: 3974 + if (sor->aux) 3975 + sor->output.ddc = NULL; 3976 + 3964 3977 tegra_output_remove(&sor->output); 3978 + put_aux: 3979 + if (sor->aux) 3980 + put_device(sor->aux->dev); 3981 + 3965 3982 return err; 3966 3983 } 3967 3984 ··· 3991 3982 } 3992 3983 3993 3984 pm_runtime_disable(&pdev->dev); 3985 + 3986 + if (sor->aux) { 3987 + put_device(sor->aux->dev); 3988 + sor->output.ddc = NULL; 3989 + } 3994 3990 3995 3991 tegra_output_remove(&sor->output); 3996 3992
+24 -6
drivers/gpu/host1x/bus.c
··· 736 736 EXPORT_SYMBOL(host1x_driver_unregister); 737 737 738 738 /** 739 + * __host1x_client_init() - initialize a host1x client 740 + * @client: host1x client 741 + * @key: lock class key for the client-specific mutex 742 + */ 743 + void __host1x_client_init(struct host1x_client *client, struct lock_class_key *key) 744 + { 745 + INIT_LIST_HEAD(&client->list); 746 + __mutex_init(&client->lock, "host1x client lock", key); 747 + client->usecount = 0; 748 + } 749 + EXPORT_SYMBOL(__host1x_client_init); 750 + 751 + /** 752 + * host1x_client_exit() - uninitialize a host1x client 753 + * @client: host1x client 754 + */ 755 + void host1x_client_exit(struct host1x_client *client) 756 + { 757 + mutex_destroy(&client->lock); 758 + } 759 + EXPORT_SYMBOL(host1x_client_exit); 760 + 761 + /** 739 762 * __host1x_client_register() - register a host1x client 740 763 * @client: host1x client 741 764 * @key: lock class key for the client-specific mutex ··· 770 747 * device and call host1x_device_init(), which will in turn call each client's 771 748 * &host1x_client_ops.init implementation. 772 749 */ 773 - int __host1x_client_register(struct host1x_client *client, 774 - struct lock_class_key *key) 750 + int __host1x_client_register(struct host1x_client *client) 775 751 { 776 752 struct host1x *host1x; 777 753 int err; 778 - 779 - INIT_LIST_HEAD(&client->list); 780 - __mutex_init(&client->lock, "host1x client lock", key); 781 - client->usecount = 0; 782 754 783 755 mutex_lock(&devices_lock); 784 756
+24 -6
include/linux/host1x.h
··· 332 332 int host1x_device_init(struct host1x_device *device); 333 333 int host1x_device_exit(struct host1x_device *device); 334 334 335 - int __host1x_client_register(struct host1x_client *client, 336 - struct lock_class_key *key); 337 - #define host1x_client_register(class) \ 338 - ({ \ 339 - static struct lock_class_key __key; \ 340 - __host1x_client_register(class, &__key); \ 335 + void __host1x_client_init(struct host1x_client *client, struct lock_class_key *key); 336 + void host1x_client_exit(struct host1x_client *client); 337 + 338 + #define host1x_client_init(client) \ 339 + ({ \ 340 + static struct lock_class_key __key; \ 341 + __host1x_client_init(client, &__key); \ 342 + }) 343 + 344 + int __host1x_client_register(struct host1x_client *client); 345 + 346 + /* 347 + * Note that this wrapper calls __host1x_client_init() for compatibility 348 + * with existing callers. Callers that want to separately initialize and 349 + * register a host1x client must first initialize using either of the 350 + * __host1x_client_init() or host1x_client_init() functions and then use 351 + * the low-level __host1x_client_register() function to avoid the client 352 + * getting reinitialized. 353 + */ 354 + #define host1x_client_register(client) \ 355 + ({ \ 356 + static struct lock_class_key __key; \ 357 + __host1x_client_init(client, &__key); \ 358 + __host1x_client_register(client); \ 341 359 }) 342 360 343 361 int host1x_client_unregister(struct host1x_client *client);