From patchwork Wed Apr 24 04:19:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 10913995 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C8BA13B5 for ; Wed, 24 Apr 2019 04:21:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DB112898B for ; Wed, 24 Apr 2019 04:21:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2194428A28; Wed, 24 Apr 2019 04:21:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1270B2898B for ; Wed, 24 Apr 2019 04:21:23 +0000 (UTC) Received: from localhost ([127.0.0.1]:35434 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJ9PP-0007ZJ-8f for patchwork-qemu-devel@patchwork.kernel.org; Wed, 24 Apr 2019 00:21:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJ9OH-0006J5-SN for qemu-devel@nongnu.org; Wed, 24 Apr 2019 00:20:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJ9OH-0008Kw-0v for qemu-devel@nongnu.org; Wed, 24 Apr 2019 00:20:13 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:58057) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJ9OG-0007ud-C6; Wed, 24 Apr 2019 00:20:12 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44pnCk0CFQz9s5c; Wed, 24 Apr 2019 14:20:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556079602; bh=RHUPFBMkFYu4hWKdf7/Df7eUjK+AtZJm7HDAbd4EALs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dqmU1hsNsb6SjVgpIxonA0opKNJsMDmyJn7038h7aMhvDecrUo9mhBJJ/+a4UApSZ 4UxSDBSRdB6yaH2bT5FVyVEZ1/t6sspEqrsakOjQAiNyeQWy49XIZDjQNIn2h5p0oE aGnFhtCdh/z4hsMa3B9V6dyyDnuIgN1xS1PDi+Jk= From: David Gibson To: Marcel Apfelbaum , qemu-devel@nongnu.org, "Michael S. Tsirkin" , Alex Williamson , Greg Kurz Date: Wed, 24 Apr 2019 14:19:57 +1000 Message-Id: <20190424041959.4087-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190424041959.4087-1-david@gibson.dropbear.id.au> References: <20190424041959.4087-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PATCH v2 1/3] pcie: Remove redundant test in pcie_mmcfg_data_{read, write}() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP These functions have an explicit test for accesses above the device's config size. But pci_host_config_{read,write}_common() which they're about to call already have checks against the config space limit and do the right thing. So, remove the redundant tests. Signed-off-by: David Gibson Reviewed-by: Greg Kurz --- hw/pci/pcie_host.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hw/pci/pcie_host.c b/hw/pci/pcie_host.c index 553db56778..1ee4945a6d 100644 --- a/hw/pci/pcie_host.c +++ b/hw/pci/pcie_host.c @@ -47,11 +47,6 @@ static void pcie_mmcfg_data_write(void *opaque, hwaddr mmcfg_addr, } addr = PCIE_MMCFG_CONFOFFSET(mmcfg_addr); limit = pci_config_size(pci_dev); - if (limit <= addr) { - /* conventional pci device can be behind pcie-to-pci bridge. - 256 <= addr < 4K has no effects. */ - return; - } pci_host_config_write_common(pci_dev, addr, limit, val, len); } @@ -70,11 +65,6 @@ static uint64_t pcie_mmcfg_data_read(void *opaque, } addr = PCIE_MMCFG_CONFOFFSET(mmcfg_addr); limit = pci_config_size(pci_dev); - if (limit <= addr) { - /* conventional pci device can be behind pcie-to-pci bridge. - 256 <= addr < 4K has no effects. */ - return ~0x0; - } return pci_host_config_read_common(pci_dev, addr, limit, len); }