From patchwork Wed Oct 11 18:59: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: 731975 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp575250wrv; Wed, 11 Oct 2023 12:01:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHqCWeP/cRleJnTeNC2iQaR8db3sWe07EeRemspXudawhEN14SM9Tg2DMc08LOuRYiBjGgO X-Received: by 2002:a05:6102:8c:b0:44d:453c:a838 with SMTP id t12-20020a056102008c00b0044d453ca838mr17695772vsp.5.1697050859125; Wed, 11 Oct 2023 12:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697050859; cv=none; d=google.com; s=arc-20160816; b=Kr/Y2SSHqoOhRjlCG3HDZUMOGxaTHlZ+9tob+1vUyQKmRawJHvd2Kc9ZNr5GOJ2yt+ jfwmkAA+OqM3NBypYIrslXkx3cDSu2PzKp367xTi9vl4Fk+jvrHe8tqG+yxd3ZcGjXKG CwOqS3m4wK3RVy9Yy5VqNvc70twtBJs2ur8ar3MiHF/ZFKCK961X8uLN6Ez5IO5cIp8q Ap+FtaTBWpSRDXqRdoRshndLjC8uBbo5lbvh8qom1oPD4MHPvD66DwrEzX/7EbL6DEIA wlxkCBmfYFz7KiXzfA1BNp9ajQId/MaPCsxnrBkhgAmUymRMz4tCVtYmPqofB5KC1TYp isgw== 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=QUM2nwqmw9SH+qUH3W/mCq9cH7GldJMBYoc4FaiK2EI=; fh=g2weSW4wmn5Q/Q+UHuFwOJzOUsIwDadO5EJQrd/nfHY=; b=guABopjKOcRW30kR7aoUetomOSkocQvPlk4SeTVpHSNzB1C7znCAz52wwO0mMoKEPS 7LzmHB0RSaVzRo7FCg94JC0IfanOqE5wlfIYkQEY9qA91BRFGCCu1v3v2lSv9gvZ07m/ 2RJxS6bg+93x83n1JRUbbcFxehlNAsU2iGtCNSzBNvHy5sP8OmG3zmATDjKenfK2sMM9 5FHslveSX6r22Wl4SEQNOT6DJrEDWoEgaO9fwf0EIOxLegIvL6GZ4mUp/NhinNSgkETx dDlTrmiBhGEUOBOSt490WoeyBfFnuOKreD3Npiaur0DylVsWgpFfY4oorIGhL71h8Ldp juow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kzt3Hue5; 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 p24-20020a67f318000000b00452e6391860si73165vsf.349.2023.10.11.12.00.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Oct 2023 12:00:59 -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=Kzt3Hue5; 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 1qqeRS-0001Lx-E3; Wed, 11 Oct 2023 15:00:23 -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 1qqeRP-0001JP-IV for qemu-devel@nongnu.org; Wed, 11 Oct 2023 15:00:19 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qqeRN-00072C-Vf for qemu-devel@nongnu.org; Wed, 11 Oct 2023 15:00:19 -0400 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-9b64b98656bso25323766b.0 for ; Wed, 11 Oct 2023 12:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697050815; x=1697655615; 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=QUM2nwqmw9SH+qUH3W/mCq9cH7GldJMBYoc4FaiK2EI=; b=Kzt3Hue5txekYjomGbQk3KWl5DpJR5rnn+/NwyOdoGIiHwUJJx+RzbPdu8L4EcGBzp TXp2CuANuU2VQ1FIU2/qOFo3q5NqvCQG0K8e2y6miaekRmBCEWqkkC4f12LLHndHbuV6 k7GfM9qk2TOOiwBSeke/HsfJqdAerzrSl5tZRMUBQzMH9Pb14xEQL3Y55Nd7nhEPdWl3 nQEPxAKbn4N6ccJLa2zBp7iCb0DVPpWUsF4zPAvkmGc0w6mNF0slxcRpnynvl2jXVeHJ UwwW5cn0X/m2K2SV5bOiiz5asfoOdS4Frl7kHZ2qkGqQjKYzu7yidf164Yj4SKKqnhMW 4ZVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697050815; x=1697655615; 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=QUM2nwqmw9SH+qUH3W/mCq9cH7GldJMBYoc4FaiK2EI=; b=klIldHvPf0nnzZAYPtwHfg+JAr39eFjY+uyHVcNs/O6RM/uw6S6rzlB8mVTdR2Sty8 Q3jmI2mAlyHqRJa4U/3Bx9aVl59Mlx8BTF2cYihe7yFyoKSmAOeUAI3G7rpMMuaXe5lt lybOZNz8O4el2Pexj6QO0GakYZhQ8j7NJXscVdI29TvrP5PPK0aSk2VRzsN4Q3pI52ga mGG+qCaJixcPal/hHs9X3VD18QoFZxjPjI2tefrIGsDRj5xHjIwA9bp6BVciwo6hejw8 w7XJalxLFK85q9TuAar9pnigRuYI9v45bf3NLoruNy6mQxYnewFdNP1dbBFC/4/IQI8n SMlA== X-Gm-Message-State: AOJu0YxL+ZUi5ymU5K+pnS7vfl3V/TCtzCiqmsTXzweMsuz76BDPet72 dO3SSU+e43I/1Ub1U0U5yWo0/iqaBz0Cdo8iGhY= X-Received: by 2002:a17:907:77c9:b0:9b2:6d09:847c with SMTP id kz9-20020a17090777c900b009b26d09847cmr17990861ejc.10.1697050814822; Wed, 11 Oct 2023 12:00:14 -0700 (PDT) Received: from m1x-phil.lan (mdq11-h01-176-173-161-48.dsl.sta.abo.bbox.fr. [176.173.161.48]) by smtp.gmail.com with ESMTPSA id dx12-20020a170906a84c00b009b977bea1dcsm10105270ejb.23.2023.10.11.12.00.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Oct 2023 12:00:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , =?utf-8?q?Herv=C3=A9_Poussine?= =?utf-8?q?au?= , Artyom Tarasenko , "Michael S. Tsirkin" , Huacai Chen , qemu-ppc@nongnu.org, Mark Cave-Ayland , Jiaxun Yang Subject: [PATCH 3/4] hw/pci-host/bonito: Access memory regions via pci_address_space[_io]() Date: Wed, 11 Oct 2023 20:59:53 +0200 Message-ID: <20231011185954.10337-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231011185954.10337-1-philmd@linaro.org> References: <20231011185954.10337-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=philmd@linaro.org; helo=mail-ej1-x629.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 PCI functions are plugged on a PCI bus. They can only access external memory regions via the bus. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bernhard Beschow --- hw/pci-host/bonito.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index ee6cb85e97..50bde57862 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -700,14 +700,14 @@ static void bonito_pci_realize(PCIDevice *dev, Error **errp) /* Map PCI IO Space 0x1fd0 0000 - 0x1fd1 0000 */ memory_region_init_alias(&s->bonito_pciio, OBJECT(s), "isa_mmio", - get_system_io(), 0, BONITO_PCIIO_SIZE); + pci_address_space_io(dev), 0, BONITO_PCIIO_SIZE); sysbus_init_mmio(sysbus, &s->bonito_pciio); sysbus_mmio_map(sysbus, 5, BONITO_PCIIO_BASE); /* add pci local io mapping */ memory_region_init_alias(&s->bonito_localio, OBJECT(s), "IOCS[0]", - get_system_io(), 0, 256 * KiB); + pci_address_space_io(dev), 0, 256 * KiB); sysbus_init_mmio(sysbus, &s->bonito_localio); sysbus_mmio_map(sysbus, 6, BONITO_DEV_BASE); create_unimplemented_device("IOCS[1]", BONITO_DEV_BASE + 1 * 256 * KiB, @@ -719,7 +719,7 @@ static void bonito_pci_realize(PCIDevice *dev, Error **errp) memory_region_init_alias(pcimem_alias, NULL, "pci.mem.alias", &bs->pci_mem, 0, BONITO_PCIHI_SIZE); - memory_region_add_subregion(get_system_memory(), + memory_region_add_subregion(pci_address_space(dev), BONITO_PCIHI_BASE, pcimem_alias); create_unimplemented_device("PCI_2", (hwaddr)BONITO_PCIHI_BASE + BONITO_PCIHI_SIZE,