Commit graph

8 commits

Author SHA1 Message Date
Takashi Iwai
4bb1e4e7cc ALSA: xen: Drop superfluous ioctl PCM ops
PCM core deals the empty ioctl field now as default(*).
Let's kill the redundant lines.

(*) commit fc033cbf6f ("ALSA: pcm: Allow NULL ioctl ops")

Link: https://lore.kernel.org/r/20191210061145.24641-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-11 07:25:35 +01:00
Colin Ian King
3fc4147653 ALSA: xen-front: fix unintention integer overflow on left shifts
Shifting the integer value 1 is evaluated using 32-bit
arithmetic and then used in an expression that expects a 64-bit
value, so there is potentially an integer overflow. Fix this
by using the BIT_ULL macro to perform the shift.

[ Note: as of the time being, no actual integer overflow hits because
  all values are less than 32bit, not including the extended 3-byte or
  DSD formats.  But this is the right fix for future usage, of
  course. -- tiwai ]

Addresses-Coverity: ("Unintentional integer overflow")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-28 10:41:17 +02:00
Oleksandr Andrushchenko
8b030a57e3 ALSA: xen-front: Do not use stream buffer size before it is set
This fixes the regression introduced while moving to Xen shared
buffer implementation.

Fixes: 58f9d806d1 ("ALSA: xen-front: Use Xen common shared buffer implementation")
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Cc: <stable@vger.kernel.org> # v5.0+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-04-04 14:44:18 +02:00
Oleksandr Andrushchenko
58f9d806d1 ALSA: xen-front: Use Xen common shared buffer implementation
Use page directory based shared buffer implementation
now available as common code for Xen frontend drivers.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
2018-12-18 12:19:37 -05:00
Nick Simonov
e53134fefd ALSA: xen-front: Refine indentations and constify snd_pcm_ops
snd_pcm_ops are not supposed to change. So mark the
non-const structs as const. Also, refine indentation
to ncrease readability.

Signed-off-by: Nick Simonov <nicksimonovv@gmail.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-09-20 09:14:52 +02:00
Takashi Iwai
3ac14b3960 ALSA: xen: Use standard pcm_format_to_bits() for ALSA format bits
The open codes with the bit shift in xen_snd_front_alsa.c give sparse
warnings as the PCM format type is with __bitwise.
There is already a standard macro to get the format bits, so let's use
it instead.

This fixes sparse warnings like:
  sound/xen/xen_snd_front_alsa.c:191:47: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-27 09:05:34 +02:00
Colin Ian King
014cea591a ALSA: xen-front: fix unsigned error check on return from to_sndif_format
The negative error return from the call to to_sndif_format is being
assigned to an unsigned 8 bit integer and hence the check for a negative
value is always going to be false.  Fix this by using ret as the error
return and hence the negative error can be detected and assign
the u8 sndif_format to ret if there is no error.

Detected by CoverityScan, CID#1469385 ("Unsigned compared against 0")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamoccchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-28 11:30:33 +02:00
Oleksandr Andrushchenko
1cee559351 ALSA: xen-front: Implement ALSA virtual sound driver
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.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-16 12:59:57 +02:00