Skip to contentSkip to conversation

ALSA: xen-front: Add Xen para-virtualized frontend driver

PATCH Superseded Oleksandr Andrushchenko 4 participants 37 messages May 14, 2018 – May 23, 2018

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH v3 1/6 ALSA: xen-front: Introduce Xen para-virtualized sound frontend driver

In reply to Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

Introduce skeleton of the para-virtualized Xen sound frontend driver.

Initial handling for Xen bus states: implement
Xen bus state machine for the frontend driver according to the state diagram and recovery flow from sound para-virtualized
protocol: xen/interface/io/sndif.h.

---
 sound/Kconfig             |   2 +
 sound/Makefile            |   2 +-
 sound/xen/Kconfig         |  10 ++
 sound/xen/Makefile        |   5 +
 sound/xen/xen_snd_front.c | 196 ++++++++++++++++++++++++++++++++++++++
 sound/xen/xen_snd_front.h |  18 ++++
 6 files changed, 232 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
sound/Kconfig +2 -0
index 6833db9002ec..1140e9988fc5 100644
@@ -96,6 +96,8 @@ source "sound/x86/Kconfig"
 
 source "sound/synth/Kconfig"
 
+source "sound/xen/Kconfig"
+
 endif # SND
 
 endif # !UML
sound/Makefile +1 -1
index 99d8c31262c8..797ecdcd35e2 100644
@@ -5,7 +5,7 @@
 obj-$(CONFIG_SOUND) += soundcore.o
 obj-$(CONFIG_DMASOUND) += oss/dmasound/
 obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \
-	firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ x86/
+	firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ x86/ xen/
 obj-$(CONFIG_SND_AOA) += aoa/
 
 # This one must be compilable even if sound is configured out
sound/xen/Kconfig new file +10 -0
new file mode 100644
index 000000000000..4f1fceea82d2
@@ -0,0 +1,10 @@
+# ALSA Xen drivers
+
+config SND_XEN_FRONTEND
+	tristate "Xen para-virtualized sound frontend driver"
+	depends on XEN
+	select SND_PCM
+	select XEN_XENBUS_FRONTEND
+	help
+	  Choose this option if you want to enable a para-virtualized
+	  frontend sound driver for Xen guest OSes.
sound/xen/Makefile new file +5 -0
new file mode 100644
index 000000000000..4507ef3c27fd
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0 OR MIT
+
+snd_xen_front-objs := xen_snd_front.o
+
+obj-$(CONFIG_SND_XEN_FRONTEND) += snd_xen_front.o
sound/xen/xen_snd_front.c new file +196 -0

196 lines not on this page · raw message

sound/xen/xen_snd_front.h new file +18 -0
new file mode 100644
index 000000000000..4ae204b23d32
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+
+/*
+ * Xen para-virtual sound device
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#ifndef __XEN_SND_FRONT_H
+#define __XEN_SND_FRONT_H
+
+struct xen_snd_front_info {
+	struct xenbus_device *xb_dev;
+};
+
+#endif /* __XEN_SND_FRONT_H */
Signature · 1 line
2.17.0
#5 lore raw

PATCH v3 3/6 ALSA: xen-front: Implement Xen event channel handling

In reply to Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

Handle Xen event channels:
- create for all configured streams and publish corresponding ring references and event channels in Xen store, so backend can connect
- implement event channels interrupt handlers
- create and destroy event channels with respect to Xen bus state

---
 sound/xen/Makefile                |   3 +-
 sound/xen/xen_snd_front.c         |   9 +-
 sound/xen/xen_snd_front.h         |   5 +
 sound/xen/xen_snd_front_evtchnl.c | 494 ++++++++++++++++++++++++++++++
 sound/xen/xen_snd_front_evtchnl.h |  95 ++++++
 5 files changed, 604 insertions(+), 2 deletions(-)
 create mode 100644 sound/xen/xen_snd_front_evtchnl.c
 create mode 100644 sound/xen/xen_snd_front_evtchnl.h
sound/xen/Makefile +2 -1
index 06705bef61fa..03c669984000 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0 OR MIT
 
 snd_xen_front-objs := xen_snd_front.o \
-		      xen_snd_front_cfg.o
+		      xen_snd_front_cfg.o \
+		      xen_snd_front_evtchnl.o
 
 obj-$(CONFIG_SND_XEN_FRONTEND) += snd_xen_front.o
sound/xen/xen_snd_front.c +8 -1
index 70fa91683c71..277214d4fd0a 100644
@@ -18,9 +18,11 @@
 #include <xen/interface/io/sndif.h>
 
 #include "xen_snd_front.h"
+#include "xen_snd_front_evtchnl.h"
 
 static void xen_snd_drv_fini(struct xen_snd_front_info *front_info)
 {
+	xen_snd_front_evtchnl_free_all(front_info);
 }
 
 static int sndback_initwait(struct xen_snd_front_info *front_info)
@@ -32,7 +34,12 @@ static int sndback_initwait(struct xen_snd_front_info *front_info)
 	if (ret < 0)
 		return ret;
 
-	return 0;
+	/* create event channels for all streams and publish */
+	ret = xen_snd_front_evtchnl_create_all(front_info, num_streams);
+	if (ret < 0)
+		return ret;
+
+	return xen_snd_front_evtchnl_publish_all(front_info);
 }
 
 static int sndback_connect(struct xen_snd_front_info *front_info)
sound/xen/xen_snd_front.h +5 -0
index b52226cb30bc..9d0c92100c7b 100644
@@ -13,9 +13,14 @@
 
 #include "xen_snd_front_cfg.h"
 
+struct xen_snd_front_evtchnl_pair;
+
 struct xen_snd_front_info {
 	struct xenbus_device *xb_dev;
 
+	int num_evt_pairs;
+	struct xen_snd_front_evtchnl_pair *evt_pairs;
+
 	struct xen_front_cfg_card cfg;
 };
 
sound/xen/xen_snd_front_evtchnl.c new file +494 -0

494 lines not on this page · raw message

sound/xen/xen_snd_front_evtchnl.h new file +95 -0

95 lines not on this page · raw message

Signature · 1 line
2.17.0
#7 lore raw

PATCH v3 4/6 ALSA: xen-front: Implement handling of shared buffers

In reply to Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

Implement shared buffer handling according to the para-virtualized sound device protocol at xen/interface/io/sndif.h:
- manage buffer memory
- handle granted references
- handle page directories

---
 sound/xen/Makefile              |   3 +-
 sound/xen/xen_snd_front.c       |   8 ++
 sound/xen/xen_snd_front_shbuf.c | 193 ++++++++++++++++++++++++++++++++
 sound/xen/xen_snd_front_shbuf.h |  36 ++++++
 4 files changed, 239 insertions(+), 1 deletion(-)
 create mode 100644 sound/xen/xen_snd_front_shbuf.c
 create mode 100644 sound/xen/xen_snd_front_shbuf.h
sound/xen/Makefile +2 -1
index 03c669984000..f028bc30af5d 100644
@@ -2,6 +2,7 @@
 
 snd_xen_front-objs := xen_snd_front.o \
 		      xen_snd_front_cfg.o \
-		      xen_snd_front_evtchnl.o
+		      xen_snd_front_evtchnl.o \
+		      xen_snd_front_shbuf.o
 
 obj-$(CONFIG_SND_XEN_FRONTEND) += snd_xen_front.o
sound/xen/xen_snd_front.c +8 -0
index 277214d4fd0a..cdf66ea516c4 100644
@@ -11,6 +11,7 @@
 #include <linux/delay.h>
 #include <linux/module.h>
 
+#include <xen/page.h>
 #include <xen/platform_pci.h>
 #include <xen/xen.h>
 #include <xen/xenbus.h>
@@ -191,6 +192,13 @@ static int __init xen_drv_init(void)
 	if (!xen_has_pv_devices())
 		return -ENODEV;
 
+	/* At the moment we only support case with XEN_PAGE_SIZE == PAGE_SIZE */
+	if (XEN_PAGE_SIZE != PAGE_SIZE) {
+		pr_err(XENSND_DRIVER_NAME ": different kernel and Xen page sizes are not supported: XEN_PAGE_SIZE (%lu) != PAGE_SIZE (%lu)\n",
+		       XEN_PAGE_SIZE, PAGE_SIZE);
+		return -ENODEV;
+	}
+
 	pr_info("Initialising Xen " XENSND_DRIVER_NAME " frontend driver\n");
 	return xenbus_register_frontend(&xen_driver);
 }
sound/xen/xen_snd_front_shbuf.c new file +193 -0

193 lines not on this page · raw message

sound/xen/xen_snd_front_shbuf.h new file +36 -0
new file mode 100644
index 000000000000..d28e97c47b2c
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+
+/*
+ * Xen para-virtual sound device
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#ifndef __XEN_SND_FRONT_SHBUF_H
+#define __XEN_SND_FRONT_SHBUF_H
+
+#include <xen/grant_table.h>
+
+#include "xen_snd_front_evtchnl.h"
+
+struct xen_snd_front_shbuf {
+	int num_grefs;
+	grant_ref_t *grefs;
+	u8 *directory;
+	u8 *buffer;
+	size_t buffer_sz;
+};
+
+grant_ref_t xen_snd_front_shbuf_get_dir_start(struct xen_snd_front_shbuf *buf);
+
+int xen_snd_front_shbuf_alloc(struct xenbus_device *xb_dev,
+			      struct xen_snd_front_shbuf *buf,
+			      unsigned int buffer_sz);
+
+void xen_snd_front_shbuf_clear(struct xen_snd_front_shbuf *buf);
+
+void xen_snd_front_shbuf_free(struct xen_snd_front_shbuf *buf);
+
+#endif /* __XEN_SND_FRONT_SHBUF_H */
Signature · 1 line
2.17.0
#25 lore raw

PATCH v3 5/6 ALSA: xen-front: Implement ALSA virtual sound driver

In reply to Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

Implement essential initialization of the sound driver:
- introduce required data structures
- handle driver registration
- handle sound card registration
- register sound driver on backend connection
- remove sound driver on backend disconnect

Initialize virtual sound card with streams according to the Xen store configuration.

Implement ALSA driver operations including:
- manage frontend/backend shared buffers
- manage Xen bus event channel states

Implement requests from front to back for ALSA
PCM operations.
- report ALSA period elapsed event: handle XENSND_EVT_CUR_POS notifications from the backend when stream position advances during playback/capture. The event carries a value of how many octets were played/captured at the time of the event.
- implement explicit stream parameter negotiation between backend and frontend: handle XENSND_OP_HW_PARAM_QUERY request to read/update configuration space for the parameter given:
request passes desired parameter interval and the response to this request returns min/max interval for the parameter to be used.

---
 sound/xen/Makefile                |   3 +-
 sound/xen/xen_snd_front.c         | 181 ++++++-
 sound/xen/xen_snd_front.h         |  27 +
 sound/xen/xen_snd_front_alsa.c    | 821 ++++++++++++++++++++++++++++++
 sound/xen/xen_snd_front_alsa.h    |  23 +
 sound/xen/xen_snd_front_evtchnl.c |   4 +-
 6 files changed, 1056 insertions(+), 3 deletions(-)
 create mode 100644 sound/xen/xen_snd_front_alsa.c
 create mode 100644 sound/xen/xen_snd_front_alsa.h
sound/xen/Makefile +2 -1
index f028bc30af5d..1e6470ecc2f2 100644
@@ -3,6 +3,7 @@
 snd_xen_front-objs := xen_snd_front.o \
 		      xen_snd_front_cfg.o \
 		      xen_snd_front_evtchnl.o \
-		      xen_snd_front_shbuf.o
+		      xen_snd_front_shbuf.o \
+		      xen_snd_front_alsa.o
 
 obj-$(CONFIG_SND_XEN_FRONTEND) += snd_xen_front.o
sound/xen/xen_snd_front.c +180 -1

197 lines not on this page · raw message

sound/xen/xen_snd_front.h +27 -0
index 9d0c92100c7b..a2ea2463bcc5 100644
@@ -13,15 +13,42 @@
 
 #include "xen_snd_front_cfg.h"
 
+struct xen_snd_front_card_info;
+struct xen_snd_front_evtchnl;
 struct xen_snd_front_evtchnl_pair;
+struct xen_snd_front_shbuf;
+struct xensnd_query_hw_param;
 
 struct xen_snd_front_info {
 	struct xenbus_device *xb_dev;
 
+	struct xen_snd_front_card_info *card_info;
+
 	int num_evt_pairs;
 	struct xen_snd_front_evtchnl_pair *evt_pairs;
 
 	struct xen_front_cfg_card cfg;
 };
 
+int xen_snd_front_stream_query_hw_param(struct xen_snd_front_evtchnl *evtchnl,
+					struct xensnd_query_hw_param *hw_param_req,
+					struct xensnd_query_hw_param *hw_param_resp);
+
+int xen_snd_front_stream_prepare(struct xen_snd_front_evtchnl *evtchnl,
+				 struct xen_snd_front_shbuf *sh_buf,
+				 u8 format, unsigned int channels,
+				 unsigned int rate, u32 buffer_sz,
+				 u32 period_sz);
+
+int xen_snd_front_stream_close(struct xen_snd_front_evtchnl *evtchnl);
+
+int xen_snd_front_stream_write(struct xen_snd_front_evtchnl *evtchnl,
+			       unsigned long pos, unsigned long count);
+
+int xen_snd_front_stream_read(struct xen_snd_front_evtchnl *evtchnl,
+			      unsigned long pos, unsigned long count);
+
+int xen_snd_front_stream_trigger(struct xen_snd_front_evtchnl *evtchnl,
+				 int type);
+
 #endif /* __XEN_SND_FRONT_H */
sound/xen/xen_snd_front_alsa.c new file +821 -0

821 lines not on this page · raw message

sound/xen/xen_snd_front_alsa.h new file +23 -0
new file mode 100644
index 000000000000..18abd9eec967
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+
+/*
+ * Xen para-virtual sound device
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#ifndef __XEN_SND_FRONT_ALSA_H
+#define __XEN_SND_FRONT_ALSA_H
+
+struct xen_snd_front_info;
+
+int xen_snd_front_alsa_init(struct xen_snd_front_info *front_info);
+
+void xen_snd_front_alsa_fini(struct xen_snd_front_info *front_info);
+
+void xen_snd_front_alsa_handle_cur_pos(struct xen_snd_front_evtchnl *evtchnl,
+				       u64 pos_bytes);
+
+#endif /* __XEN_SND_FRONT_ALSA_H */
sound/xen/xen_snd_front_evtchnl.c +3 -1
index 1faafff08807..d70a62e7f910 100644
@@ -14,6 +14,7 @@
 #include <xen/xenbus.h>
 
 #include "xen_snd_front.h"
+#include "xen_snd_front_alsa.h"
 #include "xen_snd_front_cfg.h"
 #include "xen_snd_front_evtchnl.h"
 
@@ -118,7 +119,8 @@ static irqreturn_t evtchnl_interrupt_evt(int irq, void *dev_id)
 
 		switch (event->type) {
 		case XENSND_EVT_CUR_POS:
-			/* Do nothing at the moment. */
+			xen_snd_front_alsa_handle_cur_pos(channel,
+							  event->op.cur_pos.position);
 			break;
 		}
 	}
Signature · 1 line
2.17.0
#31 lore raw

PATCH v3 6/6 MAINTAINERS: Add ALSA: xen-front: maintainer entry

In reply to Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

Add myself as sound/xen maintainer.

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 92be777d060a..bd214e061359 100644
@@ -15494,6 +15494,13 @@ S:	Supported
 F:	arch/x86/xen/*swiotlb*
 F:	drivers/xen/*swiotlb*
 
+XEN SOUND FRONTEND DRIVER
+M:	Oleksandr Andrushchenko <[email protected]>
+L:	[email protected] (moderated for non-subscribers)
+L:	[email protected] (moderated for non-subscribers)
+S:	Supported
+F:	sound/xen/*
+
 XFS FILESYSTEM
 M:	Darrick J. Wong <[email protected]>
 M:	[email protected]
Signature · 1 line
2.17.0
#0 lore raw

v3 cover ALSA: xen-front: Add Xen para-virtualized frontend driver

From: Oleksandr Andrushchenko <[email protected]>

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
Signature · 1 line
2.17.0
#3 lore raw

PATCH v3 2/6 ALSA: xen-front: Read sound driver configuration from Xen store

From: Oleksandr Andrushchenko <[email protected]>

Read configuration values from Xen store according to xen/interface/io/sndif.h protocol:
- introduce configuration structures for different components, e.g. sound card, device, stream
- read PCM HW parameters, e.g rate, format etc.
- detect stream type (capture/playback)
- read device and card parameters

---
 sound/xen/Makefile            |   3 +-
 sound/xen/xen_snd_front.c     |   7 +
 sound/xen/xen_snd_front.h     |   4 +
 sound/xen/xen_snd_front_cfg.c | 517 ++++++++++++++++++++++++++++++++++
 sound/xen/xen_snd_front_cfg.h |  46 +++
 5 files changed, 576 insertions(+), 1 deletion(-)
 create mode 100644 sound/xen/xen_snd_front_cfg.c
 create mode 100644 sound/xen/xen_snd_front_cfg.h
sound/xen/Makefile +2 -1
index 4507ef3c27fd..06705bef61fa 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0 OR MIT
 
-snd_xen_front-objs := xen_snd_front.o
+snd_xen_front-objs := xen_snd_front.o \
+		      xen_snd_front_cfg.o
 
 obj-$(CONFIG_SND_XEN_FRONTEND) += snd_xen_front.o
sound/xen/xen_snd_front.c +7 -0
index bbbe2767b565..70fa91683c71 100644
@@ -25,6 +25,13 @@ static void xen_snd_drv_fini(struct xen_snd_front_info *front_info)
 
 static int sndback_initwait(struct xen_snd_front_info *front_info)
 {
+	int num_streams;
+	int ret;
+
+	ret = xen_snd_front_cfg_card(front_info, &num_streams);
+	if (ret < 0)
+		return ret;
+
 	return 0;
 }
 
sound/xen/xen_snd_front.h +4 -0
index 4ae204b23d32..b52226cb30bc 100644
@@ -11,8 +11,12 @@
 #ifndef __XEN_SND_FRONT_H
 #define __XEN_SND_FRONT_H
 
+#include "xen_snd_front_cfg.h"
+
 struct xen_snd_front_info {
 	struct xenbus_device *xb_dev;
+
+	struct xen_front_cfg_card cfg;
 };
 
 #endif /* __XEN_SND_FRONT_H */
sound/xen/xen_snd_front_cfg.c new file +517 -0

517 lines not on this page · raw message

sound/xen/xen_snd_front_cfg.h new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.17.0
#2 lore raw

PATCH v3 1/6 ALSA: xen-front: Introduce Xen para-virtualized sound frontend driver

In reply to Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

Introduce skeleton of the para-virtualized Xen sound frontend driver.

Initial handling for Xen bus states: implement
Xen bus state machine for the frontend driver according to the state diagram and recovery flow from sound para-virtualized
protocol: xen/interface/io/sndif.h.

---
 sound/Kconfig             |   2 +
 sound/Makefile            |   2 +-
 sound/xen/Kconfig         |  10 ++
 sound/xen/Makefile        |   5 +
 sound/xen/xen_snd_front.c | 196 ++++++++++++++++++++++++++++++++++++++
 sound/xen/xen_snd_front.h |  18 ++++
 6 files changed, 232 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
sound/Kconfig +2 -0
index 6833db9002ec..1140e9988fc5 100644
@@ -96,6 +96,8 @@ source "sound/x86/Kconfig"
 
 source "sound/synth/Kconfig"
 
+source "sound/xen/Kconfig"
+
 endif # SND
 
 endif # !UML
sound/Makefile +1 -1
index 99d8c31262c8..797ecdcd35e2 100644
@@ -5,7 +5,7 @@
 obj-$(CONFIG_SOUND) += soundcore.o
 obj-$(CONFIG_DMASOUND) += oss/dmasound/
 obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \
-	firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ x86/
+	firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ x86/ xen/
 obj-$(CONFIG_SND_AOA) += aoa/
 
 # This one must be compilable even if sound is configured out
sound/xen/Kconfig new file +10 -0
new file mode 100644
index 000000000000..4f1fceea82d2
@@ -0,0 +1,10 @@
+# ALSA Xen drivers
+
+config SND_XEN_FRONTEND
+	tristate "Xen para-virtualized sound frontend driver"
+	depends on XEN
+	select SND_PCM
+	select XEN_XENBUS_FRONTEND
+	help
+	  Choose this option if you want to enable a para-virtualized
+	  frontend sound driver for Xen guest OSes.
sound/xen/Makefile new file +5 -0
new file mode 100644
index 000000000000..4507ef3c27fd
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0 OR MIT
+
+snd_xen_front-objs := xen_snd_front.o
+
+obj-$(CONFIG_SND_XEN_FRONTEND) += snd_xen_front.o
sound/xen/xen_snd_front.c new file +196 -0

196 lines not on this page · raw message

sound/xen/xen_snd_front.h new file +18 -0
new file mode 100644
index 000000000000..4ae204b23d32
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+
+/*
+ * Xen para-virtual sound device
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#ifndef __XEN_SND_FRONT_H
+#define __XEN_SND_FRONT_H
+
+struct xen_snd_front_info {
+	struct xenbus_device *xb_dev;
+};
+
+#endif /* __XEN_SND_FRONT_H */
Signature · 7 lines
2.17.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#4 lore raw

PATCH v3 2/6 ALSA: xen-front: Read sound driver configuration from Xen store

In reply to Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

Read configuration values from Xen store according to xen/interface/io/sndif.h protocol:
- introduce configuration structures for different components, e.g. sound card, device, stream
- read PCM HW parameters, e.g rate, format etc.
- detect stream type (capture/playback)
- read device and card parameters

---
 sound/xen/Makefile            |   3 +-
 sound/xen/xen_snd_front.c     |   7 +
 sound/xen/xen_snd_front.h     |   4 +
 sound/xen/xen_snd_front_cfg.c | 517 ++++++++++++++++++++++++++++++++++
 sound/xen/xen_snd_front_cfg.h |  46 +++
 5 files changed, 576 insertions(+), 1 deletion(-)
 create mode 100644 sound/xen/xen_snd_front_cfg.c
 create mode 100644 sound/xen/xen_snd_front_cfg.h
sound/xen/Makefile +2 -1
index 4507ef3c27fd..06705bef61fa 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0 OR MIT
 
-snd_xen_front-objs := xen_snd_front.o
+snd_xen_front-objs := xen_snd_front.o \
+		      xen_snd_front_cfg.o
 
 obj-$(CONFIG_SND_XEN_FRONTEND) += snd_xen_front.o
sound/xen/xen_snd_front.c +7 -0
index bbbe2767b565..70fa91683c71 100644
@@ -25,6 +25,13 @@ static void xen_snd_drv_fini(struct xen_snd_front_info *front_info)
 
 static int sndback_initwait(struct xen_snd_front_info *front_info)
 {
+	int num_streams;
+	int ret;
+
+	ret = xen_snd_front_cfg_card(front_info, &num_streams);
+	if (ret < 0)
+		return ret;
+
 	return 0;
 }
 
sound/xen/xen_snd_front.h +4 -0
index 4ae204b23d32..b52226cb30bc 100644
@@ -11,8 +11,12 @@
 #ifndef __XEN_SND_FRONT_H
 #define __XEN_SND_FRONT_H
 
+#include "xen_snd_front_cfg.h"
+
 struct xen_snd_front_info {
 	struct xenbus_device *xb_dev;
+
+	struct xen_front_cfg_card cfg;
 };
 
 #endif /* __XEN_SND_FRONT_H */
sound/xen/xen_snd_front_cfg.c new file +517 -0

517 lines not on this page · raw message

sound/xen/xen_snd_front_cfg.h new file +46 -0

46 lines not on this page · raw message

Signature · 7 lines
2.17.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#6 lore raw

PATCH v3 3/6 ALSA: xen-front: Implement Xen event channel handling

In reply to Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

Handle Xen event channels:
- create for all configured streams and publish corresponding ring references and event channels in Xen store, so backend can connect
- implement event channels interrupt handlers
- create and destroy event channels with respect to Xen bus state

---
 sound/xen/Makefile                |   3 +-
 sound/xen/xen_snd_front.c         |   9 +-
 sound/xen/xen_snd_front.h         |   5 +
 sound/xen/xen_snd_front_evtchnl.c | 494 ++++++++++++++++++++++++++++++
 sound/xen/xen_snd_front_evtchnl.h |  95 ++++++
 5 files changed, 604 insertions(+), 2 deletions(-)
 create mode 100644 sound/xen/xen_snd_front_evtchnl.c
 create mode 100644 sound/xen/xen_snd_front_evtchnl.h
sound/xen/Makefile +2 -1
index 06705bef61fa..03c669984000 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0 OR MIT
 
 snd_xen_front-objs := xen_snd_front.o \
-		      xen_snd_front_cfg.o
+		      xen_snd_front_cfg.o \
+		      xen_snd_front_evtchnl.o
 
 obj-$(CONFIG_SND_XEN_FRONTEND) += snd_xen_front.o
sound/xen/xen_snd_front.c +8 -1
index 70fa91683c71..277214d4fd0a 100644
@@ -18,9 +18,11 @@
 #include <xen/interface/io/sndif.h>
 
 #include "xen_snd_front.h"
+#include "xen_snd_front_evtchnl.h"
 
 static void xen_snd_drv_fini(struct xen_snd_front_info *front_info)
 {
+	xen_snd_front_evtchnl_free_all(front_info);
 }
 
 static int sndback_initwait(struct xen_snd_front_info *front_info)
@@ -32,7 +34,12 @@ static int sndback_initwait(struct xen_snd_front_info *front_info)
 	if (ret < 0)
 		return ret;
 
-	return 0;
+	/* create event channels for all streams and publish */
+	ret = xen_snd_front_evtchnl_create_all(front_info, num_streams);
+	if (ret < 0)
+		return ret;
+
+	return xen_snd_front_evtchnl_publish_all(front_info);
 }
 
 static int sndback_connect(struct xen_snd_front_info *front_info)
sound/xen/xen_snd_front.h +5 -0
index b52226cb30bc..9d0c92100c7b 100644
@@ -13,9 +13,14 @@
 
 #include "xen_snd_front_cfg.h"
 
+struct xen_snd_front_evtchnl_pair;
+
 struct xen_snd_front_info {
 	struct xenbus_device *xb_dev;
 
+	int num_evt_pairs;
+	struct xen_snd_front_evtchnl_pair *evt_pairs;
+
 	struct xen_front_cfg_card cfg;
 };
 
sound/xen/xen_snd_front_evtchnl.c new file +494 -0

494 lines not on this page · raw message

sound/xen/xen_snd_front_evtchnl.h new file +95 -0

95 lines not on this page · raw message

Signature · 7 lines
2.17.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#24 lore raw

PATCH v3 4/6 ALSA: xen-front: Implement handling of shared buffers

In reply to Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

Implement shared buffer handling according to the para-virtualized sound device protocol at xen/interface/io/sndif.h:
- manage buffer memory
- handle granted references
- handle page directories

---
 sound/xen/Makefile              |   3 +-
 sound/xen/xen_snd_front.c       |   8 ++
 sound/xen/xen_snd_front_shbuf.c | 193 ++++++++++++++++++++++++++++++++
 sound/xen/xen_snd_front_shbuf.h |  36 ++++++
 4 files changed, 239 insertions(+), 1 deletion(-)
 create mode 100644 sound/xen/xen_snd_front_shbuf.c
 create mode 100644 sound/xen/xen_snd_front_shbuf.h
sound/xen/Makefile +2 -1
index 03c669984000..f028bc30af5d 100644
@@ -2,6 +2,7 @@
 
 snd_xen_front-objs := xen_snd_front.o \
 		      xen_snd_front_cfg.o \
-		      xen_snd_front_evtchnl.o
+		      xen_snd_front_evtchnl.o \
+		      xen_snd_front_shbuf.o
 
 obj-$(CONFIG_SND_XEN_FRONTEND) += snd_xen_front.o
sound/xen/xen_snd_front.c +8 -0
index 277214d4fd0a..cdf66ea516c4 100644
@@ -11,6 +11,7 @@
 #include <linux/delay.h>
 #include <linux/module.h>
 
+#include <xen/page.h>
 #include <xen/platform_pci.h>
 #include <xen/xen.h>
 #include <xen/xenbus.h>
@@ -191,6 +192,13 @@ static int __init xen_drv_init(void)
 	if (!xen_has_pv_devices())
 		return -ENODEV;
 
+	/* At the moment we only support case with XEN_PAGE_SIZE == PAGE_SIZE */
+	if (XEN_PAGE_SIZE != PAGE_SIZE) {
+		pr_err(XENSND_DRIVER_NAME ": different kernel and Xen page sizes are not supported: XEN_PAGE_SIZE (%lu) != PAGE_SIZE (%lu)\n",
+		       XEN_PAGE_SIZE, PAGE_SIZE);
+		return -ENODEV;
+	}
+
 	pr_info("Initialising Xen " XENSND_DRIVER_NAME " frontend driver\n");
 	return xenbus_register_frontend(&xen_driver);
 }
sound/xen/xen_snd_front_shbuf.c new file +193 -0

193 lines not on this page · raw message

sound/xen/xen_snd_front_shbuf.h new file +36 -0
new file mode 100644
index 000000000000..d28e97c47b2c
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+
+/*
+ * Xen para-virtual sound device
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#ifndef __XEN_SND_FRONT_SHBUF_H
+#define __XEN_SND_FRONT_SHBUF_H
+
+#include <xen/grant_table.h>
+
+#include "xen_snd_front_evtchnl.h"
+
+struct xen_snd_front_shbuf {
+	int num_grefs;
+	grant_ref_t *grefs;
+	u8 *directory;
+	u8 *buffer;
+	size_t buffer_sz;
+};
+
+grant_ref_t xen_snd_front_shbuf_get_dir_start(struct xen_snd_front_shbuf *buf);
+
+int xen_snd_front_shbuf_alloc(struct xenbus_device *xb_dev,
+			      struct xen_snd_front_shbuf *buf,
+			      unsigned int buffer_sz);
+
+void xen_snd_front_shbuf_clear(struct xen_snd_front_shbuf *buf);
+
+void xen_snd_front_shbuf_free(struct xen_snd_front_shbuf *buf);
+
+#endif /* __XEN_SND_FRONT_SHBUF_H */
Signature · 7 lines
2.17.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#32 lore raw

PATCH v3 6/6 MAINTAINERS: Add ALSA: xen-front: maintainer entry

In reply to Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

Add myself as sound/xen maintainer.

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 92be777d060a..bd214e061359 100644
@@ -15494,6 +15494,13 @@ S:	Supported
 F:	arch/x86/xen/*swiotlb*
 F:	drivers/xen/*swiotlb*
 
+XEN SOUND FRONTEND DRIVER
+M:	Oleksandr Andrushchenko <[email protected]>
+L:	[email protected] (moderated for non-subscribers)
+L:	[email protected] (moderated for non-subscribers)
+S:	Supported
+F:	sound/xen/*
+
 XFS FILESYSTEM
 M:	Darrick J. Wong <[email protected]>
 M:	[email protected]
Signature · 7 lines
2.17.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#30 lore raw

PATCH v3 5/6 ALSA: xen-front: Implement ALSA virtual sound driver

In reply to Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

Implement essential initialization of the sound driver:
- introduce required data structures
- handle driver registration
- handle sound card registration
- register sound driver on backend connection
- remove sound driver on backend disconnect

Initialize virtual sound card with streams according to the Xen store configuration.

Implement ALSA driver operations including:
- manage frontend/backend shared buffers
- manage Xen bus event channel states

Implement requests from front to back for ALSA
PCM operations.
- report ALSA period elapsed event: handle XENSND_EVT_CUR_POS notifications from the backend when stream position advances during playback/capture. The event carries a value of how many octets were played/captured at the time of the event.
- implement explicit stream parameter negotiation between backend and frontend: handle XENSND_OP_HW_PARAM_QUERY request to read/update configuration space for the parameter given:
request passes desired parameter interval and the response to this request returns min/max interval for the parameter to be used.

---
 sound/xen/Makefile                |   3 +-
 sound/xen/xen_snd_front.c         | 181 ++++++-
 sound/xen/xen_snd_front.h         |  27 +
 sound/xen/xen_snd_front_alsa.c    | 821 ++++++++++++++++++++++++++++++
 sound/xen/xen_snd_front_alsa.h    |  23 +
 sound/xen/xen_snd_front_evtchnl.c |   4 +-
 6 files changed, 1056 insertions(+), 3 deletions(-)
 create mode 100644 sound/xen/xen_snd_front_alsa.c
 create mode 100644 sound/xen/xen_snd_front_alsa.h
sound/xen/Makefile +2 -1
index f028bc30af5d..1e6470ecc2f2 100644
@@ -3,6 +3,7 @@
 snd_xen_front-objs := xen_snd_front.o \
 		      xen_snd_front_cfg.o \
 		      xen_snd_front_evtchnl.o \
-		      xen_snd_front_shbuf.o
+		      xen_snd_front_shbuf.o \
+		      xen_snd_front_alsa.o
 
 obj-$(CONFIG_SND_XEN_FRONTEND) += snd_xen_front.o
sound/xen/xen_snd_front.c +180 -1

197 lines not on this page · raw message

sound/xen/xen_snd_front.h +27 -0
index 9d0c92100c7b..a2ea2463bcc5 100644
@@ -13,15 +13,42 @@
 
 #include "xen_snd_front_cfg.h"
 
+struct xen_snd_front_card_info;
+struct xen_snd_front_evtchnl;
 struct xen_snd_front_evtchnl_pair;
+struct xen_snd_front_shbuf;
+struct xensnd_query_hw_param;
 
 struct xen_snd_front_info {
 	struct xenbus_device *xb_dev;
 
+	struct xen_snd_front_card_info *card_info;
+
 	int num_evt_pairs;
 	struct xen_snd_front_evtchnl_pair *evt_pairs;
 
 	struct xen_front_cfg_card cfg;
 };
 
+int xen_snd_front_stream_query_hw_param(struct xen_snd_front_evtchnl *evtchnl,
+					struct xensnd_query_hw_param *hw_param_req,
+					struct xensnd_query_hw_param *hw_param_resp);
+
+int xen_snd_front_stream_prepare(struct xen_snd_front_evtchnl *evtchnl,
+				 struct xen_snd_front_shbuf *sh_buf,
+				 u8 format, unsigned int channels,
+				 unsigned int rate, u32 buffer_sz,
+				 u32 period_sz);
+
+int xen_snd_front_stream_close(struct xen_snd_front_evtchnl *evtchnl);
+
+int xen_snd_front_stream_write(struct xen_snd_front_evtchnl *evtchnl,
+			       unsigned long pos, unsigned long count);
+
+int xen_snd_front_stream_read(struct xen_snd_front_evtchnl *evtchnl,
+			      unsigned long pos, unsigned long count);
+
+int xen_snd_front_stream_trigger(struct xen_snd_front_evtchnl *evtchnl,
+				 int type);
+
 #endif /* __XEN_SND_FRONT_H */
sound/xen/xen_snd_front_alsa.c new file +821 -0

821 lines not on this page · raw message

sound/xen/xen_snd_front_alsa.h new file +23 -0
new file mode 100644
index 000000000000..18abd9eec967
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0 OR MIT */
+
+/*
+ * Xen para-virtual sound device
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#ifndef __XEN_SND_FRONT_ALSA_H
+#define __XEN_SND_FRONT_ALSA_H
+
+struct xen_snd_front_info;
+
+int xen_snd_front_alsa_init(struct xen_snd_front_info *front_info);
+
+void xen_snd_front_alsa_fini(struct xen_snd_front_info *front_info);
+
+void xen_snd_front_alsa_handle_cur_pos(struct xen_snd_front_evtchnl *evtchnl,
+				       u64 pos_bytes);
+
+#endif /* __XEN_SND_FRONT_ALSA_H */
sound/xen/xen_snd_front_evtchnl.c +3 -1
index 1faafff08807..d70a62e7f910 100644
@@ -14,6 +14,7 @@
 #include <xen/xenbus.h>
 
 #include "xen_snd_front.h"
+#include "xen_snd_front_alsa.h"
 #include "xen_snd_front_cfg.h"
 #include "xen_snd_front_evtchnl.h"
 
@@ -118,7 +119,8 @@ static irqreturn_t evtchnl_interrupt_evt(int irq, void *dev_id)
 
 		switch (event->type) {
 		case XENSND_EVT_CUR_POS:
-			/* Do nothing at the moment. */
+			xen_snd_front_alsa_handle_cur_pos(channel,
+							  event->op.cur_pos.position);
 			break;
 		}
 	}
Signature · 7 lines
2.17.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#33 lore raw
In reply to Oleksandr Andrushchenko
Quoted 14 lines · Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

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.

Quoted 4 lines

Both capture and playback are supported.

Corresponding backend, implemented as a user-space application, can be found at [2].

Through a quick glance, all look OK for merge (assuming that they really work on your systems :)

Of course, it'd be great if anyone else can review, test and give reviewed-by or tested-by tags. So I'll keep this floating for a couple of days and merge to for-next branch after that.

thanks,

Takashi

#36 lore raw
In reply to Oleksandr Andrushchenko
Quoted 14 lines · Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

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.

Quoted 4 lines

Both capture and playback are supported.

Corresponding backend, implemented as a user-space application, can be found at [2].

Through a quick glance, all look OK for merge (assuming that they really work on your systems :)

Of course, it'd be great if anyone else can review, test and give reviewed-by or tested-by tags. So I'll keep this floating for a couple of days and merge to for-next branch after that.

thanks,

Takashi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#34 lore raw
In reply to Takashi Iwai
Quoted 15 lines · Takashi Iwai
Quoted 13 lines · Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

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.

Quoted 6 lines
Quoted 4 lines

Both capture and playback are supported.

Corresponding backend, implemented as a user-space application, can be found at [2].

Through a quick glance, all look OK for merge (assuming that they really work on your systems :)

Well, we have tested this at EPAM on Android/Linux, so this is it for now

Quoted 3 lines

Of course, it'd be great if anyone else can review, test and give reviewed-by or tested-by tags.

I hope Juergen and Boris can review, at least Juergen had some comments that I have addressed in v3

Quoted 2 lines

So I'll keep this floating for a
couple of days and merge to for-next branch after that.

Oh, this is great news! Thank you

Quoted 4 lines

thanks,

Takashi

#35 lore raw
In reply to Takashi Iwai
Quoted 15 lines · Takashi Iwai
Quoted 13 lines · Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <[email protected]>

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.

Quoted 6 lines
Quoted 4 lines

Both capture and playback are supported.

Corresponding backend, implemented as a user-space application, can be found at [2].

Through a quick glance, all look OK for merge (assuming that they really work on your systems :)

Well, we have tested this at EPAM on Android/Linux, so this is it for now

Quoted 3 lines

Of course, it'd be great if anyone else can review, test and give reviewed-by or tested-by tags.

I hope Juergen and Boris can review, at least Juergen had some comments that I have addressed in v3

Quoted 2 lines

So I'll keep this floating for a
couple of days and merge to for-next branch after that.

Oh, this is great news! Thank you

Quoted 4 lines

thanks,

Takashi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Oleksandr Andrushchenko
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’

   extern bool xen_pvh;
           ^~~~
   In file included from ./include/xen/interface/xen.h:30:0,
                    from ./include/xen/xen.h:29,
                    from sound/xen/xen_snd_front_shbuf.c:11:
  ./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
   DEFINE_GUEST_HANDLE(uint64_t);
                       ^

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

thanks,

Takashi

#23 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Oleksandr Andrushchenko
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’

   extern bool xen_pvh;
           ^~~~
   In file included from ./include/xen/interface/xen.h:30:0,
                    from ./include/xen/xen.h:29,
                    from sound/xen/xen_snd_front_shbuf.c:11:
  ./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
   DEFINE_GUEST_HANDLE(uint64_t);
                       ^

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

thanks,

Takashi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Takashi Iwai
Quoted 33 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:

   ./include/xen/xen.h:18:8: error: unknown type name ‘bool’
    extern bool xen_pvh;
            ^~~~
    In file included from ./include/xen/interface/xen.h:30:0,
                     from ./include/xen/xen.h:29,
                     from sound/xen/xen_snd_front_shbuf.c:11:
   ./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
    DEFINE_GUEST_HANDLE(uint64_t);
                        ^
Quoted 3 lines

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Do you want me to resend this single patch or you can make the change while applying?

Quoted 5 lines

thanks,

Takashi

Thank you,
Oleksandr

#22 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Takashi Iwai
Quoted 33 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:

   ./include/xen/xen.h:18:8: error: unknown type name ‘bool’
    extern bool xen_pvh;
            ^~~~
    In file included from ./include/xen/interface/xen.h:30:0,
                     from ./include/xen/xen.h:29,
                     from sound/xen/xen_snd_front_shbuf.c:11:
   ./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
    DEFINE_GUEST_HANDLE(uint64_t);
                        ^
Quoted 3 lines

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Do you want me to resend this single patch or you can make the change while applying?

Quoted 5 lines

thanks,

Takashi

Thank you,
Oleksandr

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Oleksandr Andrushchenko
Quoted 37 lines · Oleksandr Andrushchenko
Quoted 35 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:

   ./include/xen/xen.h:18:8: error: unknown type name ‘bool’
    extern bool xen_pvh;
            ^~~~
    In file included from ./include/xen/interface/xen.h:30:0,
                     from ./include/xen/xen.h:29,
                     from sound/xen/xen_snd_front_shbuf.c:11:
   ./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
    DEFINE_GUEST_HANDLE(uint64_t);
                        ^

Adding #include <linux/kernel.h> fixed the issue.

Quoted 7 lines
Quoted 1 line

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

thanks,

Takashi

#21 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Oleksandr Andrushchenko
Quoted 37 lines · Oleksandr Andrushchenko
Quoted 35 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:

   ./include/xen/xen.h:18:8: error: unknown type name ‘bool’
    extern bool xen_pvh;
            ^~~~
    In file included from ./include/xen/interface/xen.h:30:0,
                     from ./include/xen/xen.h:29,
                     from sound/xen/xen_snd_front_shbuf.c:11:
   ./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
    DEFINE_GUEST_HANDLE(uint64_t);
                        ^

Adding #include <linux/kernel.h> fixed the issue.

Quoted 7 lines
Quoted 1 line

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

thanks,

Takashi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#11 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Takashi Iwai
Quoted 38 lines · Takashi Iwai
Quoted 36 lines · Oleksandr Andrushchenko
Quoted 35 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’
extern bool xen_pvh;
^~~~
In file included from ./include/xen/interface/xen.h:30:0,
from ./include/xen/xen.h:29,
from sound/xen/xen_snd_front_shbuf.c:11:
./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
DEFINE_GUEST_HANDLE(uint64_t);
^

Adding #include <linux/kernel.h> fixed the issue.

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

Thank you

Quoted 4 lines

thanks,

Takashi

#20 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Takashi Iwai
Quoted 38 lines · Takashi Iwai
Quoted 36 lines · Oleksandr Andrushchenko
Quoted 35 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’
extern bool xen_pvh;
^~~~
In file included from ./include/xen/interface/xen.h:30:0,
from ./include/xen/xen.h:29,
from sound/xen/xen_snd_front_shbuf.c:11:
./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
DEFINE_GUEST_HANDLE(uint64_t);
^

Adding #include <linux/kernel.h> fixed the issue.

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

Thank you

Quoted 4 lines

thanks,

Takashi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#12 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Oleksandr Andrushchenko
Quoted 41 lines · Oleksandr Andrushchenko
Quoted 39 lines · Takashi Iwai
Quoted 37 lines · Oleksandr Andrushchenko
Quoted 36 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’
extern bool xen_pvh;
^~~~
In file included from ./include/xen/interface/xen.h:30:0,
from ./include/xen/xen.h:29,
from sound/xen/xen_snd_front_shbuf.c:11:
./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
DEFINE_GUEST_HANDLE(uint64_t);
^

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

Quoted 8 lines
Quoted 7 lines
Quoted 6 lines

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

Thank you

FWIW, the patches are in topic/xen branch in sound.git tree, and I'll keep boiling for a while to see if any issues are caught by 0day bot.

Takashi

#19 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Oleksandr Andrushchenko
Quoted 41 lines · Oleksandr Andrushchenko
Quoted 39 lines · Takashi Iwai
Quoted 37 lines · Oleksandr Andrushchenko
Quoted 36 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’
extern bool xen_pvh;
^~~~
In file included from ./include/xen/interface/xen.h:30:0,
from ./include/xen/xen.h:29,
from sound/xen/xen_snd_front_shbuf.c:11:
./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
DEFINE_GUEST_HANDLE(uint64_t);
^

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

Quoted 8 lines
Quoted 7 lines
Quoted 6 lines

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

Thank you

FWIW, the patches are in topic/xen branch in sound.git tree, and I'll keep boiling for a while to see if any issues are caught by 0day bot.

Takashi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Takashi Iwai
Quoted 46 lines · Takashi Iwai
Quoted 44 lines · Oleksandr Andrushchenko
Quoted 43 lines · Takashi Iwai
Quoted 41 lines · Oleksandr Andrushchenko
Quoted 33 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’
extern bool xen_pvh;
^~~~
In file included from ./include/xen/interface/xen.h:30:0,
from ./include/xen/xen.h:29,
from sound/xen/xen_snd_front_shbuf.c:11:
./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
DEFINE_GUEST_HANDLE(uint64_t);
^

Quoted 3 lines

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

Thank you

FWIW, the patches are in topic/xen branch in sound.git tree, and I'll keep boiling for a while to see if any issues are caught by 0day bot.

Thank you, hope everything goes well

Quoted 2 lines

Takashi

Thank you,
Oleksandr
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#14 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Takashi Iwai
Quoted 46 lines · Takashi Iwai
Quoted 44 lines · Oleksandr Andrushchenko
Quoted 43 lines · Takashi Iwai
Quoted 41 lines · Oleksandr Andrushchenko
Quoted 33 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’
extern bool xen_pvh;
^~~~
In file included from ./include/xen/interface/xen.h:30:0,
from ./include/xen/xen.h:29,
from sound/xen/xen_snd_front_shbuf.c:11:
./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
DEFINE_GUEST_HANDLE(uint64_t);
^

Quoted 3 lines

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

Thank you

FWIW, the patches are in topic/xen branch in sound.git tree, and I'll keep boiling for a while to see if any issues are caught by 0day bot.

Thank you, hope everything goes well

Quoted 2 lines

Takashi

Thank you,
Oleksandr

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#15 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Takashi Iwai
Quoted 48 lines · Takashi Iwai
Quoted 45 lines · Oleksandr Andrushchenko
Quoted 43 lines · Takashi Iwai
Quoted 41 lines · Oleksandr Andrushchenko
Quoted 33 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’
extern bool xen_pvh;
^~~~
In file included from ./include/xen/interface/xen.h:30:0,
from ./include/xen/xen.h:29,
from sound/xen/xen_snd_front_shbuf.c:11:
./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
DEFINE_GUEST_HANDLE(uint64_t);
^

Quoted 3 lines

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

Thank you

FWIW, the patches are in topic/xen branch in sound.git tree, and I'll keep boiling for a while to see if any issues are caught by 0day bot.

... and now the topic/xen branch got merged to for-next, targeted for 4.18.

Thanks for your patient works!

Takashi

#18 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Takashi Iwai
Quoted 48 lines · Takashi Iwai
Quoted 45 lines · Oleksandr Andrushchenko
Quoted 43 lines · Takashi Iwai
Quoted 41 lines · Oleksandr Andrushchenko
Quoted 33 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’
extern bool xen_pvh;
^~~~
In file included from ./include/xen/interface/xen.h:30:0,
from ./include/xen/xen.h:29,
from sound/xen/xen_snd_front_shbuf.c:11:
./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
DEFINE_GUEST_HANDLE(uint64_t);
^

Quoted 3 lines

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

Thank you

FWIW, the patches are in topic/xen branch in sound.git tree, and I'll keep boiling for a while to see if any issues are caught by 0day bot.

... and now the topic/xen branch got merged to for-next, targeted for 4.18.

Thanks for your patient works!

Takashi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#16 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Takashi Iwai
Quoted 54 lines · Takashi Iwai
Quoted 46 lines · Takashi Iwai
Quoted 44 lines · Oleksandr Andrushchenko
Quoted 43 lines · Takashi Iwai
Quoted 41 lines · Oleksandr Andrushchenko
Quoted 33 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’
extern bool xen_pvh;
^~~~
In file included from ./include/xen/interface/xen.h:30:0,
from ./include/xen/xen.h:29,
from sound/xen/xen_snd_front_shbuf.c:11:
./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
DEFINE_GUEST_HANDLE(uint64_t);
^

Quoted 3 lines

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

Thank you

FWIW, the patches are in topic/xen branch in sound.git tree, and I'll keep boiling for a while to see if any issues are caught by 0day bot.

Quoted 7 lines

... and now the topic/xen branch got merged to for-next, targeted for 4.18.

Thanks for your patient works!

Takashi

Great news, thank you,
Oleksandr
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#17 lore raw

Re: [PATCH v3 4/6] ALSA: xen-front: Implement handling of shared buffers

In reply to Takashi Iwai
Quoted 54 lines · Takashi Iwai
Quoted 46 lines · Takashi Iwai
Quoted 44 lines · Oleksandr Andrushchenko
Quoted 43 lines · Takashi Iwai
Quoted 41 lines · Oleksandr Andrushchenko
Quoted 33 lines · Takashi Iwai
Quoted 7 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_shbuf.c new file +4 -0
@@ -0,0 +1,193 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+/*
+ * Xen para-virtual sound device

sound/xen/xen_snd_front_shbuf.c line 14

Quoted 10 lines
sound/xen/xen_snd_front_shbuf.c new file +10 -0
+ *
+ * Copyright (C) 2016-2018 EPAM Systems Inc.
+ *
+ * Author: Oleksandr Andrushchenko <[email protected]>
+ */
+
+#include <xen/xen.h>
+#include <xen/xenbus.h>
+
+#include "xen_snd_front_shbuf.h"

Hm, with the local build test, I get the following error:

CC [M] sound/xen/xen_snd_front_shbuf.o
In file included from sound/xen/xen_snd_front_shbuf.c:11:0:
./include/xen/xen.h:18:8: error: unknown type name ‘bool’
extern bool xen_pvh;
^~~~
In file included from ./include/xen/interface/xen.h:30:0,
from ./include/xen/xen.h:29,
from sound/xen/xen_snd_front_shbuf.c:11:
./arch/x86/include/asm/xen/interface.h:92:21: error: unknown type name ‘uint64_t’
DEFINE_GUEST_HANDLE(uint64_t);
^

Quoted 3 lines

Adding #include <linux/kernel.h> fixed the issue.

Did you really test your patches with the latest Linus tree?

My bad, it does build for ARM (which is my target), but also does need "#include <linux/kernel.h>" for x86 which I didn't build this time. Sorry about that.

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

Do you want me to resend this single patch or you can make the change while applying?

Yes, it's fine.

Thank you

FWIW, the patches are in topic/xen branch in sound.git tree, and I'll keep boiling for a while to see if any issues are caught by 0day bot.

Quoted 7 lines

... and now the topic/xen branch got merged to for-next, targeted for 4.18.

Thanks for your patient works!

Takashi

Great news, thank you,
Oleksandr

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#26 lore raw

Re: [PATCH v3 5/6] ALSA: xen-front: Implement ALSA virtual sound driver

In reply to Oleksandr Andrushchenko

Hi,

sound/xen/xen_snd_front_alsa.c line 637

Quoted 13 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_alsa.c new file +6 -0
new file mode 100644
index 000000000000..5041f83e98d2
...
+/*
+ * FIXME: The mmaped data transfer is asynchronous and there is no
+ * ack signal from user-space when it is done. This is the
+ * reason it is not implemented in the PV driver as we do need
+ * to know when the buffer can be transferred to the backend.
+ */
...

In ALSA PCM interface v2.0.14 or later, SNDRV_PCM_INFO_SYNC_APPLPTR is available. This flag express that userspace applications are expected to call ioctl(2) with 'SNDRV_PCM_IOCTL_SYNC_PTR' even if they oprate to memory mapped page frames for PCM samples. For detail, please refer to a commit 42f945970af9 ('ALSA: pcm: Add the explicit appl_ptr sync support')[1].

As a supplement, please refer to below commits:
* 4b671f577474 ('ALSA: pcm: Add an ioctl to specify the supported protocol version')[2]
* b602aa8eb1a0 ('ALSA: pcm: Disable only control mmap for explicit appl_ptr sync')[3]

Alsa-lib v1.1.5 or later supports this flag and existent applications can run transparently.

For developers, a tracepoint may be useful:
* fccf53881e9b ('ALSA: pcm: add 'applptr' event of tracepoint')[4]

For your information.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=42f945970af9
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4b671f577474
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b602aa8eb1a0
[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fccf53881e9b

Regards

Takashi Sakamoto

#29 lore raw

Re: [PATCH v3 5/6] ALSA: xen-front: Implement ALSA virtual sound driver

In reply to Oleksandr Andrushchenko

Hi,

sound/xen/xen_snd_front_alsa.c line 637

Quoted 13 lines · Oleksandr Andrushchenko
sound/xen/xen_snd_front_alsa.c new file +6 -0
new file mode 100644
index 000000000000..5041f83e98d2
...
+/*
+ * FIXME: The mmaped data transfer is asynchronous and there is no
+ * ack signal from user-space when it is done. This is the
+ * reason it is not implemented in the PV driver as we do need
+ * to know when the buffer can be transferred to the backend.
+ */
...

In ALSA PCM interface v2.0.14 or later, SNDRV_PCM_INFO_SYNC_APPLPTR is available. This flag express that userspace applications are expected to call ioctl(2) with 'SNDRV_PCM_IOCTL_SYNC_PTR' even if they oprate to memory mapped page frames for PCM samples. For detail, please refer to a commit 42f945970af9 ('ALSA: pcm: Add the explicit appl_ptr sync support')[1].

As a supplement, please refer to below commits:
* 4b671f577474 ('ALSA: pcm: Add an ioctl to specify the supported protocol version')[2]
* b602aa8eb1a0 ('ALSA: pcm: Disable only control mmap for explicit appl_ptr sync')[3]

Alsa-lib v1.1.5 or later supports this flag and existent applications can run transparently.

For developers, a tracepoint may be useful:
* fccf53881e9b ('ALSA: pcm: add 'applptr' event of tracepoint')[4]

For your information.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=42f945970af9
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4b671f577474
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b602aa8eb1a0
[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fccf53881e9b

Regards

Takashi Sakamoto

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#27 lore raw

Re: [PATCH v3 5/6] ALSA: xen-front: Implement ALSA virtual sound driver

In reply to Takashi Sakamoto
Quoted 37 lines · Takashi Sakamoto

Hi,

Review

Quoted 1 line · Oleksandr Andrushchenko
(quoted diff) +0 -0

b/sound/xen/xen_snd_front_alsa.c

sound/xen/xen_snd_front_alsa.c line 637

Quoted 12 lines

new file mode 100644
index 000000000000..5041f83e98d2

sound/xen/xen_snd_front_alsa.c new file +6 -0
...
+/*
+ * FIXME: The mmaped data transfer is asynchronous and there is no
+ * ack signal from user-space when it is done. This is the
+ * reason it is not implemented in the PV driver as we do need
+ * to know when the buffer can be transferred to the backend.
+ */
...

In ALSA PCM interface v2.0.14 or later, SNDRV_PCM_INFO_SYNC_APPLPTR is available. This flag express that userspace applications are expected to call ioctl(2) with 'SNDRV_PCM_IOCTL_SYNC_PTR' even if they oprate to memory mapped page frames for PCM samples. For detail, please refer to a commit 42f945970af9 ('ALSA: pcm: Add the explicit appl_ptr sync support')[1].

As a supplement, please refer to below commits:
 * 4b671f577474 ('ALSA: pcm: Add an ioctl to specify the supported protocol version')[2]
 * b602aa8eb1a0 ('ALSA: pcm: Disable only control mmap for explicit appl_ptr sync')[3]

Alsa-lib v1.1.5 or later supports this flag and existent applications can run transparently.

For developers, a tracepoint may be useful:
 * fccf53881e9b ('ALSA: pcm: add 'applptr' event of tracepoint')[4]

Quoted 7 lines

For your information.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=42f945970af9
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4b671f577474
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b602aa8eb1a0
[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fccf53881e9b

Oh, this is very useful, thank you so much for such a detailed description. I'll take a close look at the above and see if Xen sound driver can benefit from this.

Quoted 4 lines

Regards

Takashi Sakamoto

Thank you very much,
Oleksandr

#28 lore raw

Re: [PATCH v3 5/6] ALSA: xen-front: Implement ALSA virtual sound driver

In reply to Takashi Sakamoto
Quoted 37 lines · Takashi Sakamoto

Hi,

Review

Quoted 1 line · Oleksandr Andrushchenko
(quoted diff) +0 -0

b/sound/xen/xen_snd_front_alsa.c

sound/xen/xen_snd_front_alsa.c line 637

Quoted 12 lines

new file mode 100644
index 000000000000..5041f83e98d2

sound/xen/xen_snd_front_alsa.c new file +6 -0
...
+/*
+ * FIXME: The mmaped data transfer is asynchronous and there is no
+ * ack signal from user-space when it is done. This is the
+ * reason it is not implemented in the PV driver as we do need
+ * to know when the buffer can be transferred to the backend.
+ */
...

In ALSA PCM interface v2.0.14 or later, SNDRV_PCM_INFO_SYNC_APPLPTR is available. This flag express that userspace applications are expected to call ioctl(2) with 'SNDRV_PCM_IOCTL_SYNC_PTR' even if they oprate to memory mapped page frames for PCM samples. For detail, please refer to a commit 42f945970af9 ('ALSA: pcm: Add the explicit appl_ptr sync support')[1].

As a supplement, please refer to below commits:
 * 4b671f577474 ('ALSA: pcm: Add an ioctl to specify the supported protocol version')[2]
 * b602aa8eb1a0 ('ALSA: pcm: Disable only control mmap for explicit appl_ptr sync')[3]

Alsa-lib v1.1.5 or later supports this flag and existent applications can run transparently.

For developers, a tracepoint may be useful:
 * fccf53881e9b ('ALSA: pcm: add 'applptr' event of tracepoint')[4]

Quoted 7 lines

For your information.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=42f945970af9
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4b671f577474
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b602aa8eb1a0
[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fccf53881e9b

Oh, this is very useful, thank you so much for such a detailed description. I'll take a close look at the above and see if Xen sound driver can benefit from this.

Quoted 4 lines

Regards

Takashi Sakamoto

Thank you very much,
Oleksandr

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel