From nobody Wed Nov 27 14:32:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1698672239; cv=none; d=zohomail.com; s=zohoarc; b=goRFY7j0DiG/H35BKCNQl38IL2BfycxOccFKqdbjgKA9FpabmPHh1Jo67F7MK7ZpfbdPMmLFj7lY4NrWD/Rha2V1tMlkUMxNPd4WT/3z9WdWC+m8eG9gMaXJgLldGiTwi2HZgMTvT9hDzwP0CdCYyCyQHhNwppF+R92dTgv1JaE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698672239; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=n2AEKPFDQhVIMBEHE5TQIcbVSuyI4I2t6bJBUFDoioQ=; b=GLjJjh9BU8fC8zfGFSVbvBMppl3ECGRWqtor0iBZXk5j+Zm1l0yMDn1ZbXPMqmhzVdq0fa/xlorPiBgePTrSWndBfGyyBRagZ/aLbULErHoImLRVdCc0y3aeTdYUqqPcJyT1oV7oTJ7/Q4uOclkHxCtBNWETk9t4J5+mhpRR1YA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169867223914316.905310576152715; Mon, 30 Oct 2023 06:23:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qxSDn-0007mb-F4; Mon, 30 Oct 2023 09:22: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 1qxSDl-0007jA-Mx for qemu-devel@nongnu.org; Mon, 30 Oct 2023 09:22:21 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qxSDb-0002xU-4R for qemu-devel@nongnu.org; Mon, 30 Oct 2023 09:22:21 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-5b9a7357553so447596a12.0 for ; Mon, 30 Oct 2023 06:22:10 -0700 (PDT) Received: from sunil-pc.Dlink ([106.51.188.78]) by smtp.gmail.com with ESMTPSA id 15-20020a17090a000f00b0027ced921e80sm8122412pja.38.2023.10.30.06.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 06:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1698672129; x=1699276929; 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=n2AEKPFDQhVIMBEHE5TQIcbVSuyI4I2t6bJBUFDoioQ=; b=KzqZvIIKdBBu9aFVMMlvN5a4TxZrUz3/MPIiqj66MBpWkMUWJhcE/66iIuaUYBcpb+ b1ug5h9iePXM5s3ZvMB0Du954RpyEmPWczC0BlX9tgdzjaLFtnL1jqtFK/LCcnGPauXC MDYw4gHycmYdtGEtNfZbxySRGblZvQzi0U+rVmRIyD20XJIiCnbEiml8rWqG58bKWxkL 0YLvPCuJ2N9sBX/ukKXGjoWO7HQ2GlZkJRRKyiofNaKxCV7xM8AWrz+cwRJL/BNDHpJm VTNXcTXJWF0CymbsJvzsT6ruNtBrjiFRXnrwp1P2DpC+RIAt5cIQIvB+YcR7YYXJtI2j 7kRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698672129; x=1699276929; 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=n2AEKPFDQhVIMBEHE5TQIcbVSuyI4I2t6bJBUFDoioQ=; b=PaMS82cQFFY6kN1xTHt15w0H7wENEmfVCUEYqrfXFKQWvm0Dsrdn41mW9xwhGxMYWr BZN8CBcyli8HEetOarSe/epBFwL5UPNMdXopPvWGkmN9NiPa1dC+9kzK+lzZrU80DY2Q LSHfylyDz56QQc3kU1SflwchD/0lMfX2B48YOpd3EmAo2/IqK5Lnsj6W59AsKegzqF6q ofWMa8UeJD4C/nnYiV5gm46VkX6o0o0CfsoHfOOx5UIRB3hzOpByNlqdkSVf+wdPb45V rzvXKhemHih8+GL00M3bs3h9IVVGFPppNXfQ9zfy754unfa+AZCoBEBvwAUdk7mxaTVG mVNA== X-Gm-Message-State: AOJu0YyZs3wP4wnLZB8rXX9vqbEb/7o9IQNrLHuP1ds0JW6XQBFBWr/4 DG6GBc90pP0GG0yfTkh7ggtclQ== X-Google-Smtp-Source: AGHT+IGn0sU/9Ns0hPS88EmNIgP4uCAntWhgG+zcL0OomivcN87/L5Ewz3fPnrW3dBtQ6UE6dxyozQ== X-Received: by 2002:a17:90a:d497:b0:280:18ba:f016 with SMTP id s23-20020a17090ad49700b0028018baf016mr7121388pju.47.1698672128960; Mon, 30 Oct 2023 06:22:08 -0700 (PDT) From: Sunil V L To: qemu-arm@nongnu.org, qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Peter Maydell , Shannon Zhao , "Michael S . Tsirkin" , Igor Mammedov , Ani Sinha , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Anup Patel , Atish Kumar Patra , Haibo Xu , Sunil V L Subject: [PATCH v5 10/13] hw/pci-host/gpex: Define properties for MMIO ranges Date: Mon, 30 Oct 2023 18:50:55 +0530 Message-Id: <20231030132058.763556-11-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231030132058.763556-1-sunilvl@ventanamicro.com> References: <20231030132058.763556-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=sunilvl@ventanamicro.com; helo=mail-pg1-x52d.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=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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1698672240323100001 Content-Type: text/plain; charset="utf-8" ACPI DSDT generator needs information like ECAM range, PIO range, 32-bit and 64-bit PCI MMIO range etc related to the PCI host bridge. Instead of making these values machine specific, create properties for the GPEX host bridge with default value 0. During initialization, the firmware can initialize these properties with correct values for the platform. This basically allows DSDT generator code independent of the machine specific memory map accesses. Suggested-by: Igor Mammedov Signed-off-by: Sunil V L Acked-by: Alistair Francis Reviewed-by: Daniel Henrique Barboza --- hw/pci-host/gpex-acpi.c | 13 +++++++++++++ hw/pci-host/gpex.c | 12 ++++++++++++ include/hw/pci-host/gpex.h | 28 ++++++++++++++++++++-------- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/hw/pci-host/gpex-acpi.c b/hw/pci-host/gpex-acpi.c index 1092dc3b70..f69413ea2c 100644 --- a/hw/pci-host/gpex-acpi.c +++ b/hw/pci-host/gpex-acpi.c @@ -281,3 +281,16 @@ void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig = *cfg) =20 crs_range_set_free(&crs_range_set); } + +void acpi_dsdt_add_gpex_host(Aml *scope, uint32_t irq) +{ + bool ambig; + Object *obj =3D object_resolve_path_type("", TYPE_GPEX_HOST, &ambig); + + if (!obj || ambig) { + return; + } + + GPEX_HOST(obj)->gpex_cfg.irq =3D irq; + acpi_dsdt_add_gpex(scope, &GPEX_HOST(obj)->gpex_cfg); +} diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c index a6752fac5e..41f4e73f6e 100644 --- a/hw/pci-host/gpex.c +++ b/hw/pci-host/gpex.c @@ -154,6 +154,18 @@ static Property gpex_host_properties[] =3D { */ DEFINE_PROP_BOOL("allow-unmapped-accesses", GPEXHost, allow_unmapped_accesses, true), + DEFINE_PROP_UINT64(PCI_HOST_ECAM_BASE, GPEXHost, gpex_cfg.ecam.base, 0= ), + DEFINE_PROP_SIZE(PCI_HOST_ECAM_SIZE, GPEXHost, gpex_cfg.ecam.size, 0), + DEFINE_PROP_UINT64(PCI_HOST_PIO_BASE, GPEXHost, gpex_cfg.pio.base, 0), + DEFINE_PROP_SIZE(PCI_HOST_PIO_SIZE, GPEXHost, gpex_cfg.pio.size, 0), + DEFINE_PROP_UINT64(PCI_HOST_BELOW_4G_MMIO_BASE, GPEXHost, + gpex_cfg.mmio32.base, 0), + DEFINE_PROP_SIZE(PCI_HOST_BELOW_4G_MMIO_SIZE, GPEXHost, + gpex_cfg.mmio32.size, 0), + DEFINE_PROP_UINT64(PCI_HOST_ABOVE_4G_MMIO_BASE, GPEXHost, + gpex_cfg.mmio64.base, 0), + DEFINE_PROP_SIZE(PCI_HOST_ABOVE_4G_MMIO_SIZE, GPEXHost, + gpex_cfg.mmio64.size, 0), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h index b0240bd768..441c6b8b20 100644 --- a/include/hw/pci-host/gpex.h +++ b/include/hw/pci-host/gpex.h @@ -40,6 +40,15 @@ struct GPEXRootState { /*< public >*/ }; =20 +struct GPEXConfig { + MemMapEntry ecam; + MemMapEntry mmio32; + MemMapEntry mmio64; + MemMapEntry pio; + int irq; + PCIBus *bus; +}; + struct GPEXHost { /*< private >*/ PCIExpressHost parent_obj; @@ -55,19 +64,22 @@ struct GPEXHost { int irq_num[GPEX_NUM_IRQS]; =20 bool allow_unmapped_accesses; -}; =20 -struct GPEXConfig { - MemMapEntry ecam; - MemMapEntry mmio32; - MemMapEntry mmio64; - MemMapEntry pio; - int irq; - PCIBus *bus; + struct GPEXConfig gpex_cfg; }; =20 int gpex_set_irq_num(GPEXHost *s, int index, int gsi); =20 void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg); +void acpi_dsdt_add_gpex_host(Aml *scope, uint32_t irq); + +#define PCI_HOST_PIO_BASE "pio-base" +#define PCI_HOST_PIO_SIZE "pio-size" +#define PCI_HOST_ECAM_BASE "ecam-base" +#define PCI_HOST_ECAM_SIZE "ecam-size" +#define PCI_HOST_BELOW_4G_MMIO_BASE "below-4g-mmio-base" +#define PCI_HOST_BELOW_4G_MMIO_SIZE "below-4g-mmio-size" +#define PCI_HOST_ABOVE_4G_MMIO_BASE "above-4g-mmio-base" +#define PCI_HOST_ABOVE_4G_MMIO_SIZE "above-4g-mmio-size" =20 #endif /* HW_GPEX_H */ --=20 2.39.2