Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6157168ybl; Tue, 14 Jan 2020 23:09:40 -0800 (PST) X-Google-Smtp-Source: APXvYqx99/rGxX0fWIpXTnEJr9ISJ6TlGRD4xGuUD+GlbMrbfBdE3bUgHx/biLP3/ifB0bKJjIGR X-Received: by 2002:a9d:7852:: with SMTP id c18mr1702362otm.247.1579072180267; Tue, 14 Jan 2020 23:09:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579072180; cv=none; d=google.com; s=arc-20160816; b=z2ZG8LlYe86amJP/HG+no/4i8bGRNus1k0ePKzHpGwGkPppqijGchsCFnIDnkiSojl QHiv0AWKADW0NThMFtoS4mnAOaUvzRMWLkZdIhgKfuZB8VtK61ZpDHyqbBx2ghCTa0g8 cCSbh4ICzJDMyfP1PC86eTLsIA5/5jtc52Nl5Zr7rlt87l1PkB81KAjq8RShNhRHxhXi 7ZUABNT+6wo4hhWWx7kALGh8QxLLCyMr4OJ/PNAjqFkDsPHYoFuHt4+gHxIgftfJgbTI Oudd7ybehl/SUJMUdpShB/2ZLu+Pm68G2lXjuE0IYFyFzMXDlTHEsjSEDmiEDgLE6PuS o1vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=nxE4V51EfYDBxmD2AmhQegLFxqgAgC8btj/C16XOvLk=; b=dZIucYl/JqGyReRZVZM3mE1+3xKuODwJa6lrp3hOV+Ql4D1vOd/sq8XbAs3c1PNIOf sdexYO7eg1twd+K+w9+jOdgJ6MxrDQ6MX6L+I9nDSAsH10xvulYXhVp7I263emzvH2Hm ISbFESDqL5E0bo/d1QoWABcFnYYqauUtNaShOxPb2mxgBjqq+/HNkdhBp8p5/FgQlkbn wZuwvoYARNoMYZbghbAob05vpvYRFrdGC47plAPdCCkMHoZ7EOOLvRIij4MxRUAacBKv meeE0LqRCARBKc3k9mTjx1PZq3E8+4dA8tH28XcZ7ZqtbjmLuUVoLAOn0BJnAh5qCdQC psYQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11si9294879oie.152.2020.01.14.23.09.25; Tue, 14 Jan 2020 23:09:40 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726506AbgAOHGp (ORCPT + 99 others); Wed, 15 Jan 2020 02:06:45 -0500 Received: from mga09.intel.com ([134.134.136.24]:17208 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbgAOHGp (ORCPT ); Wed, 15 Jan 2020 02:06:45 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jan 2020 23:06:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,321,1574150400"; d="scan'208";a="219180633" Received: from unknown (HELO [10.238.130.246]) ([10.238.130.246]) by fmsmga007.fm.intel.com with ESMTP; 14 Jan 2020 23:06:40 -0800 Subject: Re: [PATCH v1 2/2] virtio-mmio: add features for virtio-mmio specification version 3 To: "Michael S. Tsirkin" , Zha Bin Cc: linux-kernel@vger.kernel.org, jasowang@redhat.com, slp@redhat.com, virtio-dev@lists.oasis-open.org, gerry@linux.alibaba.com, jing2.liu@intel.com, chao.p.peng@intel.com References: <20200105054412-mutt-send-email-mst@kernel.org> From: "Liu, Jing2" Message-ID: Date: Wed, 15 Jan 2020 15:06:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20200105054412-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/5/2020 7:04 PM, Michael S. Tsirkin wrote: > [...] >> +static int vm_find_vqs_msi(struct virtio_device *vdev, unsigned int nvqs, >> + struct virtqueue *vqs[], vq_callback_t *callbacks[], >> + const char * const names[], const bool *ctx, >> + struct irq_affinity *desc) >> +{ >> + int i, err, irq; >> + struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); >> + >> + /* Allocate nvqs irqs for queues and one irq for configuration */ >> + err = vm_request_msi_vectors(vdev, nvqs + 1); >> + if (err != 0) >> + return err; > Not all devices need high speed. Some might want to share > irqs between VQs, or even with config change callback. > Balloon is a case in point. > A hint about max # of MSI necessary would be a good > idea for this case. This seems being a hint about telling MSI number device supported and whether it wants MSI sharing. For devices with tens of queues at most or need high speed, they choose vector per queue, and can simply use fixed mapping. For others, it can ask for advanced mode, which means MSI sharing and dynamic mapping. What about let device decide the mode it would use, as follows. MaxVecNum 32bit - The max msi vector number that device supports. MsiState 32bit - bit[x]=0 implies vec per queue/config and fixed mapping. In this case, MsiVecNum>=num_queue+1 - bit [x]=1 implies the hint of msi sharing and dynamic mapping. In this case, MsiVecNum > Sharing MSI doesn't necessarily require dedicated registers like PCI has, > you can just program same vector in multiple VQs.