Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3934369imm; Sun, 13 May 2018 23:30:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZou62bVtLDm+7wadGc7c0L65W5t1/m5SMmpv4MSzbNN6xF4eRIc/Bi+UU7xbnAlxiRHgcK3 X-Received: by 2002:a17:902:7288:: with SMTP id d8-v6mr8551846pll.218.1526279402922; Sun, 13 May 2018 23:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526279402; cv=none; d=google.com; s=arc-20160816; b=mGIGpoHSKp5dJaCfzm4CgvvZBENPm+L9ReEFBhS0HH92uRBDdhJEUmOhcoKWo1LPFt lXq5rLNCCCLZnD5gdfZ8pQf+qRuC1ZJVfhs6vpdfl4AH6IFC4gKT43q9poM39GbjNnsk pLrueMEqDa12NTT6Gj9tF0MvQoCuqYIiWn2/RJVaF0h7mT3thjs2U1iUF5l1B9Zr0Y92 FhUSIjNk2d9eAaukgTnx1lyG1Zzx4WkFkCzh7Z0N3HsxS1kuhJ4acZl6+s1INuA486is CloV4x5yaJ9p70tfsEX6ci3PX8dMrVGdZR4k9iAVTOtv9cIyoZ5PZKNa7Sk1vFCIA4gE 6LnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=ZmcN3GENLWHje7UDiTMQuKsaJB5QAN4xpd5IWrLy8Wo=; b=U3r0L06teud+5FjCcqtjkY8FUHvPfErToDMZrCBDPcXPOAM2sTWGZy31gBm9aIwZG8 d4FBojysW6lmujlJcdiTrqsf56iD44apNzJub659YiaRMQEhQod8e94JrD5IGUzVxbJ4 Urssyyd7C3bVw6M+BsT6l7+4yThEMZCpoq3P98vfxazqUpzbGiJOpT3OOPnIcbk9fbB4 wUns6+7hZOTIaXEXIj+xbL7rou4wDD18Azcx/sqfPcwr5kBNIgUG637wFAADyWShBsH+ jHzRRGO7OvRb0xcNxKIIkbou5M1Scw594dnamb6RS1urQt18RBSW1ghPEJgp2/xzy0TH vz5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OhjZ5nVX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s36-v6si8525701pld.114.2018.05.13.23.29.41; Sun, 13 May 2018 23:30:02 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=OhjZ5nVX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751980AbeENG1x (ORCPT + 99 others); Mon, 14 May 2018 02:27:53 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:38971 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751364AbeENG1w (ORCPT ); Mon, 14 May 2018 02:27:52 -0400 Received: by mail-lf0-f66.google.com with SMTP id j193-v6so16172841lfg.6 for ; Sun, 13 May 2018 23:27:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ZmcN3GENLWHje7UDiTMQuKsaJB5QAN4xpd5IWrLy8Wo=; b=OhjZ5nVXlUgacaA2DlabJmE9krOQNx5T3LGOPt9N2UKlQwKBApnwkmj02AiJgX1621 EtBkM7EtbemZ7SeqAS8T1AxOh1giun8aFUeaP+O/OG8aLkKHjxNs/RIWh7H6Gi0dJGSU 8hPhnNtWEaoIt1a86MjtvFoc+K5n91PTKFTqKk4aK2TPWoNjsJznUrwIK+AUDzPR014y Y7I2rc5SdC0gUnb42d3iTbUDo7tRjtStUZjUBthpMq9yUvWeMCJ9GeD7PNMGCUNfHU+v r4XPhehUh+0HD/5EX8KL76HexRGAGAVBOwrXnDEiU68yRy/kvSq1MOMLI46IOtpEDBr3 rD+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZmcN3GENLWHje7UDiTMQuKsaJB5QAN4xpd5IWrLy8Wo=; b=oCpVnL7jOpl/hVgAN+54aPpllrA3SSuj3dAgBUznb9rw0toYN+1zfN9OCkHluujIG2 F3fYV+tuApnEoGSpYwSM7OQtqfqr6sTYZKDwSoICF8rFLdX4TVr13fhO2fS9uiKH6scE 1bz02bRYu2qiNdCc/wvbCynYI2BwZTCQgGfkO6uqlzOy33YY5R7SjC6wL5ID8LD7gVWw rWAUzeIW+aZ+xtJ0Oj1iplxcMlz86qwCiXDQ3kmfqqnk8ZnMR4AWrMVg30OmzfMeTzTZ Q1JsRiKTov4zo8onudOPdoHlQtx9sWUam3sXAgzRWtH3hsOIZWOmHQ4vJ//v7IsY1dFo WNKQ== X-Gm-Message-State: ALKqPwdSMFZPpzksd1/XU3R20IF4HjEZBYDxkHlxhOaFI4D+p6I98vch Jmol0U5KT07KPT80dcRgBQI= X-Received: by 2002:a19:f00f:: with SMTP id p15-v6mr7878078lfc.77.1526279270831; Sun, 13 May 2018 23:27:50 -0700 (PDT) Received: from a2k-HP-ProDesk-600-G2-SFF.kyiv.epam.com (ll-54.209.223.85.sovam.net.ua. [85.223.209.54]) by smtp.gmail.com with ESMTPSA id k127-v6sm2187860lfe.21.2018.05.13.23.27.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 13 May 2018 23:27:49 -0700 (PDT) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, jgross@suse.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, perex@perex.cz, tiwai@suse.com Cc: andr2000@gmail.com, Oleksandr Andrushchenko Subject: [PATCH v3 0/6] ALSA: xen-front: Add Xen para-virtualized frontend driver Date: Mon, 14 May 2018 09:27:36 +0300 Message-Id: <20180514062742.25879-1-andr2000@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oleksandr Andrushchenko Please note: this patch series depends on [3]. This patch series adds support for Xen [1] para-virtualized sound frontend driver. It implements the protocol from include/xen/interface/io/sndif.h with the following limitations: - mute/unmute is not supported - get/set volume is not supported Volume control is not supported for the reason that most of the use-cases (at the moment) are based on scenarious where unprivileged OS (e.g. Android, AGL etc) use software mixers. Both capture and playback are supported. Corresponding backend, implemented as a user-space application, can be found at [2]. Thank you, Oleksandr Changes since v2: ***************** 1. Kconfig: select SND_PCM instead of depends 2. Changed spinlock to mutex for protecting the rings since all the interrupts are threaded. Make those per event channel, not a single global one. This also addresses Juergen's comment on calling xen_snd_front_alsa_handle_cur_pos. 3. Fixed page leak on error while allocating an event channel 4. Fixed comments to start from a capital letter 5. Performed XEN_PAGE_SIZE != PAGE_SIZE check after xen_domain and xen_has_pv_devices checks 6. Changed driver specific structures names not to mislead with ALSA structs 7. Added comments on ring counters and overflows 8. Added MAINTAINERS entry Changes since v1: ***************** 1. Moved driver from sound/drivers to sound/xen 2. Coding style changes to better meet Linux Kernel 3. Added explicit back and front synchronization In order to provide explicit synchronization between backend and frontend the following changes are introduced in the protocol: - add new ring buffer for sending asynchronous events from backend to frontend to report number of bytes played by the frontend (XENSND_EVT_CUR_POS) - introduce trigger events for playback control: start/stop/pause/resume - add "req-" prefix to event-channel and ring-ref to unify naming of the Xen event channels for requests and events 4. Added explicit back and front parameter negotiation In order to provide explicit stream parameter negotiation between backend and frontend the following changes are introduced in the protocol: add XENSND_OP_HW_PARAM_QUERY request to read/update configuration space for the parameters given: request passes desired parameter's intervals/masks and the response to this request returns allowed min/max intervals/masks to be used. [1] https://xenproject.org/ [2] https://github.com/xen-troops/snd_be [3] https://lkml.org/lkml/2018/4/12/522 Oleksandr Andrushchenko (6): ALSA: xen-front: Introduce Xen para-virtualized sound frontend driver ALSA: xen-front: Read sound driver configuration from Xen store ALSA: xen-front: Implement Xen event channel handling ALSA: xen-front: Implement handling of shared buffers ALSA: xen-front: Implement ALSA virtual sound driver MAINTAINERS: Add ALSA: xen-front: maintainer entry MAINTAINERS | 7 + sound/Kconfig | 2 + sound/Makefile | 2 +- sound/xen/Kconfig | 10 + sound/xen/Makefile | 9 + sound/xen/xen_snd_front.c | 397 +++++++++++++++ sound/xen/xen_snd_front.h | 54 ++ sound/xen/xen_snd_front_alsa.c | 821 ++++++++++++++++++++++++++++++ sound/xen/xen_snd_front_alsa.h | 23 + sound/xen/xen_snd_front_cfg.c | 517 +++++++++++++++++++ sound/xen/xen_snd_front_cfg.h | 46 ++ sound/xen/xen_snd_front_evtchnl.c | 496 ++++++++++++++++++ sound/xen/xen_snd_front_evtchnl.h | 95 ++++ sound/xen/xen_snd_front_shbuf.c | 193 +++++++ sound/xen/xen_snd_front_shbuf.h | 36 ++ 15 files changed, 2707 insertions(+), 1 deletion(-) create mode 100644 sound/xen/Kconfig create mode 100644 sound/xen/Makefile create mode 100644 sound/xen/xen_snd_front.c create mode 100644 sound/xen/xen_snd_front.h create mode 100644 sound/xen/xen_snd_front_alsa.c create mode 100644 sound/xen/xen_snd_front_alsa.h create mode 100644 sound/xen/xen_snd_front_cfg.c create mode 100644 sound/xen/xen_snd_front_cfg.h create mode 100644 sound/xen/xen_snd_front_evtchnl.c create mode 100644 sound/xen/xen_snd_front_evtchnl.h create mode 100644 sound/xen/xen_snd_front_shbuf.c create mode 100644 sound/xen/xen_snd_front_shbuf.h -- 2.17.0