From patchwork Thu Oct 12 12:18:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 732467 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp916572wrv; Thu, 12 Oct 2023 05:19:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqaMsssQzmqunhBpEAW5IRa4L1w9nQdtlCNE7127CUUf70LpeHwRxsM1UxsfRgGUEgzi9C X-Received: by 2002:a25:5143:0:b0:d81:89e9:9f4c with SMTP id f64-20020a255143000000b00d8189e99f4cmr19545371ybb.39.1697113191658; Thu, 12 Oct 2023 05:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697113191; cv=none; d=google.com; s=arc-20160816; b=GwuSqcsJFcHotxQNiGAysXrbvoEn/W4URFLILVXesABZcNNvVhLNm50fE/xPwGGdjq m6DAbKEG4Dmlnq71DQ3SfiaZFpQODrcW4u4hxmPyyFEkVIuLVh/64N+lMJ1imgXv2QKn JesOG4mfU3g4HZx+1QaHr584+M39mDeNYyRBEqkS4+8553Ud5PbJczQV5apv8uqZSZ7y hXiC7B+uW7zAQtStVdyatZa6VQ+q707fu3HHiTIoErNPbkVc+0igztfNPu3/nu4EBxe7 bawCfKUhDGkb6kLRysIVg5ilW6/LAJlXKMgN2pGXi19HFdL20HUXNgUGX+jTYbWhdLPm kupQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R+a0EyKEUxgm0lXUaYS7q8xxVvw9rO8rB+Ai3q4Lewo=; fh=uMYo3jOuXUsDthaXCE4/M6n3+voY5rtHQA7Grzg1cYU=; b=huBZI308GdrNWNHFXp63ZoWHkVTV8ncrZOXjCjw7r1VBovJByK7mJIyHDTFovsX1YM uyulzEU1uVwrvhT2CJXX75mMdA/cxMr638NfUjFuu0qQE9GUgSzc9yXvixYoKfClsdhu H031ZMEizp7N775NncxOmfV8Mlt8nyQ+jc5D8cff+kor2nyBUNAF8iIML1kqQxDrJKI/ 3FTlg7r97oR8Y0J1el6UdpSJ5pAe4a6qUhHEon3P8Kubrys9HnHml9ddEiQEeVOkzTlV D5Frz4577CVyp7p7xsKtB1LKnpMYeao9I3OVqyrckIMy+kSv1XqnAAaQmEs6dx32ffNo hqPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HRYzUdju; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ot8-20020a05620a818800b0076f39f669desi10887132qkn.51.2023.10.12.05.19.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Oct 2023 05:19:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HRYzUdju; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqufC-0003Lj-Ad; Thu, 12 Oct 2023 08:19:38 -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 1qqufA-0003JR-DT for qemu-devel@nongnu.org; Thu, 12 Oct 2023 08:19:36 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qquf8-0001qf-PL for qemu-devel@nongnu.org; Thu, 12 Oct 2023 08:19:36 -0400 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-9b98a699f45so140132066b.3 for ; Thu, 12 Oct 2023 05:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697113173; x=1697717973; darn=nongnu.org; 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=R+a0EyKEUxgm0lXUaYS7q8xxVvw9rO8rB+Ai3q4Lewo=; b=HRYzUdjuIzzshSApbyr6p80clJeH0G2TR9aLDH244d7GvCcTIH+nk1AKjkmuo7BXXT d/koBRIC3dMcx1KT6P0ECDXYd5S4aL1qcumb82bilXZj/QDhs454npNQKSeG2N/GYm8T aRm3AswaN2pYN2LFzUM2+vYOdYC7Hb1+BQO6oz9FjS9Mjfa3j0tEEIYw69r3FJx/zQwm j+XIUTzKGSEdrpx14brh9WYymhdCPcT6rg37hG4/LWPSvouzX2VfPMfkeyRSbiihJizg Gj6vTP1F3fW8ku7QB4s1aiOuGeyaUOG1F8I1C5sMA1xDvLnb7yklt5eWr5+gDRnLtbrF itGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697113173; x=1697717973; 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=R+a0EyKEUxgm0lXUaYS7q8xxVvw9rO8rB+Ai3q4Lewo=; b=iXaATBjjco0W7Qt9f3SJZgoOBn7eSCDaTUadfY0kFw2yrlC7XcdffZYKZskUbT25GW PZK69UuaLoKsON5xUsxOR+OKZT+F0hbSMtKnef+PuRCfuIC2K2+z5cw/h4dbR8gUw/B+ uTQbRzrMyUZ4cAjmXD0anJYVCfRtMKK3LRGvBCZ1ccnVYWPQEqQ3lf+aIjSB6twR1IbQ HS1wS3Umfe8mEKq5W3aqs72+/DHZ1zeE+oOFJ23vIO9niLp54JBxPkbLir27mTo0131h Utz29T1vR/EkioPuBCbouIVE4fc63Q5vF8F66jZhfLRbWS0tvIXZzIEbfS7FL318oJey ShDQ== X-Gm-Message-State: AOJu0YxvsEtx3j/0btN+/5R26hOt2x3iHTpytljjFbY+MNhxcb7WFq94 yM+oNhaaoMzmVRpGhF1ezR8iVZZAOyWqbs0YPX0qHA== X-Received: by 2002:a17:906:ef90:b0:9ae:673a:88b9 with SMTP id ze16-20020a170906ef9000b009ae673a88b9mr20120482ejb.22.1697113172897; Thu, 12 Oct 2023 05:19:32 -0700 (PDT) Received: from m1x-phil.lan (176-131-211-232.abo.bbox.fr. [176.131.211.232]) by smtp.gmail.com with ESMTPSA id a6-20020a170906190600b009ad89697c86sm11081226eje.144.2023.10.12.05.19.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 12 Oct 2023 05:19:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Andrey Smirnov , qemu-arm@nongnu.org, Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 5/8] hw/pci-host/designware: Keep host reference in DesignwarePCIEViewport Date: Thu, 12 Oct 2023 14:18:53 +0200 Message-ID: <20231012121857.31873-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012121857.31873-1-philmd@linaro.org> References: <20231012121857.31873-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=philmd@linaro.org; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The PCI root function is irrelevant for the ViewPort; only a reference to the host bridge is required. Since we can directly access the PCI bus, remove the pci_get_bus() call. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Gustavo Romero --- include/hw/pci-host/designware.h | 2 +- hw/pci-host/designware.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/hw/pci-host/designware.h b/include/hw/pci-host/designware.h index 9e2caa04e9..e1952ad324 100644 --- a/include/hw/pci-host/designware.h +++ b/include/hw/pci-host/designware.h @@ -32,7 +32,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(DesignwarePCIEHost, DESIGNWARE_PCIE_HOST) OBJECT_DECLARE_SIMPLE_TYPE(DesignwarePCIERoot, DESIGNWARE_PCIE_ROOT) typedef struct DesignwarePCIEViewport { - DesignwarePCIERoot *root; + DesignwarePCIEHost *host; MemoryRegion cfg; MemoryRegion mem; diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c index fb46493a05..d12a36b628 100644 --- a/hw/pci-host/designware.c +++ b/hw/pci-host/designware.c @@ -211,12 +211,11 @@ static uint64_t designware_pcie_root_data_access(void *opaque, hwaddr addr, uint64_t *val, unsigned len) { DesignwarePCIEViewport *viewport = opaque; - DesignwarePCIERoot *root = viewport->root; + PCIHostState *pci = PCI_HOST_BRIDGE(viewport->host); const uint8_t busnum = DESIGNWARE_PCIE_ATU_BUS(viewport->target); const uint8_t devfn = DESIGNWARE_PCIE_ATU_DEVFN(viewport->target); - PCIBus *pcibus = pci_get_bus(PCI_DEVICE(root)); - PCIDevice *pcidev = pci_find_device(pcibus, busnum, devfn); + PCIDevice *pcidev = pci_find_device(pci->bus, busnum, devfn); if (pcidev) { addr &= pci_config_size(pcidev) - 1; @@ -445,7 +444,7 @@ static void designware_pcie_root_realize(PCIDevice *dev, Error **errp) g_free(name); viewport = &root->viewports[DESIGNWARE_PCIE_VIEWPORT_OUTBOUND][i]; - viewport->root = root; + viewport->host = host; viewport->inbound = false; viewport->base = 0x0000000000000000ULL; viewport->target = 0x0000000000000000ULL;