From patchwork Sat Oct 22 04:40:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 1693333 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=daynix-com.20210112.gappssmtp.com header.i=@daynix-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=O4uKO+LW; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MvVZl1dsqz20S2 for ; Sat, 22 Oct 2022 16:41:49 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1om6LP-0005mp-Qr; Sat, 22 Oct 2022 00:42:47 -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 1om6LK-0005kn-Aw for qemu-devel@nongnu.org; Sat, 22 Oct 2022 00:42:42 -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 1om6LG-0003xb-V9 for qemu-devel@nongnu.org; Sat, 22 Oct 2022 00:42:41 -0400 Received: by mail-pj1-x102e.google.com with SMTP id m2so59859pjr.3 for ; Fri, 21 Oct 2022 21:42:38 -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=F1tEOGpRHGzQkodaDFgMlipmveAWiDG8GsDf3ehO7aw=; b=O4uKO+LWP7hndNdZPwWTrJyazKp2K6VbTXRd4zGY2o/nWLThNsfg1PlIJmto2xtKYO 1VBFtawIpVXdBb0Vu3Jw+ur8eUf7Vtdpi0OzMQ4ME8Cdiu49xJj/sfGcwEXz6+5dkEuP C8FpZSdAXkdg+bCzihdkWcTXEhSqiKqfCJiaxI4FpIMDK6JIP3wK0KUkrvjEmGQeBJl2 6HbwKVfp+mGlrM5Sv2/62g5AcPo1QreGTAj2X1ZGwW/bcZlVMC74xTFH9j9cwiYoEKnv HKWIIo7pkhJMQ6ZgbVVKrYOiljjJPmtALySjaeb6DOqpx/yKjANYFn+xV/LZ0wbNvqMz 1Sdw== 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=F1tEOGpRHGzQkodaDFgMlipmveAWiDG8GsDf3ehO7aw=; b=51nM3j/U/TnltQ37YQHfEgM1jK7s3C+cqtJHG0daWYU1LQH+pTrM7hQ9DVu6sn6ssQ FilZERk4oBezaGMKmAtlk4+B+mKduLyCDbGJo8KzVG/k5Ir4hh++SAeZ9rRqx21xNN6Q naph+8h9m2v90mM4l5MmS8c6vkN2VPOtR858CqoYeOwY48eaZy1rXt6VFqeeL0s2spcU nyWBo+wuFhQ0ewrITSH7wBzGBy80g7HObcyMALGMgPdrW/qQPUoKhHc+25xv5rTG9vlF tGfMBFGNYrTkGqjOREz7KQiLhNwRS2aFBruH9pBihNbfzWHY1TPzCrbhw0Z1FGA4rYtk DZyQ== X-Gm-Message-State: ACrzQf1oKoUmshEJ7asHeMQ/W8oj3rWWRPpSjA1PWBaO/31Bf8tfa7NF 45patXWXxWqqV8VVrHPkomgvtXCWBWcI28I/ X-Google-Smtp-Source: AMsMyM7BDrtc3/q5BZDB7qFVTiEVXiN7BmxrZwwapzaV2qDuuOOYU6kETANIcWZWAx1T39aAyXU8Tw== X-Received: by 2002:a17:90a:354:b0:20a:6867:4a2b with SMTP id 20-20020a17090a035400b0020a68674a2bmr61815076pjf.157.1666413757777; Fri, 21 Oct 2022 21:42:37 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 21:42:37 -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 17/17] pci: Remove legacy errp from pci_add_capability Date: Sat, 22 Oct 2022 13:40:53 +0900 Message-Id: <20221022044053.81650-18-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::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+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Akihiko Odaki --- hw/pci/pci.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 8ee2171011..8ff71e4553 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2513,38 +2513,23 @@ static void pci_del_option_rom(PCIDevice *pdev) } /* - * On success, pci_add_capability_legacy() returns a positive value - * that the offset of the pci capability. - * On failure, it sets an error and returns a negative error - * code. + * pci_add_capability() returns a positive value that the offset of the pci + * capability. */ -int pci_add_capability_legacy(PCIDevice *pdev, uint8_t cap_id, - uint8_t offset, uint8_t size, - Error **errp) +uint8_t pci_add_capability(PCIDevice *pdev, uint8_t cap_id, + uint8_t offset, uint8_t size) { uint8_t *config; - int i, overlapping_cap; + int i; if (!offset) { offset = pci_find_space(pdev, size); /* out of PCI config space is programming error */ assert(offset); } else { - /* Verify that capabilities don't overlap. Note: device assignment - * depends on this check to verify that the device is not broken. - * Should never trigger for emulated devices, but it's helpful - * for debugging these. */ + /* Verify that capabilities don't overlap. */ for (i = offset; i < offset + size; i++) { - overlapping_cap = pci_find_capability_at_offset(pdev, i); - if (overlapping_cap) { - error_setg(errp, "%s:%02x:%02x.%x " - "Attempt to add PCI capability %x at offset " - "%x overlaps existing capability %x at offset %x", - pci_root_bus_path(pdev), pci_dev_bus_num(pdev), - PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), - cap_id, offset, overlapping_cap, i); - return -EINVAL; - } + assert(!pci_find_capability_at_offset(pdev, i)); } }