From patchwork Mon Nov 14 22:20:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lyude Paul X-Patchwork-Id: 20055 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2393782wru; Mon, 14 Nov 2022 14:24:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf6q4pinp+csIY41H8HuVQ0iGVEvFtp9iPUnfyQhbn3J5C5UVKyEg4X+6wdOIkD/+OLTVMHM X-Received: by 2002:a17:90a:4282:b0:212:f810:a846 with SMTP id p2-20020a17090a428200b00212f810a846mr16029663pjg.71.1668464682981; Mon, 14 Nov 2022 14:24:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668464682; cv=none; d=google.com; s=arc-20160816; b=G20flzb8j4SkyRYfF9oxB/aUc7bw+I1OHO6smnEguqgsQkelj5oQETQOUeZFLGAObh bvXz7Rqq+0dyaVQHolDEKMOaOkfGv+Zm6YrR0aTFWHK1Upb9HT65kedZDFcZ0RLsnVKg d5tHy7y/a6Vecn3XHHgvFExvYwO6+GwziYI6nZsyYtw8jNe37Z1Ib7/bWGxNpMlY51jL EoaP8k62Ae9YfpksvP0uRo91zcE1wNjYIYddw20x0FYsCpXo5gyLloTwCASM9RpONdqW Y3K5+b6bClQnF6NiY0c6LivZrFiVlhEkoJK7obS/4dly4olCzmFbMK0/qCraEyhDQZA5 I48Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=DEzbZbxMDVtgKO4mt4UPz1wY8+F4/UNYjVn0w1tPxSA=; b=BDOr+Q8YveZQda/zst6InR93UETHMlaRHLPBSXPj8d0FcxoL2N1jnFqW7e3Eod2flk 84QSLVJsFWfZx7mq2JW6gg7wfcCvyM2T6gFX1l60stAzwdZTrpNp1wuMZqPBNtFlBdB1 +KYzxNvsn6PTBsJq98EKfAYpYehl5MXmypxj5MvgergrOL+0dT2C6+8HWHpQ3lafln0y wtoE5U/8TXUksEKh+blgoxep/a33ftsptdmDTkxXM4aJR9WkxekZPisTV5l8lRzFUhoh dYQJf0o0yB08YtSGyov1pSkNdKL751nNxKDUHMupITJUYwQnTaLi1ZF6s9MphY1vCTZQ Fk8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JmwekxHY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 1-20020a630b01000000b004708630981asi10651830pgl.353.2022.11.14.14.24.29; Mon, 14 Nov 2022 14:24:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JmwekxHY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236151AbiKNWWW (ORCPT + 99 others); Mon, 14 Nov 2022 17:22:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230520AbiKNWWU (ORCPT ); Mon, 14 Nov 2022 17:22:20 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 439301B9D7 for ; Mon, 14 Nov 2022 14:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668464463; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=DEzbZbxMDVtgKO4mt4UPz1wY8+F4/UNYjVn0w1tPxSA=; b=JmwekxHYxJ8D7kkOcFQj6QT+NNer2PWgPIj1R02bzDEugAzlfqZqQz70hznB/+GWLDNiFA 7QToQHR9JbPxdNB7CAgQEW6tLLGsLEqQjwAaieP4DM2PDw3oTjKOekP0mhB8GO0PyHML1N jRqLaP8eWCtCqxe8fXhhcNTwEcrtXI8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-656-6FMgJgeyP1ayoZEDfjKcwA-1; Mon, 14 Nov 2022 17:20:59 -0500 X-MC-Unique: 6FMgJgeyP1ayoZEDfjKcwA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 80D9138012D2; Mon, 14 Nov 2022 22:20:58 +0000 (UTC) Received: from emerald.lyude.net (unknown [10.22.18.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CDD22166B46; Mon, 14 Nov 2022 22:20:57 +0000 (UTC) From: Lyude Paul To: amd-gfx@lists.freedesktop.org Cc: stable@vger.kernel.org, Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Alan Liu , Aurabindo Pillai , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] drm/amd/dc/dce120: Fix audio register mapping, stop triggering KASAN Date: Mon, 14 Nov 2022 17:20:45 -0500 Message-Id: <20221114222046.386560-1-lyude@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749512023237076237?= X-GMAIL-MSGID: =?utf-8?q?1749512023237076237?= There's been a very long running bug that seems to have been neglected for a while, where amdgpu consistently triggers a KASAN error at start: BUG: KASAN: global-out-of-bounds in read_indirect_azalia_reg+0x1d4/0x2a0 [amdgpu] Read of size 4 at addr ffffffffc2274b28 by task modprobe/1889 After digging through amd's rather creative method for accessing registers, I eventually discovered the problem likely has to do with the fact that on my dce120 GPU there are supposedly 7 sets of audio registers. But we only define a register mapping for 6 sets. So, fix this and fix the KASAN warning finally. Signed-off-by: Lyude Paul Cc: stable@vger.kernel.org Reviewed-by: Alex Deucher Reviewed-by: Harry Wentland --- Sending this one separately from the rest of my fixes since: * It's definitely completely unrelated to the Gitlab 2171 issue * I'm not sure if this is the correct fix since it's in DC drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c index 1b70b78e2fa15..af631085e88c5 100644 --- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c @@ -359,7 +359,8 @@ static const struct dce_audio_registers audio_regs[] = { audio_regs(2), audio_regs(3), audio_regs(4), - audio_regs(5) + audio_regs(5), + audio_regs(6), }; #define DCE120_AUD_COMMON_MASK_SH_LIST(mask_sh)\