Received: by 10.192.165.156 with SMTP id m28csp2131159imm; Thu, 12 Apr 2018 09:05:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx48XIYHEuHDRf7anluqY9ldxt2TpODv6BFTdcgY1VeI+Rfw8u5H/0E9BjT+ZNj6FbG9LvF+P X-Received: by 2002:a17:902:604b:: with SMTP id a11-v6mr1714515plt.184.1523549124063; Thu, 12 Apr 2018 09:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523549124; cv=none; d=google.com; s=arc-20160816; b=nTf5J48XYrfFyV+2my/ugrMLYj9SVuQ0+Lck+JoRFxmNuqWMMgHH8/XIi9NnVhbRDv 89PM1hDjoOfpZZWgjSI9AxWiyKjMpUZELwjNDCGDiOkKg2jhr/j+tEkN4MNkCBuLcc60 vXHfHh4YS3VQi6VT/bsHpgUNjfvAvkQDTZzTbseqYQr7Efp1R4fgqLVrJ3LKW/JSgc4i UCPYJ0c5DP9t00zy15J6ta7EeR9+WNB8yZo14NzIQSqeOoLXAjvLNMPIQt+145EyyTxm TQO/RTyCG0brJHFZPqrX/ooUAzIp3FlkV6B7X70F8XGhv+H/BfRVJmyqCVKqheSQZdB5 JbaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=kByviSoXbQwS7PzbXRmJGzHa4neQSB3a/Sn7Db9kyYw=; b=OKlsu91MjRxyR1sp01DZwM0T3aNWq/g0dogFfZveJ1yYlAvQA64ULMMz+aWNLKDiF6 OsGM2Opb4tvLhAMspNxWkT1TL4v79gz1g3IfcyaNtksozVk6sIuHzeWpVDJgTUrTCQuA 7l4D0am5bnwKXKxaTf5m3LNRYzLOE0YYhDaQfiPI13Kq+VyWise9vgw7j0AN9FFwzeat KtX2dtDNiT/g17pGs3AtDc/sTo2nXefynCA32+DIp5cWwllX8lCIG7UVe5JkZmdgtHjf GRZuBGaP2MwBG7Bz8j7BZ/J4CxMB3ogyBra3KMDDpOQVeDpCO2lLHNWdo4zVGtmoy7vs kNMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rr4n2LuM; 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 k11-v6si3503252pls.368.2018.04.12.09.04.46; Thu, 12 Apr 2018 09:05:24 -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=rr4n2LuM; 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 S1752911AbeDLQBk (ORCPT + 99 others); Thu, 12 Apr 2018 12:01:40 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:33005 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751870AbeDLQBg (ORCPT ); Thu, 12 Apr 2018 12:01:36 -0400 Received: by mail-lf0-f67.google.com with SMTP id x70-v6so8467585lfa.0 for ; Thu, 12 Apr 2018 09:01:35 -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:in-reply-to:references; bh=kByviSoXbQwS7PzbXRmJGzHa4neQSB3a/Sn7Db9kyYw=; b=rr4n2LuMVE3W5BgaouSgalPmMVzeHFh3MqUeq47X1BpqckUZGZSY/xHehfqp0tHENj hNTeFWxB6uspDrZqjPmi0y+e9kkMLmkOt1PTPzPzo1Vmqs8MbV8T+u/T8agnZB6CIAFo a7jMyFRa4dFLnq7jYNIDyans3xHwbyLaj8LW8Su0c9AW931MXzXwMzW+2RcYjLvWE0RJ RQBCQGd2nDbhhGDeiu0CXUWCerC1htD7DmagLUWrSgja9vH3EiubZ3R7axhtu6JdfqkO Q8OD3zQlqCWBSPUC6P1geKzJG01ZyoE7k2iXz8o4JElh5DItqDvvmRExKDtkX2GpEDUi 636Q== 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:in-reply-to :references; bh=kByviSoXbQwS7PzbXRmJGzHa4neQSB3a/Sn7Db9kyYw=; b=Xnq9FZEboi4eQoU4p5gZWCKeJQQnTVm4ppjBEKKE7iGl5l7aFMQFHebJxHXPcKMv9+ dGac8HVdZh+TjzVilzbOUPPqdKmAOVYTRolwEHWz9KrYhazTVuzaFtX1G0Kqg5WmaAd5 hgvV6XMpBwH5ZQLWEiFYU5EWpFN8XP12iMs0V4quU3ZBHvin1H31J0z5Rdu/eE6x/jD4 ujYtheYLNukpsbGBV2K8Q5ZlDt5XeDR54jWaEhimMfLtzZ/oQghZIAnY+Qkz2KQY/YrK U0R937uCHcaDACO3vqm+By0jP1dsUDrUZ8GfWc5+1yeqE9pI7/mddRtOk094v60dFnUU Q39Q== X-Gm-Message-State: ALQs6tChHx2Qr5Qu8pR+CU3j0V00WBiGjFamwCKJmBe85zVgEtEEubt7 W5NE8la/3FlMhbCev2+u6Xo= X-Received: by 2002:a19:274b:: with SMTP id n72-v6mr5836469lfn.48.1523548894465; Thu, 12 Apr 2018 09:01:34 -0700 (PDT) Received: from localhost.localdomain (207-17-94-178.pool.ukrtel.net. [178.94.17.207]) by smtp.gmail.com with ESMTPSA id m11sm644541ljh.37.2018.04.12.09.01.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Apr 2018 09:01:33 -0700 (PDT) From: Oleksandr Andrushchenko X-Google-Original-From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Cc: boris.ostrovsky@oracle.com, jgross@suse.com, iurii.konovalenko@globallogic.com, oleksandr.dmytryshyn@globallogic.com, konrad.wilk@oracle.com, tiwai@suse.de, andr2000@gmail.com Subject: [PATCH 5/5] xen/sndif: Add explicit back and front parameter negotiation Date: Thu, 12 Apr 2018 19:01:02 +0300 Message-Id: <20180412160102.15833-6-oleksandr_andrushchenko@epam.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180412160102.15833-1-oleksandr_andrushchenko@epam.com> References: <20180412160102.15833-1-oleksandr_andrushchenko@epam.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Parameters supported by this request/response: - format mask - sample rate interval - number of channels interval - buffer size, interval, frames - period size, interval, frames Signed-off-by: Oleksandr Andrushchenko Cc: Konrad Rzeszutek Wilk Cc: Takashi Iwai --- include/xen/interface/io/sndif.h | 133 +++++++++++++++++++++++++++++-- 1 file changed, 126 insertions(+), 7 deletions(-) diff --git a/include/xen/interface/io/sndif.h b/include/xen/interface/io/sndif.h index 131c3b469d4a..78bb5d9f8d83 100644 --- a/include/xen/interface/io/sndif.h +++ b/include/xen/interface/io/sndif.h @@ -465,6 +465,7 @@ #define XENSND_OP_MUTE 6 #define XENSND_OP_UNMUTE 7 #define XENSND_OP_TRIGGER 8 +#define XENSND_OP_HW_PARAM_QUERY 9 #define XENSND_OP_TRIGGER_START 0 #define XENSND_OP_TRIGGER_PAUSE 1 @@ -832,28 +833,142 @@ struct xensnd_trigger_req { }; /* - *---------------------------------- Responses -------------------------------- + * Request stream parameter ranges: request intervals and + * masks of supported ranges for stream configuration values. * - * All response packets have the same length (64 octets) + * Sound device configuration for a particular stream is a limited subset + * of the multidimensional configuration available on XenStore, e.g. + * once the frame rate has been selected there is a limited supported range + * for sample rates becomes available (which might be the same set configured + * on XenStore or less). For example, selecting 96kHz sample rate may limit + * number of channels available for such configuration from 4 to 2, etc. + * Thus, each call to XENSND_OP_HW_PARAM_QUERY may reduce configuration + * space making it possible to iteratively get the final stream configuration, + * used in XENSND_OP_OPEN request. + * + * See response format for this request. * - * Response for all requests: * 0 1 2 3 octet * +----------------+----------------+----------------+----------------+ - * | id | operation | reserved | 4 + * | id | _HW_PARAM_QUERY| reserved | 4 * +----------------+----------------+----------------+----------------+ - * | status | 8 + * | reserved | 8 + * +----------------+----------------+----------------+----------------+ + * | formats mask low 32-bit | 12 + * +----------------+----------------+----------------+----------------+ + * | formats mask high 32-bit | 16 + * +----------------+----------------+----------------+----------------+ + * | min rate | 20 + * +----------------+----------------+----------------+----------------+ + * | max rate | 24 + * +----------------+----------------+----------------+----------------+ + * | min channels | 28 + * +----------------+----------------+----------------+----------------+ + * | max channels | 32 + * +----------------+----------------+----------------+----------------+ + * | min buffer frames | 36 + * +----------------+----------------+----------------+----------------+ + * | max buffer frames | 40 + * +----------------+----------------+----------------+----------------+ + * | min period frames | 44 + * +----------------+----------------+----------------+----------------+ + * | max period frames | 48 * +----------------+----------------+----------------+----------------+ - * | reserved | 12 + * | reserved | 52 * +----------------+----------------+----------------+----------------+ * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| * +----------------+----------------+----------------+----------------+ * | reserved | 64 * +----------------+----------------+----------------+----------------+ * + * formats - uint64_t, bit mask representing values of the parameter + * made as bitwise OR of (1 << XENSND_PCM_FORMAT_XXX) values + * + * For interval parameters: + * min - uint32_t, minimum value of the parameter + * max - uint32_t, maximum value of the parameter + * + * Frame is defined as a product of the number of channels by the + * number of octets per one sample. + */ + +struct xensnd_query_hw_param { + uint64_t formats; + struct { + uint32_t min; + uint32_t max; + } rates; + struct { + uint32_t min; + uint32_t max; + } channels; + struct { + uint32_t min; + uint32_t max; + } buffer; + struct { + uint32_t min; + uint32_t max; + } period; +}; + +/* + *---------------------------------- Responses -------------------------------- + * + * All response packets have the same length (64 octets) + * + * All response packets have common header: + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | id | operation | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | status | 8 + * +----------------+----------------+----------------+----------------+ + * * id - uint16_t, copied from the request * operation - uint8_t, XENSND_OP_* - copied from request * status - int32_t, response status, zero on success and -XEN_EXX on failure * + * + * HW parameter query response - response for XENSND_OP_HW_PARAM_QUERY: + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | id | operation | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | status | 8 + * +----------------+----------------+----------------+----------------+ + * | formats mask low 32-bit | 12 + * +----------------+----------------+----------------+----------------+ + * | formats mask high 32-bit | 16 + * +----------------+----------------+----------------+----------------+ + * | min rate | 20 + * +----------------+----------------+----------------+----------------+ + * | max rate | 24 + * +----------------+----------------+----------------+----------------+ + * | min channels | 28 + * +----------------+----------------+----------------+----------------+ + * | max channels | 32 + * +----------------+----------------+----------------+----------------+ + * | min buffer frames | 36 + * +----------------+----------------+----------------+----------------+ + * | max buffer frames | 40 + * +----------------+----------------+----------------+----------------+ + * | min period frames | 44 + * +----------------+----------------+----------------+----------------+ + * | max period frames | 48 + * +----------------+----------------+----------------+----------------+ + * | reserved | 52 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 64 + * +----------------+----------------+----------------+----------------+ + * + * Meaning of the values in this response is the same as for + * XENSND_OP_HW_PARAM_QUERY request. + */ + +/* *----------------------------------- Events ---------------------------------- * * Events are sent via shared page allocated by the front and propagated by @@ -906,6 +1021,7 @@ struct xensnd_req { struct xensnd_open_req open; struct xensnd_rw_req rw; struct xensnd_trigger_req trigger; + struct xensnd_query_hw_param hw_param; uint8_t reserved[56]; } op; }; @@ -915,7 +1031,10 @@ struct xensnd_resp { uint8_t operation; uint8_t reserved; int32_t status; - uint8_t reserved1[56]; + union { + struct xensnd_query_hw_param hw_param; + uint8_t reserved1[56]; + } resp; }; struct xensnd_evt { -- 2.17.0