From patchwork Fri Oct 30 10:11:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11869157 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CB15C388F9 for ; Fri, 30 Oct 2020 10:11:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E40F6221FF for ; Fri, 30 Oct 2020 10:11:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="ExksNrJn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E40F6221FF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3AEC56EDAB; Fri, 30 Oct 2020 10:11:21 +0000 (UTC) Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F5F06EDA2 for ; Fri, 30 Oct 2020 10:11:13 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id k18so2395154wmj.5 for ; Fri, 30 Oct 2020 03:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CIKWZlZo95cVbYauc5nK39MkcGqrdDI5iPnF8AgRfuo=; b=ExksNrJnR6sD4c/T9F48tFRgbVGaX2N+mssPW4fvCYoYDHmISoe4rs+bLZ2/X2tyl6 g83JZiABn9+6VsOXZpZ2Ceo27m+n97FD2wY6yE178Cq0IUYgMujrqAGRV7/OGdK1Ey6f N1hefYm3MAd+zEb/orA3wLf3jfX6IS7fH2Ak4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CIKWZlZo95cVbYauc5nK39MkcGqrdDI5iPnF8AgRfuo=; b=PTreA/zQ/toZrBsQLhOpIBV9ze3eO3Iulbn6+CjiAkgjzdywGB++9BB5Yz4pkTr8ni 1elWYpEuvNfIx/uT62hDA9qa+Gmp9CBbF9d++/Z176CuChqRYFlpNFVq22QA94hMLlno JTrt9HjuxXQLEVMqMGON7arYE2k8hbks7Py7mp5QPorleFX9zfkbKSy8BKjnYp5k1cEx 5FFOXzhjKF2EN/8tplyYk4h8y/iN+PFMTT0J1xXaLKoEYna4xMdJ2CaOKXcmoqO2V7U/ 1zFg2W43eQ3sX2NHYCsVnk5fqQsE2aPlrDDp1Ndf127/BZIx2AvVqUx2oraGD9ymxVhN R1Dw== X-Gm-Message-State: AOAM530w33BtVN1rMFeC0mn1cm1tQK3pzOixJ6NzfU7Ws3OR1xhMVvWX zuuNrmS3sjDQpIFmDAUe01lc0vG1dG4w9SnD X-Google-Smtp-Source: ABdhPJxeW1exoTLwxwrP21n5NC6zMRAgicARARr6OVWQo8MU99acN3kuGV4Xstm46A8s9TeYlei7CA== X-Received: by 2002:a1c:b041:: with SMTP id z62mr1776192wme.183.1604052672133; Fri, 30 Oct 2020 03:11:12 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id q10sm9735769wrp.83.2020.10.30.03.11.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 03:11:11 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Fri, 30 Oct 2020 11:11:02 +0100 Message-Id: <20201030101104.2503-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030101104.2503-1-daniel.vetter@ffwll.ch> References: <20201030101104.2503-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 3/5] drm/amdgpu: Paper over the drm_driver mangling for virt X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Grodzovsky , chen gong , Daniel Vetter , Daniel Vetter , Intel Graphics Development , Wenhui Sheng , shaoyunl , Luben Tuikov , "Stanley.Yang" , Dennis Li , Thomas Zimmermann , Bokun Zhang , Alex Deucher , Felix Kuehling , Yintian Tao , Evan Quan , =?utf-8?q?Christian_K=C3=B6nig?= , Monk Liu , Hawking Zhang Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Prep work to make drm_device->driver const. Signed-off-by: Daniel Vetter Cc: Alex Deucher Cc: "Christian König" Cc: Evan Quan Cc: Felix Kuehling Cc: Hawking Zhang Cc: Andrey Grodzovsky Cc: Luben Tuikov Cc: Thomas Zimmermann Cc: Monk Liu Cc: Yintian Tao Cc: Dennis Li Cc: shaoyunl Cc: Bokun Zhang Cc: "Stanley.Yang" Cc: Wenhui Sheng Cc: chen gong Signed-off-by: Daniel Vetter --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 024c3b70b1aa..3d337f13ae4e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1093,7 +1093,7 @@ static const struct pci_device_id pciidlist[] = { MODULE_DEVICE_TABLE(pci, pciidlist); -static struct drm_driver kms_driver; +struct drm_driver amdgpu_kms_driver; static int amdgpu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) @@ -1164,7 +1164,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, if (ret) return ret; - adev = devm_drm_dev_alloc(&pdev->dev, &kms_driver, typeof(*adev), ddev); + adev = devm_drm_dev_alloc(&pdev->dev, &amdgpu_kms_driver, typeof(*adev), ddev); if (IS_ERR(adev)) return PTR_ERR(adev); @@ -1508,7 +1508,7 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv) return 0; } -static struct drm_driver kms_driver = { +struct drm_driver amdgpu_kms_driver = { .driver_features = DRIVER_ATOMIC | DRIVER_GEM | @@ -1571,7 +1571,7 @@ static int __init amdgpu_init(void) goto error_fence; DRM_INFO("amdgpu kernel modesetting enabled.\n"); - kms_driver.num_ioctls = amdgpu_max_kms_ioctl; + amdgpu_kms_driver.num_ioctls = amdgpu_max_kms_ioctl; amdgpu_register_atpx_handler(); /* Ignore KFD init failures. Normal when CONFIG_HSA_AMD is not set. */ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c index d0aea5e39531..dde4c449c284 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c @@ -45,13 +45,23 @@ bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev) return RREG32_NO_KIQ(0xc040) == 0xffffffff; } +extern struct drm_driver amdgpu_kms_driver; + void amdgpu_virt_init_setting(struct amdgpu_device *adev) { /* enable virtual display */ if (adev->mode_info.num_crtc == 0) adev->mode_info.num_crtc = 1; adev->enable_virtual_display = true; - adev_to_drm(adev)->driver->driver_features &= ~DRIVER_ATOMIC; + + /* + * FIXME: Either make virt support atomic or make sure you have two + * drm_driver structs, these kind of tricks are only ok when there's + * guaranteed only a single device per system. This should also be done + * before struct drm_device is initialized. + */ + amdgpu_kms_driver.driver_features &= ~DRIVER_ATOMIC; + adev->cg_flags = 0; adev->pg_flags = 0; }