From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C73F1C433ED for ; Tue, 6 Apr 2021 10:04:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 19539613C2 for ; Tue, 6 Apr 2021 10:04:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19539613C2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lTiZa-0008Dq-P9 for qemu-devel@archiver.kernel.org; Tue, 06 Apr 2021 06:04:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lTiYF-0007Yy-EX for qemu-devel@nongnu.org; Tue, 06 Apr 2021 06:03:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38359) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lTiY8-0008Mk-3Q for qemu-devel@nongnu.org; Tue, 06 Apr 2021 06:03:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617703384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zH6Wn8OepDQOpjJzXqayUaUaTBuDolvCmcEssIWrgas=; b=OqSaec4yJEWoAV3E3cgxqxECNhbePFYK/SHshYB0/nfMSgqMErZ4HheRr7oqik/9e2CKRl H7X/86/D4fnRWoEQ0ZGsmoUyC8H66CJFKPhsKkgXbT2XCNtFCs45Axgn7pK2JLJSJIqFYK rz1kEdbFbaK+yW9rU751k69IycyZijU= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-70-QoC7Zm2TNeKz8FeXi2vldA-1; Tue, 06 Apr 2021 06:03:02 -0400 X-MC-Unique: QoC7Zm2TNeKz8FeXi2vldA-1 Received: by mail-wr1-f70.google.com with SMTP id t2so1676732wrr.1 for ; Tue, 06 Apr 2021 03:03:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=zH6Wn8OepDQOpjJzXqayUaUaTBuDolvCmcEssIWrgas=; b=a2JstR1j4CTvBQjmoWiTO0D0G43vqQwXeFGR7S1X5rtrHPRb/KH7EqEmtwEUdwUGIg fCGtnwX04B2T3RksEsSDPAzBAzs7/yW17kQCTKoEhCK7VZNajQZj4W99nY2x5CMrcl9s 73Nwif3CHDhGzNTlDOfO55XxT7U77sky1DvcyddWiIydqvDo/IsIoY7OJzbMC/4rQQzt rqhnHnv9rkOQuA2/YuooPfC9RkYeSvY1JvViLd1fTKCLgPs2c2IqNR5bxLYwKd+gLyQd XH1OJskzfkS+EIKKHPpE57lXFw9LJX3fRM2eRMSD598rIl1+sJZhZC5MOpU2Wv81eimX PDeQ== X-Gm-Message-State: AOAM530m6uTzCsby/Bd4NmJlNvzhYvuEjO+wpOsFE+cdw6281Zk4K9hw eK2TdrZbUZgfH63g/x1mLCIlB0bGbv+kzGaRDg/VoArfCJZnUsQzliu6SeD8kZ8yr3kiet/m9Yy 6HGa8izKzTu9dr/w= X-Received: by 2002:a05:600c:228d:: with SMTP id 13mr3425644wmf.49.1617703381392; Tue, 06 Apr 2021 03:03:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCyvfjwJyfpH2vFy5NUD4bEIvnMp81mc3URP5MnmJAh/g7xsDENU7oOGWvHCHMTnI8UmNMew== X-Received: by 2002:a05:600c:228d:: with SMTP id 13mr3425616wmf.49.1617703381134; Tue, 06 Apr 2021 03:03:01 -0700 (PDT) Received: from redhat.com ([2a10:800e:f0d3:0:b69b:9fb8:3947:5636]) by smtp.gmail.com with ESMTPSA id o15sm32346843wra.93.2021.04.06.03.02.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 03:03:00 -0700 (PDT) Date: Tue, 6 Apr 2021 06:02:57 -0400 From: "Michael S. Tsirkin" To: Pavel Dovgalyuk Subject: Re: [PATCH] hw/virtio: enable ioeventfd configuring for mmio Message-ID: <20210406054157-mutt-send-email-mst@kernel.org> References: <161700379211.1135943.8859209566937991305.stgit@pasha-ThinkPad-X280> MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, alex.bennee@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" i tagged it for 6.1 pls remind me after release so it's not lost On Mon, Apr 05, 2021 at 08:50:31AM +0300, Pavel Dovgalyuk wrote: > ping > > On 29.03.2021 10:43, Pavel Dovgalyuk wrote: > > This patch adds ioeventfd flag for virtio-mmio configuration. > > It allows switching ioeventfd on and off. > > > > Signed-off-by: Pavel Dovgalyuk > > --- > > hw/virtio/virtio-mmio.c | 11 ++++++++++- > > include/hw/virtio/virtio-mmio.h | 5 +++++ > > 2 files changed, 15 insertions(+), 1 deletion(-) > > > > diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c > > index 342c918ea7..5952471b38 100644 > > --- a/hw/virtio/virtio-mmio.c > > +++ b/hw/virtio/virtio-mmio.c > > @@ -36,7 +36,9 @@ > > static bool virtio_mmio_ioeventfd_enabled(DeviceState *d) > > { > > - return kvm_eventfds_enabled(); > > + VirtIOMMIOProxy *proxy = VIRTIO_MMIO(d); > > + > > + return (proxy->flags & VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD) != 0; > > } > > static int virtio_mmio_ioeventfd_assign(DeviceState *d, > > @@ -720,6 +722,8 @@ static Property virtio_mmio_properties[] = { > > DEFINE_PROP_BOOL("format_transport_address", VirtIOMMIOProxy, > > format_transport_address, true), > > DEFINE_PROP_BOOL("force-legacy", VirtIOMMIOProxy, legacy, true), > > + DEFINE_PROP_BIT("ioeventfd", VirtIOMMIOProxy, flags, > > + VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT, true), > > DEFINE_PROP_END_OF_LIST(), > > }; > > @@ -731,6 +735,11 @@ static void virtio_mmio_realizefn(DeviceState *d, Error **errp) > > qbus_create_inplace(&proxy->bus, sizeof(proxy->bus), TYPE_VIRTIO_MMIO_BUS, > > d, NULL); > > sysbus_init_irq(sbd, &proxy->irq); > > + > > + if (!kvm_eventfds_enabled()) { > > + proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD; > > + } > > + > > if (proxy->legacy) { > > memory_region_init_io(&proxy->iomem, OBJECT(d), > > &virtio_legacy_mem_ops, proxy, > > diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h > > index d4c4c386ab..090f7730e7 100644 > > --- a/include/hw/virtio/virtio-mmio.h > > +++ b/include/hw/virtio/virtio-mmio.h > > @@ -49,12 +49,17 @@ typedef struct VirtIOMMIOQueue { > > uint32_t used[2]; > > } VirtIOMMIOQueue; > > +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT 1 > > +#define VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD \ > > + (1 << VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD_BIT) > > + > > struct VirtIOMMIOProxy { > > /* Generic */ > > SysBusDevice parent_obj; > > MemoryRegion iomem; > > qemu_irq irq; > > bool legacy; > > + uint32_t flags; > > /* Guest accessible state needing migration and reset */ > > uint32_t host_features_sel; > > uint32_t guest_features_sel; > >