Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32C99C433F5 for ; Tue, 22 Mar 2022 20:20:42 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B9575176B; Tue, 22 Mar 2022 21:19:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B9575176B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1647980440; bh=/sqcPjJoCbdEfCxLS9PuzTCVxkfTstL32imFWoeyr6M=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YSaNXykH+2jdyFh+EQT25aPIemSbKiiI2TBrH+bx91YdZIhX47SZtf4D8ZK/ex5D5 0WNC2Zu4fSnBxtYlKC64pE/TevK8a2OzoWxPNQyALHorVdKGjEGaUcNn2y2ijoOOl+ nmktk8Blj/aHcqp/pYabeI0ZokAGDu4e5eq008pY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4F856F800FD; Tue, 22 Mar 2022 21:19:50 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2F8C0F8016C; Tue, 22 Mar 2022 21:19:49 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 13EA3F800FD for ; Tue, 22 Mar 2022 21:19:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 13EA3F800FD Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="2VMkNtVy"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="282Tqp4t" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 8936A210F0; Tue, 22 Mar 2022 20:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1647980382; 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=RDu8+8KyMEJU/CVSnVnZUameDbj6pZddLWhND1q5Zlc=; b=2VMkNtVyE0qvwO1Pev844Dz9+GEyRpSvXoIRqnVciPan2s7HG9l7bsBvA7hQKRUASi4K5H DehNAKJS+NHAuBKdAlslPRJ371uGrv4B3sz3qAR6IuuhosH4gmWm6rFf/ePzxQhtJRx/uV Zqaq2g2W0R5mExLkH1zk218AKYOsFQY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1647980382; 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=RDu8+8KyMEJU/CVSnVnZUameDbj6pZddLWhND1q5Zlc=; b=282Tqp4tZdYdGglVyxAy6Kt3FqTHIc2C/rPSpRDtpjaxjURz8dNmsA2nLJntD7lbCPVcix nOmiq3cAQRcKeXDQ== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 7523EA3B81; Tue, 22 Mar 2022 20:19:42 +0000 (UTC) Date: Tue, 22 Mar 2022 21:19:42 +0100 Message-ID: From: Takashi Iwai To: Giacomo Guiduzzi Subject: Re: [PATCH BUGFIX] ALSA: pci: fix reading of swapped values from pcmreg in AC97 codec In-Reply-To: <20220322200653.15862-1-guiduzzi.giacomo@gmail.com> References: <20220322200653.15862-1-guiduzzi.giacomo@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org, paolo.valente@linaro.org, tiwai@suse.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Tue, 22 Mar 2022 21:06:54 +0100, Giacomo Guiduzzi wrote: > > Tests 72 and 78 for ALSA in kselftest fail due to reading > inconsistent values from some devices on a VirtualBox > Virtual Machine using the snd_intel8x0 driver for the AC'97 > Audio Controller device. > Taking for example test number 72, this is what the test reports: > "Surround Playback Volume.0 expected 1 but read 0, is_volatile 0" > "Surround Playback Volume.1 expected 0 but read 1, is_volatile 0" > These errors repeat for each value from 0 to 31. > > Taking a look at these error messages it is possible to notice > that the written values are read back swapped. > When the write is performed, these values are initially stored in > an array used to sanity-check them and write them in the pcmreg > array. To write them, the two one-byte values are packed together > in a two-byte variable through bitwise operations: the first > value is shifted left by one byte and the second value is stored in the > right byte through a bitwise OR. When reading the values back, > right shifts are performed to retrieve the previously stored > bytes. These shifts are executed in the wrong order, thus > reporting the values swapped as shown above. > > This patch fixes this mistake by reversing the read > operations' order. > > Signed-off-by: Giacomo Guiduzzi > Signed-off-by: Paolo Valente Thanks, applied now. Takashi