Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp1724923rwb; Sun, 4 Sep 2022 00:28:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR71tX3BKg4eRI0Y6MdsdApJf4LCDSpfSBv0gQ5604wJt1TATvOk3/KOPM4QjkOrwhmdgjn+ X-Received: by 2002:a63:2b97:0:b0:434:149e:101f with SMTP id r145-20020a632b97000000b00434149e101fmr4218696pgr.137.1662276532994; Sun, 04 Sep 2022 00:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662276532; cv=none; d=google.com; s=arc-20160816; b=lJRMxSrv0/gl88Hv6zN9t1T7IHz8/jsg38Zw9iOdbx/QaSRVDnd/2kJCA9Gc5GgkfM DeAs/gsNmvLVVIiYqbJ8e00u3ff5xFhSn+PxLJRs+gE85BcWchB9sw7raXyviSoJSpLH kHdtFNv4hpio2nZyZOXXAzSdws0WtMPmODOoVZmsnK4TyTfaxLYfZVqJ8aKuuVOTXh3M cwZbGSC+ZIkZ0HZl/wR1Q5xLiY28UzyNyaaO+FGDzpJm8IP9aTbid91s78hNS6iHSZDy qUxRmI3Q379AxP5jrSYkGII/8NUQK4cK5nXWyqe0s3Yl5/kDn7P9muxlHCdGIEu3qSTx N+Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=m3QZT9nBhXHroliaxvizZCMetCynso1mJ8WpdlhAaBg=; b=JT10SMFVcsfAo10znaC8z2i22E3LzsiY7k2XquP/vkY5hBgtu2n0l2cEt/UAek7rhe Gt4T18bz/sBLMLBi2CrctgL249Eaizda34AK/gcEajh54wiR7eSWCWxwtfFOHBSgH76g 2RgyMuxPfPg69P9mTIkmedANCrMJRNB5ZJZ0WE/wzo07YTRdbn6+SsYm0e/Q5tn+bFp1 xuHFkPBHcgPVhEEmSB2BhuAzVLAJJhLYv839ngOg9WbHI+/duje4H1qT3QwkcqZg+/Tj GXYFf6wiKmEYkmuqqOHQNQ9SPFs6WjuWq7AISkWYk3xG7L3S3vRhhnMAvmJFLfSIPCBH 7QVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="c9mdEr/V"; dkim=neutral (no key) header.i=@suse.de header.b=KesrAzIK; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t69-20020a637848000000b00415d8740505si7083562pgc.499.2022.09.04.00.28.34; Sun, 04 Sep 2022 00:28:52 -0700 (PDT) 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=@suse.de header.s=susede2_rsa header.b="c9mdEr/V"; dkim=neutral (no key) header.i=@suse.de header.b=KesrAzIK; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232681AbiIDHX6 (ORCPT + 99 others); Sun, 4 Sep 2022 03:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbiIDHX5 (ORCPT ); Sun, 4 Sep 2022 03:23:57 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A10546229; Sun, 4 Sep 2022 00:23:55 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B469E20B56; Sun, 4 Sep 2022 07:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1662276233; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=m3QZT9nBhXHroliaxvizZCMetCynso1mJ8WpdlhAaBg=; b=c9mdEr/VO7TZvBypPlRdLBkiLeu94zTRJLKx/4CqETNxeDNZ2f2RguPCPIxv7ouA0h3QMF 3t+t3w/tnzIyfBgskl9PSZ2R4Eq7mglVcLw7ZQIZdFP7D9dDqJjBLTUxrxbO7ocYUyvV3w B0XCjnZBoqlnpMVy7RGhj0Yu/9KQeCI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1662276233; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=m3QZT9nBhXHroliaxvizZCMetCynso1mJ8WpdlhAaBg=; b=KesrAzIKewkyZJ48A+l/FGvKAkBICXOGmlE3UBENjA7azdXixBaztnCmmtsGSMURU74NbF vQC9NU2ALLsdTCAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 93F4713A6B; Sun, 4 Sep 2022 07:23:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id xpI3I4lSFGNaXQAAMHmgww (envelope-from ); Sun, 04 Sep 2022 07:23:53 +0000 Date: Sun, 04 Sep 2022 09:23:53 +0200 Message-ID: <87ilm3vbzq.wl-tiwai@suse.de> From: Takashi Iwai To: Mikhail Gavrilov Cc: tiwai@suse.de, Linux List Kernel Mailing , linux-sound@vger.kernel.org Subject: Re: [BUG] commit a8d302a0b77057568350fe0123e639d02dba0745 cause IO_PAGE_FAULT and a lot of errors In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 On Sat, 03 Sep 2022 20:04:19 +0200, Mikhail Gavrilov wrote: > > Hi, I am bisecting issue that cause errors: > [ 57.710235] snd_hda_intel 0000:03:00.1: spurious response > 0xeb0cce6a:0x8b612b0d, rp = 1, wp = 1 > [ 57.710240] ------------[ cut here ]------------ > [ 57.710241] BUG? > [ 57.710257] amd_iommu_report_page_fault: 216 callbacks suppressed > [ 57.710260] snd_hda_intel 0000:03:00.1: AMD-Vi: Event logged > [IO_PAGE_FAULT domain=0x000e address=0x152848808 flags=0x0020] Grr... again hitting an issue with AMD IOMMU... > and bisect said this commit causes it: > a8d302a0b77057568350fe0123e639d02dba0745 is the first bad commit > commit a8d302a0b77057568350fe0123e639d02dba0745 > Author: Takashi Iwai > Date: Sun Aug 21 17:59:11 2022 +0200 > > ALSA: memalloc: Revive x86-specific WC page allocations again OK, could you try the patch below? I wonder whether this is specific to CORB/RIRB mapping or generically about the transfer buffers. Takashi --- diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h index f5bf295eb830..d4b146da0863 100644 --- a/sound/pci/hda/hda_controller.h +++ b/sound/pci/hda/hda_controller.h @@ -28,12 +28,12 @@ #else #define AZX_DCAPS_I915_COMPONENT 0 /* NOP */ #endif -/* 14 unused */ +#define AZX_DCAPS_WC_CORB_RIRB (1 << 14) /* WC pages for CORB/RIRB */ #define AZX_DCAPS_CTX_WORKAROUND (1 << 15) /* X-Fi workaround */ #define AZX_DCAPS_POSFIX_LPIB (1 << 16) /* Use LPIB as default */ #define AZX_DCAPS_AMD_WORKAROUND (1 << 17) /* AMD-specific workaround */ #define AZX_DCAPS_NO_64BIT (1 << 18) /* No 64bit address */ -/* 19 unused */ +#define AZX_DCAPS_WC_BUFFER (1 << 19) /* allocate non-cached buffer */ #define AZX_DCAPS_OLD_SSYNC (1 << 20) /* Old SSYNC reg for ICH */ #define AZX_DCAPS_NO_ALIGN_BUFSIZE (1 << 21) /* no buffer size alignment */ /* 22 unused */ diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index bf9df9bc8f1b..cccd42b9d489 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -295,7 +295,7 @@ enum { /* quirks for ATI HDMI with snoop off */ #define AZX_DCAPS_PRESET_ATI_HDMI_NS \ - (AZX_DCAPS_PRESET_ATI_HDMI | AZX_DCAPS_SNOOP_OFF) + (AZX_DCAPS_PRESET_ATI_HDMI | AZX_DCAPS_SNOOP_OFF | AZX_DCAPS_WC_BUFFER) /* quirks for AMD SB */ #define AZX_DCAPS_PRESET_AMD_SB \ @@ -310,7 +310,7 @@ enum { #define AZX_DCAPS_PRESET_CTHDA \ (AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB |\ - AZX_DCAPS_NO_64BIT |\ + AZX_DCAPS_NO_64BIT | AZX_DCAPS_WC_CORB_RIRB | AZX_DCAPS_WC_BUFFER|\ AZX_DCAPS_4K_BDLE_BOUNDARY | AZX_DCAPS_SNOOP_OFF) /* @@ -1692,6 +1692,8 @@ static void azx_check_snoop_available(struct azx *chip) snoop ? "snoop" : "non-snoop"); chip->snoop = snoop; chip->uc_buffer = !snoop; + if (!snoop) + azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC; return; } @@ -1712,12 +1714,11 @@ static void azx_check_snoop_available(struct azx *chip) snoop = false; chip->snoop = snoop; - if (!snoop) { + if (!snoop) dev_info(chip->card->dev, "Force to non-snoop mode\n"); - /* C-Media requires non-cached pages only for CORB/RIRB */ - if (chip->driver_type != AZX_DRIVER_CMEDIA) - chip->uc_buffer = true; - } + if (chip->driver_caps & AZX_DCAPS_WC_CORB_RIRB) + azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC; + chip->uc_buffer = !!(chip->driver_caps & AZX_DCAPS_WC_BUFFER); } static void azx_probe_work(struct work_struct *work) @@ -1808,10 +1809,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, if (err < 0) return err; - /* use the non-cached pages in non-snoop mode */ - if (!azx_snoop(chip)) - azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC; - if (chip->driver_type == AZX_DRIVER_NVIDIA) { dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n"); chip->bus.core.needs_damn_long_delay = 1; @@ -2756,7 +2753,8 @@ static const struct pci_device_id azx_ids[] = { /* CM8888 */ { PCI_DEVICE(0x13f6, 0x5011), .driver_data = AZX_DRIVER_CMEDIA | - AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB | AZX_DCAPS_SNOOP_OFF }, + AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB | AZX_DCAPS_SNOOP_OFF | + AZX_DCAPS_WC_CORB_RIRB }, /* Vortex86MX */ { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC }, /* VMware HDAudio */