From patchwork Wed Nov 23 14:44:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 627922 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp3207857pvb; Wed, 23 Nov 2022 06:46:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf5JoL23zmLw9lL7vRnHCw6Mae3eBB4ZfA75iDQ2C6B8YW2URP7b39DN/Fwys9KU4nPCLxYQ X-Received: by 2002:ac8:138b:0:b0:3a5:621e:eb9a with SMTP id h11-20020ac8138b000000b003a5621eeb9amr26863857qtj.265.1669214817751; Wed, 23 Nov 2022 06:46:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669214817; cv=none; d=google.com; s=arc-20160816; b=a5UXkuSjy8Jwsh4E5kP/1pRdnVIoSkM5S2GBdx9T1rmzMDpkM+LP/XIXHEY3ZG4t8l MJxOzZ73/u2xcqH7x6Gzm8pmdvYPID0p/1WPA85CLOk3IdTizKplZj1lZ6UinmSzyf9t 4VhbFAo/v2x8TVG56P1He2r5Oiz0jnkkttAS/LiC6GpT9LgB6jAkIFuOYnnKluIFzFPY K/BedbJfx47wwGx715Cm6ENRL2sy8vEU66ErPfnnSPAIj7f4yqcuM7XLOr018JDLqSG9 Zh+l7pwIAi1GMogXvP/4H3i1PBPnHSZUJaqNF37EZoxP9YxHcUdv8iQLtZX47vEl/6Q0 ECIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CFJmsVGFRZoFr6oEdGcy/0jBFL6EKJZVl6FrLKF4sA4=; b=ssZ7yT77wkaMykSB5fSy7bAolEIotqIaJLlwQ0iYU0cJPSo1zF35MFzn9sglNs9UNi yRW1aY04U2fXOVO+8AkcPpN/Ju9yOaKpbXRjObx3Vt5Ok5g3ToxYxHvW1A7b2PyJUa10 fZwgaDUvvtpUe4K8qM20vnumDoAYDFgullUB51RW8WjEBR680JhDyu0Q3kunlft99QOm DiKOueDBPtVTUap310ictzxjGIvEwPG7vk14NhlQZHd6xsLhyIL6Jceo37Swf83GNs5A TFxID2wiFhrbENDymZTqMc4zBZj5XXvfpDYjkK0GFcy+MV288ychvKmVpoYr8f8ENzS8 AwwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BNnPbdXG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bc11-20020a05622a1ccb00b003a578caa86esi9488844qtb.645.2022.11.23.06.46.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Nov 2022 06:46:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BNnPbdXG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxqzj-0004G0-AC; Wed, 23 Nov 2022 09:44:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxqzh-0004Fd-Uc for qemu-devel@nongnu.org; Wed, 23 Nov 2022 09:44:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxqzg-0002wu-Fn for qemu-devel@nongnu.org; Wed, 23 Nov 2022 09:44:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669214695; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFJmsVGFRZoFr6oEdGcy/0jBFL6EKJZVl6FrLKF4sA4=; b=BNnPbdXG1qZnLp8+2Dj9DfSEReKPKm250P/H24U+1NgEjXzdDTcNyvlfVmlPS55V16QfDb vMUwGWel88z4ZcCwiH/+QkmqxfoB+cn6GVLBhnMHtLyuDS7rSALPFNfZN8KoT24Pn66Ize 3xwK7gfIptCNutP9dcjMXLleAMr2lMQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-543-53e-JvYfOzGFPsCJyjrqPg-1; Wed, 23 Nov 2022 09:44:52 -0500 X-MC-Unique: 53e-JvYfOzGFPsCJyjrqPg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 17E69811E67; Wed, 23 Nov 2022 14:44:52 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D5227492B07; Wed, 23 Nov 2022 14:44:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 20EC21800622; Wed, 23 Nov 2022 15:44:37 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Peter Maydell Subject: [PULL 6/7] hw/audio/intel-hda: don't reset codecs twice Date: Wed, 23 Nov 2022 15:44:35 +0100 Message-Id: <20221123144436.2141069-7-kraxel@redhat.com> In-Reply-To: <20221123144436.2141069-1-kraxel@redhat.com> References: <20221123144436.2141069-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell Currently the intel-hda device has a reset method which manually resets all the codecs by calling device_legacy_reset() on them. This means they get reset twice, once because child devices on a qbus get reset before the parent device's reset method is called, and then again because we're manually resetting them. Drop the manual reset call, and ensure that codecs are still reset when the guest does a reset via ICH6_GCTL_RESET by using device_cold_reset() (which resets all the devices on the qbus as well as the device itself) instead of a direct call to the reset function. This is a slight ordering change because the (only) codec reset now happens before the controller registers etc are reset, rather than once before and then once after, but the codec reset function hda_audio_reset() doesn't care. This lets us drop a use of device_legacy_reset(), which is deprecated. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20221014142632.2092404-2-peter.maydell@linaro.org> Signed-off-by: Gerd Hoffmann --- hw/audio/intel-hda.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index f38117057b9b..38cfa20262e2 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -516,7 +516,7 @@ static void intel_hda_notify_codecs(IntelHDAState *d, uint32_t stream, bool runn static void intel_hda_set_g_ctl(IntelHDAState *d, const IntelHDAReg *reg, uint32_t old) { if ((d->g_ctl & ICH6_GCTL_RESET) == 0) { - intel_hda_reset(DEVICE(d)); + device_cold_reset(DEVICE(d)); } } @@ -1083,11 +1083,9 @@ static void intel_hda_reset(DeviceState *dev) intel_hda_regs_reset(d); d->wall_base_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); - /* reset codecs */ QTAILQ_FOREACH(kid, &d->codecs.qbus.children, sibling) { DeviceState *qdev = kid->child; cdev = HDA_CODEC_DEVICE(qdev); - device_legacy_reset(DEVICE(cdev)); d->state_sts |= (1 << cdev->cad); } intel_hda_update_irq(d);