Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3431111imu; Sun, 11 Nov 2018 14:57:54 -0800 (PST) X-Google-Smtp-Source: AJdET5dM3f3UOsBW0gFQCqfQfjuuY8DVJbnFnKc+p/AXsVBS5WEhYI/iEr01NG+WMMF0OMBfvrXm X-Received: by 2002:a65:6491:: with SMTP id e17mr15231724pgv.418.1541977074617; Sun, 11 Nov 2018 14:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977074; cv=none; d=google.com; s=arc-20160816; b=s1uYeCbs9iCyazajMZQTgP32wTroiX5bJwgLVnjah1CLi/HURYEiEiJ0ZxHgx0kWIM YLLYPRpM+LIQwc0FvJUMPTAzwbW+zG2PQbXaFE/8ngYZmkQlwNFdgJU5a6b2ugkMmwF3 bDmNOG2IhxCEQ/Hq7PWp2LEg8xhKJIvF3S13FFc2LK1hajjPlDb7y93C17yVitJsrSaZ mU5RRdO2T8hwaYpZLrGK3IuZETa0Jsw6NT5BMqpJ793Zo2HNrG+b0yAkXHgTUniDsXf9 5MvjhPOSvHsZ9djkTdPB/teMSWM+rbYm9Sg/+DDxHjP1FJXI3emS1VhxTv2JVMQy58wO h3pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tU1TtS5spS3e6IYLjVWc3duIYCKfqSAS23UGWR+N90A=; b=ImDn6S5BJhafFrcBmwFVQ0H2IKse5lQF1TNVKBkO2Oc6NcAZNEn8iVBtJP3w+Q6nwp 0Lv60fFvcLOiheHo+pe1AYgO9PDsk6o6YBd7twDGhSwCReFS8HzUDNbsqu9sJuJnCo9r ST8DBGjxE1SbQvx2blgjarBlNuTG0Rs/MjMEExsLKJbesgt56nZeJuWUFFRq91ca5PZQ ny77Y0a1p6l/F1xLLHUuRtKWnZ2porlHXvsbhM/6/fszyiVWc2XH/mnm9sLJ9UOdnff6 YRi0A/guKYpweXD7nfdL3IKJsXGuoGNxuNRrPOAmZzNc5h4KjLSkhNmEXK+JQMV3nGDX BDMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IEXvxC9C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19-v6si14153149pfb.81.2018.11.11.14.57.39; Sun, 11 Nov 2018 14:57:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IEXvxC9C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391132AbeKLIrU (ORCPT + 99 others); Mon, 12 Nov 2018 03:47:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:54376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387600AbeKLIWr (ORCPT ); Mon, 12 Nov 2018 03:22:47 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 37BF321582; Sun, 11 Nov 2018 22:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975569; bh=nXHc6oucnsDML8PkHS1KVGsyC4/rwYYVkXIwnmQ3HuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IEXvxC9C4PhMbevzEWMTfrZT+sxt4eWvhrjnHBCBTSQH5y/2wI4pzktZN1YCc1d1a MzLRLtrr5CSzgBz/RNL7yU0v9900i8uBCNu0NbCoJ2chcCFNIPglXtBtaVB5gFcsU5 gaBwc59bKJLTdtEzuYzQwE0+FGWU4Mc8Dcrgyw5c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 4.14 108/222] ALSA: hda: Check the non-cached stream buffers more explicitly Date: Sun, 11 Nov 2018 14:23:25 -0800 Message-Id: <20181111221657.485405615@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Iwai [ Upstream commit 78c9be61c3a5cd9e2439fd27a5ffad73a81958c7 ] Introduce a new flag, uc_buffer, to indicate that the controller requires the non-cached pages for stream buffers, either as a chip-specific requirement or specified via snoop=0 option. This improves the code-readability. Also, this patch fixes the incorrect behavior for C-Media chip where the stream buffers were never handled as non-cached due to the check of driver_type even if you pass snoop=0 option. Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/hda_controller.h | 1 + sound/pci/hda/hda_intel.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) --- a/sound/pci/hda/hda_controller.h +++ b/sound/pci/hda/hda_controller.h @@ -160,6 +160,7 @@ struct azx { unsigned int msi:1; unsigned int probing:1; /* codec probing phase */ unsigned int snoop:1; + unsigned int uc_buffer:1; /* non-cached pages for stream buffers */ unsigned int align_buffer_size:1; unsigned int region_requested:1; unsigned int disabled:1; /* disabled by vga_switcheroo */ --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -410,7 +410,7 @@ static void __mark_pages_wc(struct azx * #ifdef CONFIG_SND_DMA_SGBUF if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG) { struct snd_sg_buf *sgbuf = dmab->private_data; - if (chip->driver_type == AZX_DRIVER_CMEDIA) + if (!chip->uc_buffer) return; /* deal with only CORB/RIRB buffers */ if (on) set_pages_array_wc(sgbuf->page_table, sgbuf->pages); @@ -1634,6 +1634,7 @@ static void azx_check_snoop_available(st dev_info(chip->card->dev, "Force to %s mode by module option\n", snoop ? "snoop" : "non-snoop"); chip->snoop = snoop; + chip->uc_buffer = !snoop; return; } @@ -1654,8 +1655,12 @@ static void azx_check_snoop_available(st 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; + } } static void azx_probe_work(struct work_struct *work) @@ -2094,7 +2099,7 @@ static void pcm_mmap_prepare(struct snd_ #ifdef CONFIG_X86 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); struct azx *chip = apcm->chip; - if (!azx_snoop(chip) && chip->driver_type != AZX_DRIVER_CMEDIA) + if (chip->uc_buffer) area->vm_page_prot = pgprot_writecombine(area->vm_page_prot); #endif }