From patchwork Wed Oct 26 20:15:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13021271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9E1D2C38A2D for ; Wed, 26 Oct 2022 20:27:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onmqh-0003Zb-2e; Wed, 26 Oct 2022 16:18:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1onmpg-0001yf-E3 for qemu-devel@nongnu.org; Wed, 26 Oct 2022 16:17:02 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1onmpe-0003MB-QK for qemu-devel@nongnu.org; Wed, 26 Oct 2022 16:17:00 -0400 Received: by mail-pj1-x102e.google.com with SMTP id ez6so15168112pjb.1 for ; Wed, 26 Oct 2022 13:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rm7TXfPfJEnn+bdinfLf47b7tVNRCBtAKZ++jzyT4uk=; b=5gp+aI0BwznbykBgW9/3Mm2xRuNQ1QsojiUb+5uj4SWN4WquJirAHQmonFqpJQm9cR KxjbOUbp5GwTLJuQjGPGl161CGZ6isZceNXwEDmWRFOgtS0wJ49ekkgk23795J/yZ/zT uVzslhnBtjJzwOYR2nE6QuggqZNTTeBEAN9pRn21nnBzTs5SraYNd+/UJyQX7qtNfwnh Iwyv5FeCoVNRo79At0XNwmY9m5LX2Da9vkIDaxT5SnFEzOxcwxsTy/WQNxA+KP+Y2Vxp 5pABP3Gdgrz7b7sNOEt5tzXto9TcLwcS+IEekbPk/+PBA/JW3+3trmZ2BIHY4LCNWiKA wabQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rm7TXfPfJEnn+bdinfLf47b7tVNRCBtAKZ++jzyT4uk=; b=Hu0ODbS43ZJfxAHoreqhVbLS2R0AKvN/MnH+Lcbjql2zjb8v8dy1DVmAHLnnwRTgyn pmYvm1ad71xcCyeGRzG8Wlj+S9877z4dnrTVP+QJXd55MAOJ0kd65dVfIZJYfzXAfQbj lBAN6r6EHX3HDhZDyvHtZ3LOgSb546/QR+b99mKOc+36BcHaIFdDRwFCVne1DZ6iHyxe 9sYkfQ1+g9jyWQ3Yx3bYeo/wIwCDT8TBsFY/JPr3qcsjbag6SlnZyluy+X1h/6rS3r/M uwB29IgIr2qnbIfSHY/OtTpK2/RhEUM74aUu2b8J0diMXoFts4i49VaOLNgF3URjrFSZ iGHg== X-Gm-Message-State: ACrzQf3kusiCbYiD5QLY6Q+jtPwoWfO4Gd5zaXgNqo0/MoZ3kSRhTjoF kvXwR+WZA7sldQbeWgX6adPgSw== X-Google-Smtp-Source: AMsMyM5ZFCyRp9sXTDnryNHng/gMz8Mkh8TymTvKukuogdol9Thn46nBQjqwxc/OmRI3DYUsIQXohg== X-Received: by 2002:a17:90b:3504:b0:213:5b03:639 with SMTP id ls4-20020a17090b350400b002135b030639mr4486443pjb.16.1666815417665; Wed, 26 Oct 2022 13:16:57 -0700 (PDT) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id y5-20020aa78f25000000b00541c68a0689sm3375770pfr.7.2022.10.26.13.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 13:16:57 -0700 (PDT) From: Akihiko Odaki To: Cc: Alex Williamson , qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-arm@nongnu.org, "Michael S . Tsirkin" , Marcel Apfelbaum , Gerd Hoffmann , Paolo Bonzini , Richard Henderson , Eduardo Habkost , John Snow , Dmitry Fleytman , Jason Wang , Stefan Weil , Keith Busch , Klaus Jensen , Peter Maydell , Andrey Smirnov , Paul Burton , Aleksandar Rikalo , Yan Vugenfirer , Yuri Benditovich , Akihiko Odaki Subject: [PATCH v3 15/16] virtio-pci: Omit errp for pci_add_capability Date: Thu, 27 Oct 2022 05:15:26 +0900 Message-Id: <20221026201527.24063-16-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221026201527.24063-1-akihiko.odaki@daynix.com> References: <20221026201527.24063-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::102e; envelope-from=akihiko.odaki@daynix.com; helo=mail-pj1-x102e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Omitting errp for pci_add_capability() causes it to abort if capabilities overlap. This behavior is appropriate heare because all of the capabilities set in this device are defined in the program and their overlap should not happen unless there is a programming error. Signed-off-by: Akihiko Odaki --- hw/virtio/virtio-pci.c | 9 ++------- include/hw/virtio/virtio-pci.h | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index c37bdc77ea..b393ff01be 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1154,8 +1154,7 @@ static int virtio_pci_add_mem_cap(VirtIOPCIProxy *proxy, PCIDevice *dev = &proxy->pci_dev; int offset; - offset = pci_add_capability(dev, PCI_CAP_ID_VNDR, 0, - cap->cap_len, &error_abort); + offset = pci_add_capability(dev, PCI_CAP_ID_VNDR, 0, cap->cap_len); assert(cap->cap_len >= sizeof *cap); memcpy(dev->config + offset + PCI_CAP_FLAGS, &cap->cap_len, @@ -1864,11 +1863,7 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) pcie_endpoint_cap_init(pci_dev, 0); - pos = pci_add_capability(pci_dev, PCI_CAP_ID_PM, 0, - PCI_PM_SIZEOF, errp); - if (pos < 0) { - return; - } + pos = pci_add_capability(pci_dev, PCI_CAP_ID_PM, 0, PCI_PM_SIZEOF); pci_dev->exp.pm_cap = pos; diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h index 2446dcd9ae..9f3736723c 100644 --- a/include/hw/virtio/virtio-pci.h +++ b/include/hw/virtio/virtio-pci.h @@ -141,7 +141,7 @@ struct VirtIOPCIProxy { uint32_t msix_bar_idx; uint32_t modern_io_bar_idx; uint32_t modern_mem_bar_idx; - int config_cap; + uint8_t config_cap; uint32_t flags; bool disable_modern; bool ignore_backend_features;