From patchwork Thu Feb 9 05:54:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1739798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=JCtSVwnd; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PC5g84Bv3z23yF for ; Thu, 9 Feb 2023 16:54:59 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pPztO-0002i3-Om; Thu, 09 Feb 2023 05:54:46 +0000 Received: from mail-pj1-f41.google.com ([209.85.216.41]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pPztN-0002hr-4I for kernel-team@lists.ubuntu.com; Thu, 09 Feb 2023 05:54:45 +0000 Received: by mail-pj1-f41.google.com with SMTP id f16-20020a17090a9b1000b0023058bbd7b2so1328571pjp.0 for ; Wed, 08 Feb 2023 21:54:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=nz6KsTEnIbUYTdT2RzIDLIkg5bUhWqK0XdkGVC7zECE=; b=JCtSVwnds3SFuzAu4mXRamilYpypWOGrhpPFs9lHMu0aZ6Yr1lFkeWTjaYZ+HhckIN lMMnsMaFyW6DVOmT8LCMrabPIVMY/8/LJvjSKlMWE6bTVf1ex8tXU4k2nMCMCDnWhf5U /Yfm8+c8zQaOS23OaJhBzY86WndRsouhIQTy2ghU1cWCx/KiCvlTHrdmmiKEk6Ssw9wX ZWp8lOMoiH3trZJHKMyN5xZPzGOVRjDKjoyIpB9nU+WFWaMjt9+BKQqb/i/WGDat4nQD DwiAnVkhYD5ORJw/oghB+lalyNqbx6uNArFcvL/4X9tdEdKvyik7CBWqkXyIDmKfy4X3 R/XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=nz6KsTEnIbUYTdT2RzIDLIkg5bUhWqK0XdkGVC7zECE=; b=xdG5U11SVgBCfib7G7AGaUfxIh6qqe3RxhvlWRiHTFwBtLoh+DI4BqilpY7ihQmbS/ r5ZO5onNWwxQX4STaW+lSpvgKvnXAxhq6Cnv/stGGAMIaL0LqZ76v0BroHCITEl3m+2K Mt3HElEWvebr91+S2e3xucgjTdkeAzHfnDO9cQQTQsFcF6/aqI+Jz45AgADaOvYZxuJZ L1K0sLMMoY7cKx97ov2C9xcydXZ0AArmWuIxv5AB0wsma5VG/ha4/gVJpgOajRiQn+IB vAjn5DPcmm6jOizoI/q1soQ3QVf3enaOpNlzu/vz6gwrxSH/eUqthc+MFQR+wgGPcHpp EA7Q== X-Gm-Message-State: AO0yUKUX+AxJw7B3sa1DuEK531b6v6r3nuGf+aDcYzJhiFCj7SRV4YpW 6huXQVK4S/Hv5E1cJPJPXdRvWY7VMZxtxQ== X-Google-Smtp-Source: AK7set/LixTW+iB1ByCFxob8KW9QW/CpW5YEdI8mVBu0LDNvfLMIM2oZiIs2dSPxduDV13yNVva5Pw== X-Received: by 2002:a17:902:e5d2:b0:199:3361:684c with SMTP id u18-20020a170902e5d200b001993361684cmr10250187plf.32.1675922083058; Wed, 08 Feb 2023 21:54:43 -0800 (PST) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id ji7-20020a170903324700b00192d9b86318sm478277plb.137.2023.02.08.21.54.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 21:54:42 -0800 (PST) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 1/4][SRU][OEM-5.17] drm/amdgpu: move nbio ih_doorbell_range() into ih code for vega Date: Thu, 9 Feb 2023 13:54:30 +0800 Message-Id: <20230209055433.229851-2-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230209055433.229851-1-acelan.kao@canonical.com> References: <20230209055433.229851-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.216.41; envelope-from=acelan@gmail.com; helo=mail-pj1-f41.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Alex Deucher BugLink: https://launchpad.net/bugs/2000110 This mirrors what we do for other asics and this way we are sure the ih doorbell range is properly initialized. There is a comment about the way doorbells on gfx9 work that requires that they are initialized for other IPs before GFX is initialized. In this case IH is initialized before GFX, so there should be no issue. This is a prerequisite for fixing the Unsupported Request error reported through AER during driver load. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216373 The error was unnoticed before and got visible because of the commit referenced below. This doesn't fix anything in the commit below, rather fixes the issue in amdgpu exposed by the commit. The reference is only to associate this commit with below one so that both go together. Fixes: 8795e182b02d ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()") Acked-by: Christian König Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org (cherry picked from commit dc1d85cb790f2091eea074cee24a704b2d6c4a06) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/gpu/drm/amd/amdgpu/soc15.c | 3 --- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index 4683095154db8..04040ff673a7c 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c @@ -1275,9 +1275,6 @@ static void soc15_doorbell_range_init(struct amdgpu_device *adev) ring->use_doorbell, ring->doorbell_index, adev->doorbell_index.sdma_doorbell_range); } - - adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell, - adev->irq.ih.doorbell_index); } } diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c index 3070466f54e17..77b28949cb8ff 100644 --- a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c @@ -289,6 +289,10 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev) } } + if (!amdgpu_sriov_vf(adev)) + adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell, + adev->irq.ih.doorbell_index); + pci_set_master(adev->pdev); /* enable interrupts */ diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_ih.c b/drivers/gpu/drm/amd/amdgpu/vega20_ih.c index 3b4eb8285943c..ea8571131c3ab 100644 --- a/drivers/gpu/drm/amd/amdgpu/vega20_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/vega20_ih.c @@ -340,6 +340,10 @@ static int vega20_ih_irq_init(struct amdgpu_device *adev) } } + if (!amdgpu_sriov_vf(adev)) + adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell, + adev->irq.ih.doorbell_index); + pci_set_master(adev->pdev); /* enable interrupts */ From patchwork Thu Feb 9 05:54:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1739799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=ckX1IZr6; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PC5g91mkZz23yG for ; Thu, 9 Feb 2023 16:55:01 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pPztV-0002kp-WB; Thu, 09 Feb 2023 05:54:53 +0000 Received: from mail-pl1-f171.google.com ([209.85.214.171]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pPztT-0002jF-ND for kernel-team@lists.ubuntu.com; Thu, 09 Feb 2023 05:54:51 +0000 Received: by mail-pl1-f171.google.com with SMTP id iz19so380584plb.13 for ; Wed, 08 Feb 2023 21:54:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=/RY1/SBtZTREnNKrMJ7hhaqMxmRUmWeoNBiWSSi/osQ=; b=ckX1IZr6AxShiEdcsWrKNDzEGV+MzuNtWpnenYbszvbQWp70ZmSXTi4o/tISDKL53Z Iw/FuyitoVIwbckEgdK48/BlQef2mXevi/hTiQ3w6T/8pNU9DLo57zPwotUvjUngPw2F 5S75t3HOhmD3Ea5potmYX70Gc+42mijz4l++F9pI/Ruw+QASwP2DqMwDNUnZCdXLj1oE UXhlVMVkXiLrKCKaDFMF4CXxAzBrLjPoWUtT3cW1XDlSclP7eYRS0NEDqM2RGm6d+0j/ HQ9VtpuH5faUKEwENqGI8A3zT02kZte+b5bhRA7/ABsEwFqVdAk5e80uzpG2Xm676d3s 5Ltw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=/RY1/SBtZTREnNKrMJ7hhaqMxmRUmWeoNBiWSSi/osQ=; b=5qLoXsYiuCTamh9GkeA1lI+Pft6tJ77aGj/YTrycUZVsn3ci86Xy35NhSqKr52e4TN lnH/WOVcFfEuH3tPZoUuCXi88S7P7kf6kt3SMgSIagnRGaVzsGIS9273acbxhHd4yCgD lAlj4vUcaHXs20KkZU/HpI3ERaVeSgIF5o1UNIuJ5yNrUZ0UinH0GraQBN81Kzzm1+TR +ksWoxVkPPz53qZqXAJx1xyHTV7JmgFFEI8BSaOZbeHzL5O+fy+3i5PCUvGc6HK8ay5z xVA1FH86qwBAyk3VeCGGFWuYsu5T1WX5kbFkFNbKNDtHxcXuBm3b06Y3Apxr7DvjMMtY GRgw== X-Gm-Message-State: AO0yUKW0Eywui+ZBdOC6ZXTPgwJ3UsGxV32xhN4OUW6TY1mJhzfP8Hjg yvh4fGxwPermjoeoOarqPC58Gs5+3SY02g== X-Google-Smtp-Source: AK7set9wgNmhr6507AxnqcP6fL0IjWSa5J9es0cr6JgqNKXxq2PRj9Fb7sm1nN2RgBOqmWZDcoNqAQ== X-Received: by 2002:a17:902:f283:b0:199:3778:59ce with SMTP id k3-20020a170902f28300b00199377859cemr6662904plc.25.1675922089426; Wed, 08 Feb 2023 21:54:49 -0800 (PST) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id v19-20020a637a13000000b004f198707cdbsm478289pgc.55.2023.02.08.21.54.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 21:54:49 -0800 (PST) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 2/4][SRU][OEM-5.17] drm/amdgpu: move nbio sdma_doorbell_range() into sdma code for vega Date: Thu, 9 Feb 2023 13:54:31 +0800 Message-Id: <20230209055433.229851-3-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230209055433.229851-1-acelan.kao@canonical.com> References: <20230209055433.229851-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.214.171; envelope-from=acelan@gmail.com; helo=mail-pl1-f171.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Alex Deucher BugLink: https://launchpad.net/bugs/2000110 This mirrors what we do for other asics and this way we are sure the sdma doorbell range is properly initialized. There is a comment about the way doorbells on gfx9 work that requires that they are initialized for other IPs before GFX is initialized. However, the statement says that it applies to multimedia as well, but the VCN code currently initializes doorbells after GFX and there are no known issues there. In my testing at least I don't see any problems on SDMA. This is a prerequisite for fixing the Unsupported Request error reported through AER during driver load. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216373 The error was unnoticed before and got visible because of the commit referenced below. This doesn't fix anything in the commit below, rather fixes the issue in amdgpu exposed by the commit. The reference is only to associate this commit with below one so that both go together. Fixes: 8795e182b02d ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()") Acked-by: Christian König Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org (cherry picked from commit e3163bc8ffdfdb405e10530b140135b2ee487f89) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 22 ---------------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c index 66b6b175ae908..72e0f98099843 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c @@ -1510,6 +1510,11 @@ static int sdma_v4_0_start(struct amdgpu_device *adev) WREG32_SDMA(i, mmSDMA0_CNTL, temp); if (!amdgpu_sriov_vf(adev)) { + ring = &adev->sdma.instance[i].ring; + adev->nbio.funcs->sdma_doorbell_range(adev, i, + ring->use_doorbell, ring->doorbell_index, + adev->doorbell_index.sdma_doorbell_range); + /* unhalt engine */ temp = RREG32_SDMA(i, mmSDMA0_F32_CNTL); temp = REG_SET_FIELD(temp, SDMA0_F32_CNTL, HALT, 0); diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index 04040ff673a7c..04c564b4dc347 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c @@ -1262,22 +1262,6 @@ static int soc15_common_sw_fini(void *handle) return 0; } -static void soc15_doorbell_range_init(struct amdgpu_device *adev) -{ - int i; - struct amdgpu_ring *ring; - - /* sdma/ih doorbell range are programed by hypervisor */ - if (!amdgpu_sriov_vf(adev)) { - for (i = 0; i < adev->sdma.num_instances; i++) { - ring = &adev->sdma.instance[i].ring; - adev->nbio.funcs->sdma_doorbell_range(adev, i, - ring->use_doorbell, ring->doorbell_index, - adev->doorbell_index.sdma_doorbell_range); - } - } -} - static int soc15_common_hw_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -1297,12 +1281,6 @@ static int soc15_common_hw_init(void *handle) /* enable the doorbell aperture */ soc15_enable_doorbell_aperture(adev, true); - /* HW doorbell routing policy: doorbell writing not - * in SDMA/IH/MM/ACV range will be routed to CP. So - * we need to init SDMA/IH/MM/ACV doorbell range prior - * to CP ip block init and ring test. - */ - soc15_doorbell_range_init(adev); return 0; } From patchwork Thu Feb 9 05:54:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1739800 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=W+v8MhP0; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PC5gJ4nPFz23kw for ; Thu, 9 Feb 2023 16:55:08 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pPztd-0002r9-CB; Thu, 09 Feb 2023 05:55:01 +0000 Received: from mail-pj1-f51.google.com ([209.85.216.51]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pPzta-0002nt-DB for kernel-team@lists.ubuntu.com; Thu, 09 Feb 2023 05:54:58 +0000 Received: by mail-pj1-f51.google.com with SMTP id o13so1141846pjg.2 for ; Wed, 08 Feb 2023 21:54:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=2scyLDNRZu4IrA98sT50AY/6yOGVC1ufgdyftLbJsWw=; b=W+v8MhP0GrmqcULJdd/30thGbqRwOs3+sAv4FvGjx49Rqcpis54ayT+FoILSpPg0o0 S09EolMlxKIN3WPF8X0XA4Jr3bl+F95BGrYfcqBFJEDaUGIzkyonCNMpRGeQf5u/xBww h1EtfH0GcQlhMeS6HJYC/f8zokuJh91TrFlVapPaNOKymYClBoOr4mCIVJkDsqaVAnHj lLOXT19+RMq2qZAH8gxrgXN92NZ73A/FrjW+oelW4+qwCcHOvlMFL37y1NakZ6mLGs3+ /th30Jj1Ga2o/p8kJflqCq3Zx5OjErug+EYYX1Bynv0X9OvN/m9gnGj9O2ZDEykzTMU0 FiLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=2scyLDNRZu4IrA98sT50AY/6yOGVC1ufgdyftLbJsWw=; b=w1beG9M5fAn9f7M3MjAuyD2Eqpslmr629CdkqLY4juJU4cRaUjRXjTIZ9aJV0sO8dJ Wf1n8a63nxDt0A5U0Yzht53A1sRp9Xg2dSNFE+of4mjI4aRpxv5fHLVoRSGHzVhPYO1p Unw1HHGdlEl58Ld9cquL7F0KE3JWjeUbp7Wg+FmCR6ROOq7pvvLXzF493RdoL5LHmDjh qT7/42d5H+FcwQyN2btxSLsZuLawhFaH6UZMm0WCt5Vz0gThdZt1ICArSMNaAdQhKKqs rSFduXCZqCWWeKkPJbhW3CYBsvLJJn0rsEsasSyQfBRok9XZ7Xf1MV66FEsR7j0i8AYL adzg== X-Gm-Message-State: AO0yUKVSp9cb4bmZX0ZG+tBndZMeSWO4YgxqsdN5TYE0hsTl2MoDQLiN ztZT8WstxxldZRCza0elvzqEGs+CLvYFQA== X-Google-Smtp-Source: AK7set9HnJ5ozO6yg0emhf9MXbePeaXZ0cwAnuvn+FuCKHynxIYi58/rAvMl2DKQUT/CewxFH4bCmQ== X-Received: by 2002:a17:902:ea05:b0:194:828d:62b0 with SMTP id s5-20020a170902ea0500b00194828d62b0mr10768585plg.48.1675922096415; Wed, 08 Feb 2023 21:54:56 -0800 (PST) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id a11-20020a1709027e4b00b00189b2b8dbedsm455506pln.228.2023.02.08.21.54.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 21:54:55 -0800 (PST) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 3/4][SRU][OEM-5.17] drm/amdgpu: make sure to init common IP before gmc Date: Thu, 9 Feb 2023 13:54:32 +0800 Message-Id: <20230209055433.229851-4-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230209055433.229851-1-acelan.kao@canonical.com> References: <20230209055433.229851-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.216.51; envelope-from=acelan@gmail.com; helo=mail-pj1-f51.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Alex Deucher BugLink: https://launchpad.net/bugs/2000110 Move common IP init before GMC init so that HDP gets remapped before GMC init which uses it. This fixes the Unsupported Request error reported through AER during driver load. The error happens as a write happens to the remap offset before real remapping is done. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216373 The error was unnoticed before and got visible because of the commit referenced below. This doesn't fix anything in the commit below, rather fixes the issue in amdgpu exposed by the commit. The reference is only to associate this commit with below one so that both go together. Fixes: 8795e182b02d ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()") Acked-by: Christian König Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org (cherry picked from commit a8671493d2074950553da3cf07d1be43185ef6c6) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 7956089ed95a3..ce352aad42ff3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -2357,8 +2357,16 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) } adev->ip_blocks[i].status.sw = true; - /* need to do gmc hw init early so we can allocate gpu mem */ - if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { + if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON) { + /* need to do common hw init early so everything is set up for gmc */ + r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev); + if (r) { + DRM_ERROR("hw_init %d failed %d\n", i, r); + goto init_failed; + } + adev->ip_blocks[i].status.hw = true; + } else if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { + /* need to do gmc hw init early so we can allocate gpu mem */ /* Try to reserve bad pages early */ if (amdgpu_sriov_vf(adev)) amdgpu_virt_exchange_data(adev); @@ -3016,8 +3024,8 @@ static int amdgpu_device_ip_reinit_early_sriov(struct amdgpu_device *adev) int i, r; static enum amd_ip_block_type ip_order[] = { - AMD_IP_BLOCK_TYPE_GMC, AMD_IP_BLOCK_TYPE_COMMON, + AMD_IP_BLOCK_TYPE_GMC, AMD_IP_BLOCK_TYPE_PSP, AMD_IP_BLOCK_TYPE_IH, }; From patchwork Thu Feb 9 05:54:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1739801 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=KkN/kwKs; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PC5gQ307Fz23kw for ; Thu, 9 Feb 2023 16:55:14 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pPztj-0002yh-MQ; Thu, 09 Feb 2023 05:55:07 +0000 Received: from mail-pj1-f43.google.com ([209.85.216.43]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pPztg-0002tU-VW for kernel-team@lists.ubuntu.com; Thu, 09 Feb 2023 05:55:05 +0000 Received: by mail-pj1-f43.google.com with SMTP id d2so1104904pjd.5 for ; Wed, 08 Feb 2023 21:55:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=nXZnH9cz+PgikLcu7peXQDfpvA/1IRx6vww9hS/V/iA=; b=KkN/kwKsAChELXbHdNsblycPTmJzJrY+kFlzQjohCwE6IZ4IbctyQlKk6HWnTlIcry rgM1CrThoTlW6kHqDCdoCBGChSjP53rtYxelsbvbzL7fWfRvuMHQaexpOrxuIvtUztVQ RhMabUdmAjK6B21ureXXM+EIhRJiuqDV7qa8zVxTVl3lwFCITgD17abKtE8ipEpPzAzm vtJbaLV8gjlIZravnyOw95AU0vmvPo9ZTnty6mBhVvjg0d6KtN+qHdMDNO7s5fCR8a/I R93ORoC/hHdv6xbA7PYoLHAVBNJXknYrhv5JhIZmqczNoxpvWW1TfbYGQZGQxzo+z4Uq ny1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=nXZnH9cz+PgikLcu7peXQDfpvA/1IRx6vww9hS/V/iA=; b=x9vnEsbz+WjdiMz7lf7DpsOGEeRUPQLPs8kdJna1QEUHXg1mM7qnJcZk8PLTkS3Kd6 Z2Ha7KPAhM7msSZPuEv0gl44MjLqUdxGSLOQ9LwGNUkVJtH1eP24rQmcqg17ffEgH3tr g4W87SeHhFh/cGOkgKzAynZV+vzdsLaqQ3LqTLAJMcbjxADirqAFIrWcqDu4jR81N6XA pUmkivtzuJyrOqJqHNKN0RaZUPeWMbvBNjWmQTCoEiqMBSGaoS2xbwmVDlQqlxiqPGTQ VbqGlyuqXbyoqTG+1OXmBlx4ILz3+GAvM3ucgU8GH0J0LBQtukVkNiEhnrIi5G8Dnjbx Wp9g== X-Gm-Message-State: AO0yUKVX/Wl5le1JRQpo75/ov/XbgVqRJzcGI+rJofhHe2MEMa2fXUG4 KW7t+v9V4/g1vg5BpOWRjb2bOXtEy+wpVA== X-Google-Smtp-Source: AK7set+gH+dmYL/+ZArt9YIXDUNe5pdNUBiaL6vJzWDtIq3ZUSlv+YUGIC0x+SAI8Itc98Uj3XaGAA== X-Received: by 2002:a17:902:ea05:b0:194:828d:62b0 with SMTP id s5-20020a170902ea0500b00194828d62b0mr10768817plg.48.1675922102403; Wed, 08 Feb 2023 21:55:02 -0800 (PST) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id jk23-20020a170903331700b001926392adf9sm456657plb.271.2023.02.08.21.55.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 21:55:01 -0800 (PST) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 4/4][SRU][OEM-5.17] drm/amdgpu: fix sdma doorbell init ordering on APUs Date: Thu, 9 Feb 2023 13:54:33 +0800 Message-Id: <20230209055433.229851-5-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230209055433.229851-1-acelan.kao@canonical.com> References: <20230209055433.229851-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.216.43; envelope-from=acelan@gmail.com; helo=mail-pj1-f43.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Alex Deucher BugLink: https://launchpad.net/bugs/2000110 Commit 8795e182b02d ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()") uncovered a bug in amdgpu that required a reordering of the driver init sequence to avoid accessing a special register on the GPU before it was properly set up leading to an PCI AER error. This reordering uncovered a different hw programming ordering dependency in some APUs where the SDMA doorbells need to be programmed before the GFX doorbells. To fix this, move the SDMA doorbell programming back into the soc15 common code, but use the actual doorbell range values directly rather than the values stored in the ring structure since those will not be initialized at this point. This is a partial revert, but with the doorbell assignment fixed so the proper doorbell index is set before it's used. Fixes: e3163bc8ffdfdb ("drm/amdgpu: move nbio sdma_doorbell_range() into sdma code for vega") Acked-by: Christian König Signed-off-by: Alex Deucher Cc: skhan@linuxfoundation.org (cherry picked from commit 6c16afdcec20b01879ad17440f42c9944786dc7d) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 5 ----- drivers/gpu/drm/amd/amdgpu/soc15.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c index 72e0f98099843..66b6b175ae908 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c @@ -1510,11 +1510,6 @@ static int sdma_v4_0_start(struct amdgpu_device *adev) WREG32_SDMA(i, mmSDMA0_CNTL, temp); if (!amdgpu_sriov_vf(adev)) { - ring = &adev->sdma.instance[i].ring; - adev->nbio.funcs->sdma_doorbell_range(adev, i, - ring->use_doorbell, ring->doorbell_index, - adev->doorbell_index.sdma_doorbell_range); - /* unhalt engine */ temp = RREG32_SDMA(i, mmSDMA0_F32_CNTL); temp = REG_SET_FIELD(temp, SDMA0_F32_CNTL, HALT, 0); diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index 04c564b4dc347..ac1d2e08e6a4b 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c @@ -1262,6 +1262,20 @@ static int soc15_common_sw_fini(void *handle) return 0; } +static void soc15_sdma_doorbell_range_init(struct amdgpu_device *adev) +{ + int i; + + /* sdma doorbell range is programed by hypervisor */ + if (!amdgpu_sriov_vf(adev)) { + for (i = 0; i < adev->sdma.num_instances; i++) { + adev->nbio.funcs->sdma_doorbell_range(adev, i, + true, adev->doorbell_index.sdma_engine[i] << 1, + adev->doorbell_index.sdma_doorbell_range); + } + } +} + static int soc15_common_hw_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -1281,6 +1295,13 @@ static int soc15_common_hw_init(void *handle) /* enable the doorbell aperture */ soc15_enable_doorbell_aperture(adev, true); + /* HW doorbell routing policy: doorbell writing not + * in SDMA/IH/MM/ACV range will be routed to CP. So + * we need to init SDMA doorbell range prior + * to CP ip block init and ring test. IH already + * happens before CP. + */ + soc15_sdma_doorbell_range_init(adev); return 0; }