From patchwork Sat Oct 22 04:40:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13015773 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 D341BC433FE for ; Sat, 22 Oct 2022 05:35:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1om6LO-0005lf-MC; Sat, 22 Oct 2022 00:42:46 -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 1om6LG-0005k0-Eg for qemu-devel@nongnu.org; Sat, 22 Oct 2022 00:42:38 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1om6LC-0003wx-90 for qemu-devel@nongnu.org; Sat, 22 Oct 2022 00:42:37 -0400 Received: by mail-pl1-x632.google.com with SMTP id p3so3131819pld.10 for ; Fri, 21 Oct 2022 21:42:33 -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=8OX4G9SaMZ/DTLrx8FtRqvNmcNEup+3capnfCY2VlS4=; b=7tG0lgjQ4KqhnTFa+K2Pu0mK2C/6jK/ANLDNRgsrcUkRfunuik11vFh6+nTlBaM8+Y ye/u/9hFbwHqZMdeldBXrDAQMIvf8VX6ePTc6ZgJuqjIBpNJxWgYi6ArWwJFCXg2VWe9 bN6B6roLDL8t9OllFmQsRjUJ9pKguF6brdc9znGMQsdcC6DgHvcTbuF/wMaBHnJLW1mc 7gWkcbD8g/Nw9nrjarXvGq5aXi8gAhoLgej8Rnx+r83+u4PAFfoS70GgAvjzIxUuMTws 3L+t+7xWkCpDrOxC0vfCoXG5qmJLrJvkcGliAWBydQFFQSdHH88A0L71aGWyq4UfEp4S 1VVg== 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=8OX4G9SaMZ/DTLrx8FtRqvNmcNEup+3capnfCY2VlS4=; b=vTXQ8AId74tNhGHyODnEkLaN8LVqvWBLv5ArTxLv71VKLVgfAonwZVnWSAC6L6HH4C CiBtXo3UAmqS6GwJaQ3D2goRCWRWyrh4z4a62yXMvBa/BVWbviO3Z7hxnqkncNuf2rf6 TqrvlxXndEpoaQwl2Vx4bOGTh9OoDTc08ArnvyyShz36urBVczbPdA8epx/aHpi7IAQW QfCc2ewnkeNVdA9N6SW9FEyqinx0xlhisF0jYVHEinNnjFtDF6juj2c13/XrVX4FsfzG hci/8noGG2cYBbqQnVem+qucfG21vzgPt+2VpAZ4dGNiXrNN4Z0Mi7MtU2s9m6/QJvVv 1gxg== X-Gm-Message-State: ACrzQf2uK1/9RgJfE6/xaeNyeMnLgM/46KafraLY9r9Xn6avmxgGcU74 5/pPBFdGm6m/UetuttzPWEYYLA== X-Google-Smtp-Source: AMsMyM6Rb5nXrsay/OFq/WW4Rycf+X1zPCB+sC6XjoqKGLXS5paNgut+IXLzRyz/SMD2XPdHNiCqxw== X-Received: by 2002:a17:90a:54:b0:212:eb01:1ce with SMTP id 20-20020a17090a005400b00212eb0101cemr97956pjb.236.1666413752679; Fri, 21 Oct 2022 21:42:32 -0700 (PDT) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id y16-20020a17090264d000b001868d4600b8sm178049pli.158.2022.10.21.21.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 21:42:32 -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 v2 16/17] virtio-pci: Omit errp for pci_add_capability Date: Sat, 22 Oct 2022 13:40:52 +0900 Message-Id: <20221022044053.81650-17-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221022044053.81650-1-akihiko.odaki@daynix.com> References: <20221022044053.81650-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::632; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x632.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 Signed-off-by: Akihiko Odaki --- hw/virtio/virtio-pci.c | 9 ++------- include/hw/pci/pci.h | 12 ++---------- include/hw/virtio/virtio-pci.h | 2 +- 3 files changed, 5 insertions(+), 18 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/pci/pci.h b/include/hw/pci/pci.h index 51fd106f16..2a5d4b329f 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -2,7 +2,6 @@ #define QEMU_PCI_H #include "exec/memory.h" -#include "qapi/error.h" #include "sysemu/dma.h" /* PCI includes legacy ISA access. */ @@ -391,15 +390,8 @@ void pci_register_vga(PCIDevice *pci_dev, MemoryRegion *mem, void pci_unregister_vga(PCIDevice *pci_dev); pcibus_t pci_get_bar_addr(PCIDevice *pci_dev, int region_num); -int pci_add_capability_legacy(PCIDevice *pdev, uint8_t cap_id, - uint8_t offset, uint8_t size, - Error **errp); - -#define PCI_ADD_CAPABILITY_VA(pdev, cap_id, offset, size, errp, ...) \ - pci_add_capability_legacy(pdev, cap_id, offset, size, errp) - -#define pci_add_capability(...) \ - PCI_ADD_CAPABILITY_VA(__VA_ARGS__, &error_abort) +uint8_t pci_add_capability(PCIDevice *pdev, uint8_t cap_id, + uint8_t offset, uint8_t size); void pci_del_capability(PCIDevice *pci_dev, uint8_t cap_id, uint8_t cap_size); 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;