From patchwork Fri Oct 23 12:28:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11853253 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=ham 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 D34ABC388F9 for ; Fri, 23 Oct 2020 12:28: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 618C7221F9 for ; Fri, 23 Oct 2020 12:28:26 +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="G2MDNLU5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 618C7221F9 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 7837C6E588; Fri, 23 Oct 2020 12:28:25 +0000 (UTC) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 453BB6E588 for ; Fri, 23 Oct 2020 12:28:23 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id k21so1015806wmi.1 for ; Fri, 23 Oct 2020 05:28:23 -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=G2MDNLU5OEqsZ8521x9+uQNEJDT1a7HUFXyf+Gbwg1BXaJaqn9RM4XiErAD1tK999O Dhlfv0PRCOgg9bzvZlqJ+dTwZQyWJDTuC22QtlXZ3E8JfXoZUOBKabVc4cxk6KB8F/As F1WqgkiyU1Rxi8X1Eq2AFGGnS8XCydjRPN+U4= 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=ZMHKumHt5lE4CIskDUAknCW3c5QE7ULUf9y6E+hH1AC1da6Q7Rp3Y84WuP4qbJRQwz gAvbXalBN96UALcMtTkhSh69tO8xckj+ckwx8LsxUJF/Q8hhstleFlMILSbHuIRXwCDU BKAl1VcTLRF4DqvO6IM95ciYkFgoZASQ3ta1e8d5vvOLPIOMGPZ1+Te5hSPJDGKUCyMa n77DaMxRJ1+ybVgs877usVwUKCH/3RdRggJFFjfQ6aAGEUz4Jl6jAkk45Jd4jUTjRKDg BT94mT/WExyBnwRXag7CHflucH5H2QwuF5KEjmjE986zDyuEfIx5e3iDlkzrCbHB499X HqSQ== X-Gm-Message-State: AOAM531R9iWNfU2IC/YjRvYhWI3+rv7EnA4ugBKaHQkq58SbvKH7s5q/ R47Aa8TNC9bBH6NAnj5fmyhUYg== X-Google-Smtp-Source: ABdhPJxQZonzLZVJrB7zIn9oqJfkcxSnFPz3NkjCKh+yRwf5gOhA32Xe0wb5Q/Pj34T1hH+EgsmwkA== X-Received: by 2002:a1c:c90b:: with SMTP id f11mr2088435wmb.54.1603456102025; Fri, 23 Oct 2020 05:28:22 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id j5sm3133451wrx.88.2020.10.23.05.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 05:28:21 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Fri, 23 Oct 2020 14:28:09 +0200 Message-Id: <20201023122811.2374118-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023122811.2374118-1-daniel.vetter@ffwll.ch> References: <20201023122811.2374118-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; }