From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DE59C433E0 for ; Wed, 3 Feb 2021 17:35:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B28B164E40 for ; Wed, 3 Feb 2021 17:35:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232108AbhBCRfB (ORCPT ); Wed, 3 Feb 2021 12:35:01 -0500 Received: from mx1.opensynergy.com ([217.66.60.4]:46830 "EHLO mx1.opensynergy.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231801AbhBCRe5 (ORCPT ); Wed, 3 Feb 2021 12:34:57 -0500 Received: from SR-MAILGATE-02.opensynergy.com (localhost.localdomain [127.0.0.1]) by mx1.opensynergy.com (Proxmox) with ESMTP id DEDB2A15A4; Wed, 3 Feb 2021 18:34:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=opensynergy.com; h=cc:cc:content-transfer-encoding:content-type:content-type :date:from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=srmailgate02; bh=6JriUFT4K4Gw YTQBWmEFwOKzOJIBhwKv+n4I3Bk9mZ4=; b=ZS9V4YZ72FWVi7jLDWcSYcAxKf+E q4/rbVgU+kTQKo0+HohUXRP4aRJctXkwRTS7slZVNXGVKEiK9xYezJH9qleb++ty JDcfELO4n6iMqRMMd0uR7JoH2qOXonsSXmUprzdqEdYgcb9UJ5qN8waT3PmM2XPN dlUUlFCn3FynQI2qXzqEURdH7WoJ1zk7yMy89/tIPNhS8TiZERrSlg8ybV0LKvN4 OLsmqvjaD56VsoWRsLLSzTwfxCW8IgfMgG9uVJemr/v2fqHOTROjmkg4MgFGNlYR JULqEYM8W+YWDNKrq+WzFkkvkBm5hy9haTBbLVTHCkGRzuKehKmn9ICG+w== Subject: Re: [virtio-dev] Re: [PATCH v2 2/9] ALSA: virtio: add virtio sound driver To: Takashi Iwai CC: Guennadi Liakhovetski , , , , , Jaroslav Kysela , Takashi Iwai , "Michael S. Tsirkin" References: <20210124165408.1122868-1-anton.yakovlev@opensynergy.com> <20210124165408.1122868-3-anton.yakovlev@opensynergy.com> <8754dae8-114-6383-510-de2ba9dc4fa@intel.com> <52f71ac6-3ec7-2884-7a64-1995f416d20a@opensynergy.com> From: Anton Yakovlev Message-ID: Date: Wed, 3 Feb 2021 18:34:12 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SR-MAIL-01.open-synergy.com (10.26.10.21) To SR-MAIL-01.open-synergy.com (10.26.10.21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Takashi, On 03.02.2021 17:59, Takashi Iwai wrote: > On Tue, 02 Feb 2021 00:18:09 +0100, > Anton Yakovlev wrote: >>>> +/** >>>> + * virtsnd_reset_fn() - Kernel worker's function to reset the device. >>>> + * @work: Reset device work. >>>> + * >>>> + * Context: Process context. >>>> + */ >>>> +static void virtsnd_reset_fn(struct work_struct *work) >>>> +{ >>>> + struct virtio_snd *snd = >>>> + container_of(work, struct virtio_snd, reset_work); >>>> + struct virtio_device *vdev = snd->vdev; >>>> + struct device *dev = &vdev->dev; >>>> + int rc; >>>> + >>>> + dev_info(dev, "sound device needs reset\n"); >>>> + >>>> + /* >>>> + * It seems that the only way to properly reset the device is to >>>> remove >>>> + * and re-create the ALSA sound card device. >>>> + * >>>> + * Also resetting the device involves a number of steps with >>>> setting the >>>> + * status bits described in the virtio specification. And the >>>> easiest >>>> + * way to get everything right is to use the virtio bus interface. >>>> + */ >>>> + rc = dev->bus->remove(dev); >>>> + if (rc) >>>> + dev_warn(dev, "bus->remove() failed: %d", rc); >>>> + >>>> + rc = dev->bus->probe(dev); >>>> + if (rc) >>>> + dev_err(dev, "bus->probe() failed: %d", rc); >>> >>> This looks very suspicious to me. Wondering what ALSA maintainers >> will say >>> to this. >> >> I'm also wondering what the virtio people have to say. This part is a >> purely virtio specific thing. And since none of the existing virtio >> drivers processes the request to reset the device, it is not clear what >> is the best way to proceed here. For this reason, the most >> straightforward and simple solution was chosen. > > What is this "reset" actually supposed to do? Reconfguring > everything, or changing only certain parameters, devices, whatever? It means bringing this particular device to its initial state. After that, the driver can re-read the configurations from the device and reconfigure everything. > thanks, > > Takashi > -- Anton Yakovlev Senior Software Engineer OpenSynergy GmbH Rotherstr. 20, 10245 Berlin