From nobody Sun May 19 03:38:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1654700330; cv=none; d=zohomail.com; s=zohoarc; b=ARyOmP0vkYKWphnMCh0ANn3z5g4HpMjhfFKgMg5spfR0KUvDbWcjyvK8WeMltv4iLQnhsaKwgMYhbC02Ny3SmplZmSz2piE3A2aDmESUW61bCV8Q/yze7esJvRSgpBCdDaKrLfSUz0JAwAN0LOFjkqHF9m5W78h4a8UIObO0sOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654700330; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=7XI4BK6j+x700R6pc1KLFtd+vcBT6/mEj1nyL06qslw=; b=hxPU5vz/sV0W2pzMFslcDQYSRMhs1CkRXe+88HguG0tLtUpRViMffTaY2X72kWA7UQE1mXZBZ0SwksM5p3SvKt2ZhPD7jhdZTRPvuNju5v8TFBoif5pEJdTocpxYKji5FdpTQrParWzzgNjt3XIiEMbjpYa16NX04Cwg+1M03Yk= ARC-Authentication-Results: i=1; mx.zohomail.com; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654700330848245.97480255863059; Wed, 8 Jun 2022 07:58:50 -0700 (PDT) Received: from localhost ([::1]:33408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyx8y-0002YZ-LF for importer@patchew.org; Wed, 08 Jun 2022 10:58:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx5X-0008Hk-Bk for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:55:15 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:2611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx5Q-0006Im-5Q for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:55:15 -0400 Received: from fraeml743-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LJ9BL5KKnz67x9D; Wed, 8 Jun 2022 22:50:18 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml743-chm.china.huawei.com (10.206.15.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 16:55:04 +0200 Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 15:55:03 +0100 To: Paolo Bonzini , , "Michael S . Tsirkin" , Ben Widawsky CC: , , , Marcel Apfelbaum , Igor Mammedov , Markus Armbruster , "Mark Cave-Ayland" , Adam Manzanares , Tong Zhang , "Shameerali Kolothum Thodi" Subject: [PATCH v3 1/8] hw/cxl: Make the CXL fixed memory window setup a machine parameter. Date: Wed, 8 Jun 2022 15:54:33 +0100 Message-ID: <20220608145440.26106-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> References: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhreml703-chm.china.huawei.com (10.201.108.52) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected 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=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Jonathan Cameron From: Jonathan Cameron via X-ZM-MESSAGEID: 1654700333075100001 Content-Type: text/plain; charset="utf-8" Paolo Bonzini requested this change to simplify the ongoing effort to allow machine setup entirely via RPC. Includes shortening the command line form cxl-fixed-memory-window to cxl-fmw as the command lines are extremely long even with this change. The json change is needed to ensure that there is a CXLFixedMemoryWindowOptionsList even though the actual element in the json is never used. Similar to existing SgxEpcProperties. Update qemu-options.hx to reflect that this is now a -machine parameter. The bulk of -M / -machine parameters are documented under machine, so use that in preference to M. Update cxl-test and bios-tables-test to reflect new parameters. Signed-off-by: Jonathan Cameron Reviewed-by: Ben Widawsky Reviewed-by: Davidlohr Bueso --- docs/system/devices/cxl.rst | 4 +- hw/core/machine.c | 22 --------- hw/cxl/cxl-host-stubs.c | 6 +-- hw/cxl/cxl-host.c | 72 ++++++++++++++++++++++++++-- hw/i386/pc.c | 3 ++ hw/pci-bridge/pci_expander_bridge.c | 2 +- include/hw/boards.h | 1 + include/hw/cxl/cxl.h | 7 +-- include/hw/cxl/cxl_host.h | 21 +++++++++ qapi/machine.json | 13 +++++ qemu-options.hx | 73 ++++++++++++++--------------- softmmu/vl.c | 44 ----------------- tests/qtest/bios-tables-test.c | 4 +- tests/qtest/cxl-test.c | 4 +- 14 files changed, 150 insertions(+), 126 deletions(-) diff --git a/docs/system/devices/cxl.rst b/docs/system/devices/cxl.rst index 9293cbf01a..bcbfe8c490 100644 --- a/docs/system/devices/cxl.rst +++ b/docs/system/devices/cxl.rst @@ -251,7 +251,7 @@ A very simple setup with just one directly attached CXL= Type 3 device:: -device pxb-cxl,bus_nr=3D12,bus=3Dpcie.0,id=3Dcxl.1 \ -device cxl-rp,port=3D0,bus=3Dcxl.1,id=3Droot_port13,chassis=3D0,slot=3D= 2 \ -device cxl-type3,bus=3Droot_port13,memdev=3Dcxl-mem1,lsa=3Dcxl-lsa1,id= =3Dcxl-pmem0 \ - -cxl-fixed-memory-window targets.0=3Dcxl.1,size=3D4G + -M cxl-fmw.0.targets.0=3Dcxl.1,cxl-fmw.0.size=3D4G =20 A setup suitable for 4 way interleave. Only one fixed window provided, to = enable 2 way interleave across 2 CXL host bridges. Each host bridge has 2 CXL Root Por= ts, with @@ -277,7 +277,7 @@ the CXL Type3 device directly attached (no switches).:: -device cxl-type3,bus=3Droot_port15,memdev=3Dcxl-mem3,lsa=3Dcxl-lsa3,id= =3Dcxl-pmem2 \ -device cxl-rp,port=3D1,bus=3Dcxl.2,id=3Droot_port16,chassis=3D0,slot=3D= 6 \ -device cxl-type3,bus=3Droot_port16,memdev=3Dcxl-mem4,lsa=3Dcxl-lsa4,id= =3Dcxl-pmem3 \ - -cxl-fixed-memory-window targets.0=3Dcxl.1,targets.1=3Dcxl.2,size=3D4G,i= nterleave-granularity=3D8k + -M cxl-fmw.0.targets.0=3Dcxl.1,cxl-fmw.0.targets.1=3Dcxl.2,cxl-fmw.0.siz= e=3D4G,cxl-fmw.0.interleave-granularity=3D8k =20 Kernel Configuration Options ---------------------------- diff --git a/hw/core/machine.c b/hw/core/machine.c index c53548d0b1..2e589d99e9 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -629,20 +629,6 @@ static void machine_set_nvdimm_persistence(Object *obj= , const char *value, nvdimms_state->persistence_string =3D g_strdup(value); } =20 -static bool machine_get_cxl(Object *obj, Error **errp) -{ - MachineState *ms =3D MACHINE(obj); - - return ms->cxl_devices_state->is_enabled; -} - -static void machine_set_cxl(Object *obj, bool value, Error **errp) -{ - MachineState *ms =3D MACHINE(obj); - - ms->cxl_devices_state->is_enabled =3D value; -} - void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *= type) { QAPI_LIST_PREPEND(mc->allowed_dynamic_sysbus_devices, g_strdup(type)); @@ -929,8 +915,6 @@ static void machine_class_init(ObjectClass *oc, void *d= ata) mc->default_ram_size =3D 128 * MiB; mc->rom_file_has_mr =3D true; =20 - /* Few machines support CXL, so default to off */ - mc->cxl_supported =3D false; /* numa node memory size aligned on 8MB by default. * On Linux, each node's border has to be 8MB aligned */ @@ -1092,13 +1076,7 @@ static void machine_initfn(Object *obj) } =20 if (mc->cxl_supported) { - Object *obj =3D OBJECT(ms); - ms->cxl_devices_state =3D g_new0(CXLState, 1); - object_property_add_bool(obj, "cxl", machine_get_cxl, machine_set_= cxl); - object_property_set_description(obj, "cxl", - "Set on/off to enable/disable " - "CXL instantiation"); } =20 if (mc->cpu_index_to_instance_props && mc->get_default_cpu_node_id) { diff --git a/hw/cxl/cxl-host-stubs.c b/hw/cxl/cxl-host-stubs.c index 24465a52ab..de3e8894d5 100644 --- a/hw/cxl/cxl-host-stubs.c +++ b/hw/cxl/cxl-host-stubs.c @@ -6,11 +6,9 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/cxl/cxl.h" - -void cxl_fixed_memory_window_config(MachineState *ms, - CXLFixedMemoryWindowOptions *object, - Error **errp) {}; +#include "hw/cxl/cxl_host.h" =20 void cxl_fixed_memory_window_link_targets(Error **errp) {}; +void cxl_machine_init(Object *obj, CXLState *state) {}; =20 const MemoryRegionOps cfmws_ops; diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c index 469b3c4ced..3a79c32b42 100644 --- a/hw/cxl/cxl-host.c +++ b/hw/cxl/cxl-host.c @@ -15,14 +15,15 @@ =20 #include "qapi/qapi-visit-machine.h" #include "hw/cxl/cxl.h" +#include "hw/cxl/cxl_host.h" #include "hw/pci/pci_bus.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_host.h" #include "hw/pci/pcie_port.h" =20 -void cxl_fixed_memory_window_config(MachineState *ms, - CXLFixedMemoryWindowOptions *object, - Error **errp) +static void cxl_fixed_memory_window_config(CXLState *cxl_state, + CXLFixedMemoryWindowOptions *ob= ject, + Error **errp) { CXLFixedWindow *fw =3D g_malloc0(sizeof(*fw)); strList *target; @@ -62,8 +63,7 @@ void cxl_fixed_memory_window_config(MachineState *ms, fw->enc_int_gran =3D 0; } =20 - ms->cxl_devices_state->fixed_windows =3D - g_list_append(ms->cxl_devices_state->fixed_windows, fw); + cxl_state->fixed_windows =3D g_list_append(cxl_state->fixed_windows, f= w); =20 return; } @@ -220,3 +220,65 @@ const MemoryRegionOps cfmws_ops =3D { .unaligned =3D true, }, }; + +static void machine_get_cxl(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + CXLState *cxl_state =3D opaque; + bool value =3D cxl_state->is_enabled; + + visit_type_bool(v, name, &value, errp); +} + +static void machine_set_cxl(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + CXLState *cxl_state =3D opaque; + bool value; + + if (!visit_type_bool(v, name, &value, errp)) { + return; + } + cxl_state->is_enabled =3D value; +} + +static void machine_get_cfmw(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + CXLFixedMemoryWindowOptionsList **list =3D opaque; + + visit_type_CXLFixedMemoryWindowOptionsList(v, name, list, errp); +} + +static void machine_set_cfmw(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + CXLState *state =3D opaque; + CXLFixedMemoryWindowOptionsList *cfmw_list =3D NULL; + CXLFixedMemoryWindowOptionsList *it; + + visit_type_CXLFixedMemoryWindowOptionsList(v, name, &cfmw_list, errp); + if (!cfmw_list) { + return; + } + + for (it =3D cfmw_list; it; it =3D it->next) { + cxl_fixed_memory_window_config(state, it->value, errp); + } + state->cfmw_list =3D cfmw_list; +} + +void cxl_machine_init(Object *obj, CXLState *state) +{ + object_property_add(obj, "cxl", "bool", machine_get_cxl, + machine_set_cxl, NULL, state); + object_property_set_description(obj, "cxl", + "Set on/off to enable/disable " + "CXL instantiation"); + + object_property_add(obj, "cxl-fmw", "CXLFixedMemoryWindow", + machine_get_cfmw, machine_set_cfmw, + NULL, state); + object_property_set_description(obj, "cxl-fmw", + "CXL Fixed Memory Windows (array)"); +} diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 7c39c91335..98e63347f2 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -76,6 +76,7 @@ #include "hw/mem/pc-dimm.h" #include "hw/mem/nvdimm.h" #include "hw/cxl/cxl.h" +#include "hw/cxl/cxl_host.h" #include "qapi/error.h" #include "qapi/qapi-visit-common.h" #include "qapi/qapi-visit-machine.h" @@ -1682,6 +1683,7 @@ static void pc_machine_set_max_fw_size(Object *obj, V= isitor *v, static void pc_machine_initfn(Object *obj) { PCMachineState *pcms =3D PC_MACHINE(obj); + MachineState *ms =3D MACHINE(obj); =20 #ifdef CONFIG_VMPORT pcms->vmport =3D ON_OFF_AUTO_AUTO; @@ -1706,6 +1708,7 @@ static void pc_machine_initfn(Object *obj) pcms->pcspk =3D isa_new(TYPE_PC_SPEAKER); object_property_add_alias(OBJECT(pcms), "pcspk-audiodev", OBJECT(pcms->pcspk), "audiodev"); + cxl_machine_init(obj, ms->cxl_devices_state); } =20 static void pc_machine_reset(MachineState *machine) diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expand= er_bridge.c index 69244decdb..02032360f5 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -468,7 +468,7 @@ static void pxb_cxl_dev_realize(PCIDevice *dev, Error *= *errp) error_setg(errp, "pxb-cxl devices cannot reside on a PCI bus"); return; } - if (!ms->cxl_devices_state->is_enabled) { + if (!ms->cxl_devices_state || !ms->cxl_devices_state->is_enabled) { error_setg(errp, "Machine does not have cxl=3Don"); return; } diff --git a/include/hw/boards.h b/include/hw/boards.h index fa57bac4fb..dd9fc56df2 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -362,6 +362,7 @@ struct MachineState { struct NVDIMMState *nvdimms_state; struct CXLState *cxl_devices_state; struct NumaState *numa_state; + CXLFixedMemoryWindowOptionsList *cfmws_list; }; =20 #define DEFINE_MACHINE(namestr, machine_initfn) \ diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h index 21d28ca110..84078a484d 100644 --- a/include/hw/cxl/cxl.h +++ b/include/hw/cxl/cxl.h @@ -12,6 +12,7 @@ =20 =20 #include "qapi/qapi-types-machine.h" +#include "qapi/qapi-visit-machine.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_host.h" #include "cxl_pci.h" @@ -40,6 +41,7 @@ typedef struct CXLState { MemoryRegion host_mr; unsigned int next_mr_idx; GList *fixed_windows; + CXLFixedMemoryWindowOptionsList *cfmw_list; } CXLState; =20 struct CXLHost { @@ -51,11 +53,6 @@ struct CXLHost { #define TYPE_PXB_CXL_HOST "pxb-cxl-host" OBJECT_DECLARE_SIMPLE_TYPE(CXLHost, PXB_CXL_HOST) =20 -void cxl_fixed_memory_window_config(MachineState *ms, - CXLFixedMemoryWindowOptions *object, - Error **errp); void cxl_fixed_memory_window_link_targets(Error **errp); =20 -extern const MemoryRegionOps cfmws_ops; - #endif diff --git a/include/hw/cxl/cxl_host.h b/include/hw/cxl/cxl_host.h new file mode 100644 index 0000000000..87a6933de2 --- /dev/null +++ b/include/hw/cxl/cxl_host.h @@ -0,0 +1,21 @@ +/* + * QEMU CXL Host Setup + * + * Copyright (c) 2022 Huawei + * + * This work is licensed under the terms of the GNU GPL, version 2. See the + * COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/cxl/cxl.h" +#include "hw/boards.h" + +#ifndef CXL_HOST_H +#define CXL_HOST_H + +void cxl_machine_init(Object *obj, CXLState *state); + +extern const MemoryRegionOps cfmws_ops; + +#endif diff --git a/qapi/machine.json b/qapi/machine.json index f750a16396..6afd1936b0 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -523,6 +523,19 @@ '*interleave-granularity': 'size', 'targets': ['str'] }} =20 +## +# @CXLFMWProperties: +# +# List of CXL Fixed Memory Windows. +# +# @cxl-fmw: List of CXLFixedMemoryWindowOptions +# +# Since 7.1 +## +{ 'struct' : 'CXLFMWProperties', + 'data': { 'cxl-fmw': ['CXLFixedMemoryWindowOptions'] } +} + ## # @X86CPURegister32: # diff --git a/qemu-options.hx b/qemu-options.hx index 60cf188da4..377d22fbd8 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -36,7 +36,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " nvdimm=3Don|off controls NVDIMM support (default=3Dof= f)\n" " memory-encryption=3D@var{} memory encryption object t= o use (default=3Dnone)\n" " hmat=3Don|off controls ACPI HMAT support (default=3Do= ff)\n" - " memory-backend=3D'backend-id' specifies explicitly pr= ovided backend for main RAM (default=3Dnone)\n", + " memory-backend=3D'backend-id' specifies explicitly pr= ovided backend for main RAM (default=3Dnone)\n" + " cxl-fmw.0.targets.0=3Dfirsttarget,cxl-fmw.0.targets.1= =3Dsecondtarget,cxl-fmw.0.size=3Dsize[,cxl-fmw.0.interleave-granularity=3Dg= ranularity]\n", QEMU_ARCH_ALL) SRST ``-machine [type=3D]name[,prop=3Dvalue[,...]]`` @@ -124,6 +125,38 @@ SRST -object memory-backend-ram,id=3Dpc.ram,size=3D512M,x-use-canon= ical-path-for-ramblock-id=3Doff -machine memory-backend=3Dpc.ram -m 512M + + ``cxl-fmw.0.targets.0=3Dfirsttarget,cxl-fmw.0.targets.1=3Dsecondtarget= ,cxl-fmw.0.size=3Dsize[,cxl-fmw.0.interleave-granularity=3Dgranularity]`` + Define a CXL Fixed Memory Window (CFMW). + + Described in the CXL 2.0 ECN: CEDT CFMWS & QTG _DSM. + + They are regions of Host Physical Addresses (HPA) on a system which + may be interleaved across one or more CXL host bridges. The system + software will assign particular devices into these windows and + configure the downstream Host-managed Device Memory (HDM) decoders + in root ports, switch ports and devices appropriately to meet the + interleave requirements before enabling the memory devices. + + ``targets.X=3Dtarget`` provides the mapping to CXL host bridges + which may be identified by the id provied in the -device entry. + Multiple entries are needed to specify all the targets when + the fixed memory window represents interleaved memory. X is the + target index from 0. + + ``size=3Dsize`` sets the size of the CFMW. This must be a multiple= of + 256MiB. The region will be aligned to 256MiB but the location is + platform and configuration dependent. + + ``interleave-granularity=3Dgranularity`` sets the granularity of + interleave. Default 256KiB. Only 256KiB, 512KiB, 1024KiB, 2048KiB + 4096KiB, 8192KiB and 16384KiB granularities supported. + + Example: + + :: + + -machine cxl-fmw.0.targets.0=3Dcxl.0,cxl-fmw.0.targets.1=3Dcxl= .1,cxl-fmw.0.size=3D128G,cxl-fmw.0.interleave-granularity=3D512k ERST =20 DEF("M", HAS_ARG, QEMU_OPTION_M, @@ -467,44 +500,6 @@ SRST -numa hmat-cache,node-id=3D1,size=3D10K,level=3D1,associativity=3D= direct,policy=3Dwrite-back,line=3D8 ERST =20 -DEF("cxl-fixed-memory-window", HAS_ARG, QEMU_OPTION_cxl_fixed_memory_windo= w, - "-cxl-fixed-memory-window targets.0=3Dfirsttarget,targets.1=3Dsecondta= rget,size=3Dsize[,interleave-granularity=3Dgranularity]\n", - QEMU_ARCH_ALL) -SRST -``-cxl-fixed-memory-window targets.0=3Dfirsttarget,targets.1=3Dsecondtarge= t,size=3Dsize[,interleave-granularity=3Dgranularity]`` - Define a CXL Fixed Memory Window (CFMW). - - Described in the CXL 2.0 ECN: CEDT CFMWS & QTG _DSM. - - They are regions of Host Physical Addresses (HPA) on a system which - may be interleaved across one or more CXL host bridges. The system - software will assign particular devices into these windows and - configure the downstream Host-managed Device Memory (HDM) decoders - in root ports, switch ports and devices appropriately to meet the - interleave requirements before enabling the memory devices. - - ``targets.X=3Dfirsttarget`` provides the mapping to CXL host bridges - which may be identified by the id provied in the -device entry. - Multiple entries are needed to specify all the targets when - the fixed memory window represents interleaved memory. X is the - target index from 0. - - ``size=3Dsize`` sets the size of the CFMW. This must be a multiple of - 256MiB. The region will be aligned to 256MiB but the location is - platform and configuration dependent. - - ``interleave-granularity=3Dgranularity`` sets the granularity of - interleave. Default 256KiB. Only 256KiB, 512KiB, 1024KiB, 2048KiB - 4096KiB, 8192KiB and 16384KiB granularities supported. - - Example: - - :: - - -cxl-fixed-memory-window targets.0=3Dcxl.0,targets.1=3Dcxl.1,size= =3D128G,interleave-granularity=3D512k - -ERST - DEF("add-fd", HAS_ARG, QEMU_OPTION_add_fd, "-add-fd fd=3Dfd,set=3Dset[,opaque=3Dopaque]\n" " Add 'fd' to fd 'set'\n", QEMU_ARCH_ALL) diff --git a/softmmu/vl.c b/softmmu/vl.c index 4c1e94b00e..ff0ad9ab54 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -147,12 +147,6 @@ typedef struct BlockdevOptionsQueueEntry { =20 typedef QSIMPLEQ_HEAD(, BlockdevOptionsQueueEntry) BlockdevOptionsQueue; =20 -typedef struct CXLFMWOptionQueueEntry { - CXLFixedMemoryWindowOptions *opts; - Location loc; - QSIMPLEQ_ENTRY(CXLFMWOptionQueueEntry) entry; -} CXLFMWOptionQueueEntry; - typedef struct ObjectOption { ObjectOptions *opts; QTAILQ_ENTRY(ObjectOption) next; @@ -179,8 +173,6 @@ static int snapshot; static bool preconfig_requested; static QemuPluginList plugin_list =3D QTAILQ_HEAD_INITIALIZER(plugin_list); static BlockdevOptionsQueue bdo_queue =3D QSIMPLEQ_HEAD_INITIALIZER(bdo_qu= eue); -static QSIMPLEQ_HEAD(, CXLFMWOptionQueueEntry) CXLFMW_opts =3D - QSIMPLEQ_HEAD_INITIALIZER(CXLFMW_opts); static bool nographic =3D false; static int mem_prealloc; /* force preallocation of physical target memory = */ static const char *vga_model =3D NULL; @@ -1072,24 +1064,6 @@ static void parse_display(const char *p) } } =20 -static void parse_cxl_fixed_memory_window(const char *optarg) -{ - CXLFMWOptionQueueEntry *cfmws_entry; - Visitor *v; - - v =3D qobject_input_visitor_new_str(optarg, "cxl-fixed-memory-window", - &error_fatal); - cfmws_entry =3D g_new(CXLFMWOptionQueueEntry, 1); - visit_type_CXLFixedMemoryWindowOptions(v, NULL, &cfmws_entry->opts, - &error_fatal); - if (!cfmws_entry->opts) { - exit(1); - } - visit_free(v); - loc_save(&cfmws_entry->loc); - QSIMPLEQ_INSERT_TAIL(&CXLFMW_opts, cfmws_entry, entry); -} - static inline bool nonempty_str(const char *str) { return str && *str; @@ -1948,20 +1922,6 @@ static void qemu_create_late_backends(void) qemu_semihosting_console_init(); } =20 -static void cxl_set_opts(void) -{ - while (!QSIMPLEQ_EMPTY(&CXLFMW_opts)) { - CXLFMWOptionQueueEntry *cfmws_entry =3D QSIMPLEQ_FIRST(&CXLFMW_opt= s); - - loc_restore(&cfmws_entry->loc); - QSIMPLEQ_REMOVE_HEAD(&CXLFMW_opts, entry); - cxl_fixed_memory_window_config(current_machine, cfmws_entry->opts, - &error_fatal); - qapi_free_CXLFixedMemoryWindowOptions(cfmws_entry->opts); - g_free(cfmws_entry); - } -} - static void qemu_resolve_machine_memdev(void) { if (ram_memdev_id) { @@ -2789,9 +2749,6 @@ void qemu_init(int argc, char **argv, char **envp) exit(1); } break; - case QEMU_OPTION_cxl_fixed_memory_window: - parse_cxl_fixed_memory_window(optarg); - break; case QEMU_OPTION_display: parse_display(optarg); break; @@ -3598,7 +3555,6 @@ void qemu_init(int argc, char **argv, char **envp) =20 qemu_resolve_machine_memdev(); parse_numa_opts(current_machine); - cxl_set_opts(); =20 if (vmstate_dump_file) { /* dump and exit */ diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index a4a46e97f0..8a3a320aea 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1567,8 +1567,8 @@ static void test_acpi_q35_cxl(void) " -device cxl-type3,bus=3Drp3,memdev=3Dcxl-me= m3,lsa=3Dlsa3" " -device cxl-rp,port=3D1,bus=3Dcxl.2,id=3Drp= 4,chassis=3D0,slot=3D6" " -device cxl-type3,bus=3Drp4,memdev=3Dcxl-me= m4,lsa=3Dlsa4" - " -cxl-fixed-memory-window targets.0=3Dcxl.1,= size=3D4G,interleave-granularity=3D8k" - " -cxl-fixed-memory-window targets.0=3Dcxl.1,= targets.1=3Dcxl.2,size=3D4G,interleave-granularity=3D8k", + " -M cxl-fmw.0.targets.0=3Dcxl.1,cxl-fmw.0.si= ze=3D4G,cxl-fmw.0.interleave-granularity=3D8k," + "cxl-fmw.1.targets.0=3Dcxl.1,cxl-fmw.1.target= s.1=3Dcxl.2,cxl-fmw.1.size=3D4G,cxl-fmw.1.interleave-granularity=3D8k", tmp_path, tmp_path, tmp_path, tmp_path, tmp_path, tmp_path, tmp_path, tmp_path); test_acpi_one(params, &data); diff --git a/tests/qtest/cxl-test.c b/tests/qtest/cxl-test.c index 079011af6a..2133e973f4 100644 --- a/tests/qtest/cxl-test.c +++ b/tests/qtest/cxl-test.c @@ -10,12 +10,12 @@ =20 #define QEMU_PXB_CMD "-machine q35,cxl=3Don " \ "-device pxb-cxl,id=3Dcxl.0,bus=3Dpcie.0,bus_nr=3D52 = " \ - "-cxl-fixed-memory-window targets.0=3Dcxl.0,size=3D4G= " + "-M cxl-fmw.0.targets.0=3Dcxl.0,cxl-fmw.0.size=3D4G " =20 #define QEMU_2PXB_CMD "-machine q35,cxl=3Don " \ "-device pxb-cxl,id=3Dcxl.0,bus=3Dpcie.0,bus_nr=3D52= " \ "-device pxb-cxl,id=3Dcxl.1,bus=3Dpcie.0,bus_nr=3D53= " \ - "-cxl-fixed-memory-window targets.0=3Dcxl.0,targets.= 1=3Dcxl.1,size=3D4G " + "-M cxl-fmw.0.targets.0=3Dcxl.0,cxl-fmw.0.targets.1= =3Dcxl.1,cxl-fmw.0.size=3D4G " =20 #define QEMU_RP "-device cxl-rp,id=3Drp0,bus=3Dcxl.0,chassis=3D0,slot=3D0 " =20 --=20 2.32.0 From nobody Sun May 19 03:38:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1654700644; cv=none; d=zohomail.com; s=zohoarc; b=YEq7ZysAvI1fxb5SJWYMO5x7jI4zkJja48Ds25/KGk8KEQ5tKS8A7L8EvGe7RE+xyhijqIrnTFqjyCy/gFLE3xHOIoT1FkU3bPdryZTntK7wnkLVFJH0ypZQlErGCCWzVhCbmkYj2xzDJOlXNDc8t2W2nrBYlH+n77w0xYm0Sf8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654700644; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Eef3KArGZJ11WLz36I7JeX5b5DDEMYndu3t1hI1D6C0=; b=MgBTXYz5y2EOZNK73dqlWML386mZFRj7PUa4XY/dmyeKyrzj5JGHl+eS9Espt4kzGPresYWTnXe5FzT1+DzYmV684Tha7oe5odiPExQqpAn5oDKZzzgvihQ0vX34mKZKnzjuwcG2DAljhGBcdrIcsEwZzP8qG/IZhnvxTIeotO4= ARC-Authentication-Results: i=1; mx.zohomail.com; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654700644659546.9799417655073; Wed, 8 Jun 2022 08:04:04 -0700 (PDT) Received: from localhost ([::1]:46172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyxE3-0002Q9-2F for importer@patchew.org; Wed, 08 Jun 2022 11:04:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx5u-0000c6-GW for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:55:38 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:2612) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx5s-0006S0-LJ for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:55:38 -0400 Received: from fraeml742-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LJ9Bx1M9Hz67Zn3; Wed, 8 Jun 2022 22:50:49 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml742-chm.china.huawei.com (10.206.15.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 16:55:34 +0200 Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 15:55:34 +0100 To: Paolo Bonzini , , "Michael S . Tsirkin" , Ben Widawsky CC: , , , Marcel Apfelbaum , Igor Mammedov , Markus Armbruster , "Mark Cave-Ayland" , Adam Manzanares , Tong Zhang , "Shameerali Kolothum Thodi" Subject: [PATCH v3 2/8] hw/acpi/cxl: Pass in the CXLState directly rather than MachineState Date: Wed, 8 Jun 2022 15:54:34 +0100 Message-ID: <20220608145440.26106-3-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> References: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhreml703-chm.china.huawei.com (10.201.108.52) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected 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=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Jonathan Cameron From: Jonathan Cameron via X-ZM-MESSAGEID: 1654700646169100002 Content-Type: text/plain; charset="utf-8" Refactoring step on path to moving all CXL state out of MachineState. Signed-off-by: Jonathan Cameron Reviewed-by: Ben Widawsky --- hw/acpi/cxl.c | 9 ++++----- hw/i386/acpi-build.c | 4 ++-- include/hw/acpi/cxl.h | 5 +++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/acpi/cxl.c b/hw/acpi/cxl.c index 31d5235136..2bf8c07993 100644 --- a/hw/acpi/cxl.c +++ b/hw/acpi/cxl.c @@ -65,9 +65,8 @@ static void cedt_build_chbs(GArray *table_data, PXBDev *c= xl) * Interleave ways encoding in CXL 2.0 ECN: 3, 6, 12 and 16-way memory * interleaving. */ -static void cedt_build_cfmws(GArray *table_data, MachineState *ms) +static void cedt_build_cfmws(GArray *table_data, CXLState *cxls) { - CXLState *cxls =3D ms->cxl_devices_state; GList *it; =20 for (it =3D cxls->fixed_windows; it; it =3D it->next) { @@ -129,9 +128,9 @@ static int cxl_foreach_pxb_hb(Object *obj, void *opaque) return 0; } =20 -void cxl_build_cedt(MachineState *ms, GArray *table_offsets, GArray *table= _data, +void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, - const char *oem_table_id) + const char *oem_table_id, CXLState *cxl_state) { Aml *cedt; AcpiTable table =3D { .sig =3D "CEDT", .rev =3D 1, .oem_id =3D oem_id, @@ -144,7 +143,7 @@ void cxl_build_cedt(MachineState *ms, GArray *table_off= sets, GArray *table_data, /* reserve space for CEDT header */ =20 object_child_foreach_recursive(object_get_root(), cxl_foreach_pxb_hb, = cedt); - cedt_build_cfmws(cedt->buf, ms); + cedt_build_cfmws(cedt->buf, cxl_state); =20 /* copy AML table into ACPI tables blob and patch header there */ g_array_append_vals(table_data, cedt->buf->data, cedt->buf->len); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index c125939ed6..2e3b1dd9a2 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2712,8 +2712,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) x86ms->oem_id, x86ms->oem_table_id); } if (machine->cxl_devices_state->is_enabled) { - cxl_build_cedt(machine, table_offsets, tables_blob, tables->linker, - x86ms->oem_id, x86ms->oem_table_id); + cxl_build_cedt(table_offsets, tables_blob, tables->linker, + x86ms->oem_id, x86ms->oem_table_id, machine->cxl_de= vices_state); } =20 acpi_add_table(table_offsets, tables_blob); diff --git a/include/hw/acpi/cxl.h b/include/hw/acpi/cxl.h index 0c496538c0..acf4418886 100644 --- a/include/hw/acpi/cxl.h +++ b/include/hw/acpi/cxl.h @@ -19,10 +19,11 @@ #define HW_ACPI_CXL_H =20 #include "hw/acpi/bios-linker-loader.h" +#include "hw/cxl/cxl.h" =20 -void cxl_build_cedt(MachineState *ms, GArray *table_offsets, GArray *table= _data, +void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, - const char *oem_table_id); + const char *oem_table_id, CXLState *cxl_state); void build_cxl_osc_method(Aml *dev); =20 #endif --=20 2.32.0 From nobody Sun May 19 03:38:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1654700805; cv=none; d=zohomail.com; s=zohoarc; b=i+Lm8LdXduSheQ9HcQj3IHhPUxwwXKHB+vB6nPwKXyLejMbcwwEHUv2rMh1wPqk4giYAxAPkoJM/jVhUxLt4PggNk7RTpM/FHDMwac+owq20RE80fKu5ZYsBeG14RJa0qssFMBcZGZNK/jjiXEZZGpUgt+QRgSr989lkbzlaZhc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654700805; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=RVsnj36Fe1Cym0NS4s0DvUU3/dTrdceMlfi+cHHRTUE=; b=HRebziIqj2CeNgT3tI83ymoxznimhIXNCq4o5H0XKO92JFKxr+YMkBfhmMvE99IPuYvxfAgrrYg1zuwCGW0pzeNsR6zduIIiFrq99gjWX6BEpiZ3Ru14Wbca2XgY7WieIf5nK2fRnnbGu40P84sd6yIH0FXuMWayouzhQ24EgfA= ARC-Authentication-Results: i=1; mx.zohomail.com; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654700805640102.13576197070404; Wed, 8 Jun 2022 08:06:45 -0700 (PDT) Received: from localhost ([::1]:51704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyxGd-0006O7-RA for importer@patchew.org; Wed, 08 Jun 2022 11:06:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx6f-0001kg-PQ for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:56:25 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:2613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx6R-0006Vk-9U for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:56:25 -0400 Received: from fraeml741-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LJ9HZ6MLTz67yKs; Wed, 8 Jun 2022 22:54:50 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml741-chm.china.huawei.com (10.206.15.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 16:56:05 +0200 Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 15:56:05 +0100 To: Paolo Bonzini , , "Michael S . Tsirkin" , Ben Widawsky CC: , , , Marcel Apfelbaum , Igor Mammedov , Markus Armbruster , "Mark Cave-Ayland" , Adam Manzanares , Tong Zhang , "Shameerali Kolothum Thodi" Subject: [PATCH v3 3/8] hw/cxl: Push linking of CXL targets into i386/pc rather than in machine.c Date: Wed, 8 Jun 2022 15:54:35 +0100 Message-ID: <20220608145440.26106-4-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> References: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhreml703-chm.china.huawei.com (10.201.108.52) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected 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=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Jonathan Cameron From: Jonathan Cameron via X-ZM-MESSAGEID: 1654700808162100001 Content-Type: text/plain; charset="utf-8" Whilst here take the oportunity to shorten the function name. Signed-off-by: Jonathan Cameron Reviewed-by: Ben Widawsky --- hw/cxl/cxl-host-stubs.c | 2 +- hw/cxl/cxl-host.c | 8 +++----- hw/i386/pc.c | 5 +++++ include/hw/cxl/cxl.h | 2 -- include/hw/cxl/cxl_host.h | 1 + softmmu/vl.c | 2 -- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/cxl/cxl-host-stubs.c b/hw/cxl/cxl-host-stubs.c index de3e8894d5..e0d5ec8ad5 100644 --- a/hw/cxl/cxl-host-stubs.c +++ b/hw/cxl/cxl-host-stubs.c @@ -8,7 +8,7 @@ #include "hw/cxl/cxl.h" #include "hw/cxl/cxl_host.h" =20 -void cxl_fixed_memory_window_link_targets(Error **errp) {}; +void cxl_fmws_link_targets(CXLState *stat, Error **errp) {}; void cxl_machine_init(Object *obj, CXLState *state) {}; =20 const MemoryRegionOps cfmws_ops; diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c index 3a79c32b42..8e7738a65b 100644 --- a/hw/cxl/cxl-host.c +++ b/hw/cxl/cxl-host.c @@ -68,14 +68,12 @@ static void cxl_fixed_memory_window_config(CXLState *cx= l_state, return; } =20 -void cxl_fixed_memory_window_link_targets(Error **errp) +void cxl_fmws_link_targets(CXLState *cxl_state, Error **errp) { - MachineState *ms =3D MACHINE(qdev_get_machine()); - - if (ms->cxl_devices_state && ms->cxl_devices_state->fixed_windows) { + if (cxl_state && cxl_state->fixed_windows) { GList *it; =20 - for (it =3D ms->cxl_devices_state->fixed_windows; it; it =3D it->n= ext) { + for (it =3D cxl_state->fixed_windows; it; it =3D it->next) { CXLFixedWindow *fw =3D it->data; int i; =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 98e63347f2..6cecd74d58 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -732,6 +732,11 @@ void pc_machine_done(Notifier *notifier, void *data) PCMachineState *pcms =3D container_of(notifier, PCMachineState, machine_done); X86MachineState *x86ms =3D X86_MACHINE(pcms); + MachineState *ms =3D MACHINE(pcms); + + if (ms->cxl_devices_state) { + cxl_fmws_link_targets(ms->cxl_devices_state, &error_fatal); + } =20 /* set the number of CPUs */ x86_rtc_set_cpus_count(x86ms->rtc, x86ms->boot_cpus); diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h index 84078a484d..134b295b40 100644 --- a/include/hw/cxl/cxl.h +++ b/include/hw/cxl/cxl.h @@ -53,6 +53,4 @@ struct CXLHost { #define TYPE_PXB_CXL_HOST "pxb-cxl-host" OBJECT_DECLARE_SIMPLE_TYPE(CXLHost, PXB_CXL_HOST) =20 -void cxl_fixed_memory_window_link_targets(Error **errp); - #endif diff --git a/include/hw/cxl/cxl_host.h b/include/hw/cxl/cxl_host.h index 87a6933de2..4d642a81fa 100644 --- a/include/hw/cxl/cxl_host.h +++ b/include/hw/cxl/cxl_host.h @@ -15,6 +15,7 @@ #define CXL_HOST_H =20 void cxl_machine_init(Object *obj, CXLState *state); +void cxl_fmws_link_targets(CXLState *stat, Error **errp); =20 extern const MemoryRegionOps cfmws_ops; =20 diff --git a/softmmu/vl.c b/softmmu/vl.c index ff0ad9ab54..54e920ada1 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -93,7 +93,6 @@ #include "qemu/config-file.h" #include "qemu/qemu-options.h" #include "qemu/main-loop.h" -#include "hw/cxl/cxl.h" #ifdef CONFIG_VIRTFS #include "fsdev/qemu-fsdev.h" #endif @@ -2568,7 +2567,6 @@ void qmp_x_exit_preconfig(Error **errp) =20 qemu_init_board(); qemu_create_cli_devices(); - cxl_fixed_memory_window_link_targets(errp); qemu_machine_creation_done(); =20 if (loadvm) { --=20 2.32.0 From nobody Sun May 19 03:38:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1654700716; cv=none; d=zohomail.com; s=zohoarc; b=SluG9fgjeZpD5TQB9s53s4/Le7pkgy3eyD1fgEOnnEhSvCsLSqQUK94U7kKXMhrFmMo+3TR4WI868Hfytpl8KbXugRSyFps1sLjgu+7WqQ12Cu36DxXZFznX7dUZhjyO6CGKRe7NYeOt/A1Iwl3eKcHVDQrm6eyNC7mccgxjUf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654700716; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=4sWdeZDTeI8WnPz0g9f8FNmPbj5ELmpFpCnHrvBU8GM=; b=hwSV1d4jvsBYmooDZjtHrykTn1mmL/AMX44d19bfvKEQhdWDs+LX59mLpzAansrf3WhMEoAkp6enxwK4XXDML+cpiS+7QMo0xZgOSDeZ1Pg9QovKI4FikFxATivK9xDsYXxDuU8mGUOYHG7a2TZo6hqT4TEYTF3sRUrNmQ0Po6g= ARC-Authentication-Results: i=1; mx.zohomail.com; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165470071654798.50802491970944; Wed, 8 Jun 2022 08:05:16 -0700 (PDT) Received: from localhost ([::1]:48798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyxFC-0004Iw-U4 for importer@patchew.org; Wed, 08 Jun 2022 11:05:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx6t-00026E-DE for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:56:39 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:2614) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx6r-0006dh-Tk for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:56:39 -0400 Received: from fraeml739-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LJ9J91vdlz67xS9; Wed, 8 Jun 2022 22:55:21 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml739-chm.china.huawei.com (10.206.15.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 16:56:36 +0200 Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 15:56:35 +0100 To: Paolo Bonzini , , "Michael S . Tsirkin" , Ben Widawsky CC: , , , Marcel Apfelbaum , Igor Mammedov , Markus Armbruster , "Mark Cave-Ayland" , Adam Manzanares , Tong Zhang , "Shameerali Kolothum Thodi" Subject: [PATCH v3 4/8] tests/acpi: Allow modification of q35 CXL CEDT table. Date: Wed, 8 Jun 2022 15:54:36 +0100 Message-ID: <20220608145440.26106-5-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> References: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhreml703-chm.china.huawei.com (10.201.108.52) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected 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=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Jonathan Cameron From: Jonathan Cameron via X-ZM-MESSAGEID: 1654700717191100001 Content-Type: text/plain; charset="utf-8" Needed to allow memory address changes as a result of next patch. Signed-off-by: Jonathan Cameron Reviewed-by: Ben Widawsky --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..effa58b75b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,2 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/CEDT.cxl", --=20 2.32.0 From nobody Sun May 19 03:38:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1654700878; cv=none; d=zohomail.com; s=zohoarc; b=URli7QtIgVf0cF+cptEl6t7OPEBDyqmH8tKhQpwELj5IYmZ/oEK1+3UcnAIiglTfoLh0IOL0eRbuhxvsi64WVz/2CqVx8i6vkqbCpLRRxiSFxkuodhmCGGlutxUhSJUg4MSA20t9KJth4kpIq39PjaqD2LqRHHxdqPwbgdtsIWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654700878; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=YJ+MMVze3ZLS+AkpYAeagIW9i0miuw7dHgqv5XYccNw=; b=khpT+6Qhz2RwofyuuMrgrcYYvQwl/L4tYDFa3HOPlTj0jsqi9ado4bOIXB+L55GcQOvDl3n+ofgS0BJ9QuBI41SKr7bbx7B38vQ6jYJYr879QCtT/TDQ3vQr7tgJlaMHHC6jwUvHAia4xoc14IH/Kk3eF+qbfBbZeqqHCGcOb6w= ARC-Authentication-Results: i=1; mx.zohomail.com; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654700878809383.324845707849; Wed, 8 Jun 2022 08:07:58 -0700 (PDT) Received: from localhost ([::1]:53304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyxHp-0007Uy-6r for importer@patchew.org; Wed, 08 Jun 2022 11:07:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx7Q-0002KM-99 for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:57:12 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:2615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx7O-0006kR-2Z for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:57:12 -0400 Received: from fraeml738-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LJ9Dj5lsYz685ZZ; Wed, 8 Jun 2022 22:52:21 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml738-chm.china.huawei.com (10.206.15.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 16:57:07 +0200 Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 15:57:06 +0100 To: Paolo Bonzini , , "Michael S . Tsirkin" , Ben Widawsky CC: , , , Marcel Apfelbaum , Igor Mammedov , Markus Armbruster , "Mark Cave-Ayland" , Adam Manzanares , Tong Zhang , "Shameerali Kolothum Thodi" Subject: [PATCH v3 5/8] pci/pci_expander_bridge: For CXL HB delay the HB register memory region setup. Date: Wed, 8 Jun 2022 15:54:37 +0100 Message-ID: <20220608145440.26106-6-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> References: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhreml703-chm.china.huawei.com (10.201.108.52) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected 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=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Jonathan Cameron From: Jonathan Cameron via X-ZM-MESSAGEID: 1654700880048100001 Content-Type: text/plain; charset="utf-8" As the CXLState will no long be accessible via MachineState at time of PXB_CXL realization, come back later from the machine specific code to fill in the missing memory region setup. Only at this stage is it possible to check if cxl=3Don, so that check is moved to this later point. Note that for multiple host bridges, the allocation order of the register spaces is changed. This will be reflected in ACPI CEDT. Stubs are added to handle case of CONFIG_PXB=3Dn for machines that call these functions. The bus walking logic is common to all machines so add a utility function + stub to cxl-host*. Signed-off-by: Jonathan Cameron Reviewed-by: Ben Widawsky --- hw/cxl/cxl-host-stubs.c | 1 + hw/cxl/cxl-host.c | 20 +++++++++++++ hw/i386/pc.c | 3 ++ hw/pci-bridge/meson.build | 5 +++- hw/pci-bridge/pci_expander_bridge.c | 32 +++++++++++++-------- hw/pci-bridge/pci_expander_bridge_stubs.c | 14 +++++++++ include/hw/cxl/cxl_host.h | 1 + include/hw/pci-bridge/pci_expander_bridge.h | 12 ++++++++ 8 files changed, 75 insertions(+), 13 deletions(-) diff --git a/hw/cxl/cxl-host-stubs.c b/hw/cxl/cxl-host-stubs.c index e0d5ec8ad5..cae4afcdde 100644 --- a/hw/cxl/cxl-host-stubs.c +++ b/hw/cxl/cxl-host-stubs.c @@ -10,5 +10,6 @@ =20 void cxl_fmws_link_targets(CXLState *stat, Error **errp) {}; void cxl_machine_init(Object *obj, CXLState *state) {}; +void cxl_hook_up_pxb_registers(PCIBus *bus, CXLState *state, Error **errp)= {}; =20 const MemoryRegionOps cfmws_ops; diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c index 8e7738a65b..efa14908d8 100644 --- a/hw/cxl/cxl-host.c +++ b/hw/cxl/cxl-host.c @@ -20,6 +20,7 @@ #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_host.h" #include "hw/pci/pcie_port.h" +#include "hw/pci-bridge/pci_expander_bridge.h" =20 static void cxl_fixed_memory_window_config(CXLState *cxl_state, CXLFixedMemoryWindowOptions *ob= ject, @@ -280,3 +281,22 @@ void cxl_machine_init(Object *obj, CXLState *state) object_property_set_description(obj, "cxl-fmw", "CXL Fixed Memory Windows (array)"); } + +void cxl_hook_up_pxb_registers(PCIBus *bus, CXLState *state, Error **errp) +{ + /* Walk the pci busses looking for pxb busses to hook up */ + if (bus) { + QLIST_FOREACH(bus, &bus->child, sibling) { + if (!pci_bus_is_root(bus)) { + continue; + } + if (pci_bus_is_cxl(bus)) { + if (!state->is_enabled) { + error_setg(errp, "CXL host bridges present, but cxl=3D= off"); + return; + } + pxb_cxl_hook_up_registers(state, bus, errp); + } + } + } +} diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 6cecd74d58..9f48d02739 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -37,6 +37,7 @@ #include "hw/ide.h" #include "hw/pci/pci.h" #include "hw/pci/pci_bus.h" +#include "hw/pci-bridge/pci_expander_bridge.h" #include "hw/nvram/fw_cfg.h" #include "hw/timer/hpet.h" #include "hw/firmware/smbios.h" @@ -735,6 +736,8 @@ void pc_machine_done(Notifier *notifier, void *data) MachineState *ms =3D MACHINE(pcms); =20 if (ms->cxl_devices_state) { + cxl_hook_up_pxb_registers(pcms->bus, ms->cxl_devices_state, + &error_fatal); cxl_fmws_link_targets(ms->cxl_devices_state, &error_fatal); } =20 diff --git a/hw/pci-bridge/meson.build b/hw/pci-bridge/meson.build index b6d26a03d5..fdbe2e07c5 100644 --- a/hw/pci-bridge/meson.build +++ b/hw/pci-bridge/meson.build @@ -3,7 +3,8 @@ pci_ss.add(files('pci_bridge_dev.c')) pci_ss.add(when: 'CONFIG_I82801B11', if_true: files('i82801b11.c')) pci_ss.add(when: 'CONFIG_IOH3420', if_true: files('ioh3420.c')) pci_ss.add(when: 'CONFIG_PCIE_PORT', if_true: files('pcie_root_port.c', 'g= en_pcie_root_port.c', 'pcie_pci_bridge.c')) -pci_ss.add(when: 'CONFIG_PXB', if_true: files('pci_expander_bridge.c')) +pci_ss.add(when: 'CONFIG_PXB', if_true: files('pci_expander_bridge.c'), + if_false: files('pci_expander_bridge_stubs.= c')) pci_ss.add(when: 'CONFIG_XIO3130', if_true: files('xio3130_upstream.c', 'x= io3130_downstream.c')) pci_ss.add(when: 'CONFIG_CXL', if_true: files('cxl_root_port.c')) =20 @@ -13,3 +14,5 @@ pci_ss.add(when: 'CONFIG_DEC_PCI', if_true: files('dec.c'= )) pci_ss.add(when: 'CONFIG_SIMBA', if_true: files('simba.c')) =20 softmmu_ss.add_all(when: 'CONFIG_PCI', if_true: pci_ss) + +softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('pci_expander_bridge_stu= bs.c')) diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expand= er_bridge.c index 02032360f5..c9e817aa58 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -17,6 +17,7 @@ #include "hw/pci/pci_host.h" #include "hw/qdev-properties.h" #include "hw/pci/pci_bridge.h" +#include "hw/pci-bridge/pci_expander_bridge.h" #include "hw/cxl/cxl.h" #include "qemu/range.h" #include "qemu/error-report.h" @@ -186,25 +187,38 @@ static const TypeInfo pxb_host_info =3D { =20 static void pxb_cxl_realize(DeviceState *dev, Error **errp) { - MachineState *ms =3D MACHINE(qdev_get_machine()); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); CXLHost *cxl =3D PXB_CXL_HOST(dev); CXLComponentState *cxl_cstate =3D &cxl->cxl_cstate; struct MemoryRegion *mr =3D &cxl_cstate->crb.component_registers; - hwaddr offset; =20 cxl_component_register_block_init(OBJECT(dev), cxl_cstate, TYPE_PXB_CXL_HOST); sysbus_init_mmio(sbd, mr); +} + +/* + * Host bridge realization has no means of knowning state associated + * with a particular machine. As such, it is nececssary to delay + * final setup of the host bridge register space until later in the + * machine bring up. + */ +void pxb_cxl_hook_up_registers(CXLState *cxl_state, PCIBus *bus, Error **e= rrp) +{ + PXBDev *pxb =3D PXB_CXL_DEV(pci_bridge_get_device(bus)); + CXLHost *cxl =3D pxb->cxl.cxl_host_bridge; + CXLComponentState *cxl_cstate =3D &cxl->cxl_cstate; + struct MemoryRegion *mr =3D &cxl_cstate->crb.component_registers; + hwaddr offset; =20 - offset =3D memory_region_size(mr) * ms->cxl_devices_state->next_mr_idx; - if (offset > memory_region_size(&ms->cxl_devices_state->host_mr)) { + offset =3D memory_region_size(mr) * cxl_state->next_mr_idx; + if (offset > memory_region_size(&cxl_state->host_mr)) { error_setg(errp, "Insufficient space for pxb cxl host register spa= ce"); return; } =20 - memory_region_add_subregion(&ms->cxl_devices_state->host_mr, offset, m= r); - ms->cxl_devices_state->next_mr_idx++; + memory_region_add_subregion(&cxl_state->host_mr, offset, mr); + cxl_state->next_mr_idx++; } =20 static void pxb_cxl_host_class_init(ObjectClass *class, void *data) @@ -461,17 +475,11 @@ static const TypeInfo pxb_pcie_dev_info =3D { =20 static void pxb_cxl_dev_realize(PCIDevice *dev, Error **errp) { - MachineState *ms =3D MACHINE(qdev_get_machine()); - /* A CXL PXB's parent bus is still PCIe */ if (!pci_bus_is_express(pci_get_bus(dev))) { error_setg(errp, "pxb-cxl devices cannot reside on a PCI bus"); return; } - if (!ms->cxl_devices_state || !ms->cxl_devices_state->is_enabled) { - error_setg(errp, "Machine does not have cxl=3Don"); - return; - } =20 pxb_dev_realize_common(dev, CXL, errp); pxb_dev_reset(DEVICE(dev)); diff --git a/hw/pci-bridge/pci_expander_bridge_stubs.c b/hw/pci-bridge/pci_= expander_bridge_stubs.c new file mode 100644 index 0000000000..b35180311f --- /dev/null +++ b/hw/pci-bridge/pci_expander_bridge_stubs.c @@ -0,0 +1,14 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * + * Stubs for calls made from machines to handle the case where CONFIG_PXB + * is not enabled. + */ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/pci/pci.h" +#include "hw/pci/pci_bus.h" +#include "hw/pci-bridge/pci_expander_bridge.h" +#include "hw/cxl/cxl.h" + +void pxb_cxl_hook_up_registers(CXLState *state, PCIBus *bus, Error **errp)= {}; diff --git a/include/hw/cxl/cxl_host.h b/include/hw/cxl/cxl_host.h index 4d642a81fa..a1b662ce40 100644 --- a/include/hw/cxl/cxl_host.h +++ b/include/hw/cxl/cxl_host.h @@ -16,6 +16,7 @@ =20 void cxl_machine_init(Object *obj, CXLState *state); void cxl_fmws_link_targets(CXLState *stat, Error **errp); +void cxl_hook_up_pxb_registers(PCIBus *bus, CXLState *state, Error **errp); =20 extern const MemoryRegionOps cfmws_ops; =20 diff --git a/include/hw/pci-bridge/pci_expander_bridge.h b/include/hw/pci-b= ridge/pci_expander_bridge.h new file mode 100644 index 0000000000..0b3856d615 --- /dev/null +++ b/include/hw/pci-bridge/pci_expander_bridge.h @@ -0,0 +1,12 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef PCI_EXPANDER_BRIDGE_H +#define PCI_EXPANDER_BRIDGE_H + +#include "hw/cxl/cxl.h" + +void pxb_cxl_hook_up_registers(CXLState *state, PCIBus *bus, Error **errp); + +#endif /* PCI_EXPANDER_BRIDGE_H */ --=20 2.32.0 From nobody Sun May 19 03:38:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1654700526; cv=none; d=zohomail.com; s=zohoarc; b=HTPwb9B3jQANZtIfpCL1Xsp8vIQzmo8dG8oWG4xeegVmIrAKn3CcWXP6gko7wjLnbyXS+qLg0RNz5du7sSMV51JRXDZ8gF6dgyAVoKK5PhO7iW2pMMz0/3WBxYhAf7pAWaNq7cwc0OFArkJcoUaEl0tqapnRH17mi1RYgO03Bw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654700526; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Yjw4lmEFi7AQjgBj8tUCvYJNaFgekTVX3Rr1fvKTuRA=; b=M/X8WC3czDzxQKZp5DQ+AUk56N8rVPr3JqSWUPk8FJ/qDscSBhXm9Mdwdp6hf/v1KTSKhaTCuD/pASR+dj98hg6eFIbdVpD4w+de9vSWqfObractt35HS+XJ0UhtE7il1l5mSO2FROO8iJ1anokHIuF+MrkBQOBoTjHwF8qAgpM= ARC-Authentication-Results: i=1; mx.zohomail.com; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654700526959351.71753364509675; Wed, 8 Jun 2022 08:02:06 -0700 (PDT) Received: from localhost ([::1]:41768 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyxC9-0007uF-QD for importer@patchew.org; Wed, 08 Jun 2022 11:02:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx7u-0002oX-9x for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:57:45 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:2616) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx7s-0006ps-7C for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:57:41 -0400 Received: from fraeml736-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LJ9FJ5rTJz67mXm; Wed, 8 Jun 2022 22:52:52 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml736-chm.china.huawei.com (10.206.15.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 16:57:38 +0200 Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 15:57:37 +0100 To: Paolo Bonzini , , "Michael S . Tsirkin" , Ben Widawsky CC: , , , Marcel Apfelbaum , Igor Mammedov , Markus Armbruster , "Mark Cave-Ayland" , Adam Manzanares , Tong Zhang , "Shameerali Kolothum Thodi" Subject: [PATCH v3 6/8] tests/acpi: Update q35/CEDT.cxl for new memory addresses. Date: Wed, 8 Jun 2022 15:54:38 +0100 Message-ID: <20220608145440.26106-7-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> References: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhreml703-chm.china.huawei.com (10.201.108.52) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected 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=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Jonathan Cameron From: Jonathan Cameron via X-ZM-MESSAGEID: 1654700528716100001 Content-Type: text/plain; charset="utf-8" The CEDT table includes addreses of host bridge registers. There are allocated in a different order due to the previous patch, so update to the table is needed. Signed-off-by: Jonathan Cameron Reviewed-by: Ben Widawsky --- tests/data/acpi/q35/CEDT.cxl | Bin 184 -> 184 bytes tests/qtest/bios-tables-test-allowed-diff.h | 1 - 2 files changed, 1 deletion(-) diff --git a/tests/data/acpi/q35/CEDT.cxl b/tests/data/acpi/q35/CEDT.cxl index b8fa06b00e65712e91e0a5ea0d9277e0146d1c00..ff8203af070241bd23dd0eb8a51= 460692bb7d229 100644 GIT binary patch delta 18 acmdnNxPx(m*~Boui7rAD&G;s!ga80Nd (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654701269935669.6535421501518; Wed, 8 Jun 2022 08:14:29 -0700 (PDT) Received: from localhost ([::1]:32778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyxO8-0004ig-8t for importer@patchew.org; Wed, 08 Jun 2022 11:14:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx8O-0003NI-Tg for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:58:12 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:2617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx8M-0006rE-NC for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:58:12 -0400 Received: from fraeml737-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LJ9HJ1pJyz67wcQ; Wed, 8 Jun 2022 22:54:36 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml737-chm.china.huawei.com (10.206.15.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 16:58:08 +0200 Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 15:58:08 +0100 To: Paolo Bonzini , , "Michael S . Tsirkin" , Ben Widawsky CC: , , , Marcel Apfelbaum , Igor Mammedov , Markus Armbruster , "Mark Cave-Ayland" , Adam Manzanares , Tong Zhang , "Shameerali Kolothum Thodi" Subject: [PATCH v3 7/8] hw/cxl: Move the CXLState from MachineState to machine type specific state. Date: Wed, 8 Jun 2022 15:54:39 +0100 Message-ID: <20220608145440.26106-8-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> References: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhreml703-chm.china.huawei.com (10.201.108.52) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected 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=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Jonathan Cameron From: Jonathan Cameron via X-ZM-MESSAGEID: 1654701270998100001 Content-Type: text/plain; charset="utf-8" This removes the last of the CXL code from the MachineState where it is visible to all Machines to only those that support CXL (currently i386/p= c) As i386/pc always support CXL now, stop allocating the state independently. Note the pxb register hookup code runs even if cxl=3Doff in order to detect pxb_cxl host bridges and fail to start if any are present as they won't have the control registers available. Signed-off-by: Jonathan Cameron Reviewed-by: Ben Widawsky --- hw/core/machine.c | 6 ------ hw/i386/acpi-build.c | 6 +++--- hw/i386/pc.c | 33 ++++++++++++++++----------------- include/hw/boards.h | 1 - include/hw/i386/pc.h | 2 ++ 5 files changed, 21 insertions(+), 27 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 2e589d99e9..a673302cce 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -33,7 +33,6 @@ #include "sysemu/qtest.h" #include "hw/pci/pci.h" #include "hw/mem/nvdimm.h" -#include "hw/cxl/cxl.h" #include "migration/global_state.h" #include "migration/vmstate.h" #include "exec/confidential-guest-support.h" @@ -1075,10 +1074,6 @@ static void machine_initfn(Object *obj) "Valid values are cpu, mem-ctrl"); } =20 - if (mc->cxl_supported) { - ms->cxl_devices_state =3D g_new0(CXLState, 1); - } - if (mc->cpu_index_to_instance_props && mc->get_default_cpu_node_id) { ms->numa_state =3D g_new0(NumaState, 1); object_property_add_bool(obj, "hmat", @@ -1116,7 +1111,6 @@ static void machine_finalize(Object *obj) g_free(ms->device_memory); g_free(ms->nvdimms_state); g_free(ms->numa_state); - g_free(ms->cxl_devices_state); } =20 bool machine_usb(MachineState *machine) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 2e3b1dd9a2..e8b7844841 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1633,7 +1633,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, =20 /* Handle the ranges for the PXB expanders */ if (pci_bus_is_cxl(bus)) { - MemoryRegion *mr =3D &machine->cxl_devices_state->host_mr; + MemoryRegion *mr =3D &pcms->cxl_devices_state.host_mr; uint64_t base =3D mr->addr; =20 cxl_present =3D true; @@ -2711,9 +2711,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) machine->nvdimms_state, machine->ram_slots, x86ms->oem_id, x86ms->oem_table_id); } - if (machine->cxl_devices_state->is_enabled) { + if (pcms->cxl_devices_state.is_enabled) { cxl_build_cedt(table_offsets, tables_blob, tables->linker, - x86ms->oem_id, x86ms->oem_table_id, machine->cxl_de= vices_state); + x86ms->oem_id, x86ms->oem_table_id, &pcms->cxl_devi= ces_state); } =20 acpi_add_table(table_offsets, tables_blob); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 9f48d02739..a0c0d69698 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -733,12 +733,12 @@ void pc_machine_done(Notifier *notifier, void *data) PCMachineState *pcms =3D container_of(notifier, PCMachineState, machine_done); X86MachineState *x86ms =3D X86_MACHINE(pcms); - MachineState *ms =3D MACHINE(pcms); =20 - if (ms->cxl_devices_state) { - cxl_hook_up_pxb_registers(pcms->bus, ms->cxl_devices_state, - &error_fatal); - cxl_fmws_link_targets(ms->cxl_devices_state, &error_fatal); + cxl_hook_up_pxb_registers(pcms->bus, &pcms->cxl_devices_state, + &error_fatal); + + if (pcms->cxl_devices_state.is_enabled) { + cxl_fmws_link_targets(&pcms->cxl_devices_state, &error_fatal); } =20 /* set the number of CPUs */ @@ -908,8 +908,8 @@ void pc_memory_init(PCMachineState *pcms, &machine->device_memory->mr); } =20 - if (machine->cxl_devices_state->is_enabled) { - MemoryRegion *mr =3D &machine->cxl_devices_state->host_mr; + if (pcms->cxl_devices_state.is_enabled) { + MemoryRegion *mr =3D &pcms->cxl_devices_state.host_mr; hwaddr cxl_size =3D MiB; =20 if (pcmc->has_reserved_memory && machine->device_memory->base) { @@ -927,12 +927,12 @@ void pc_memory_init(PCMachineState *pcms, memory_region_init(mr, OBJECT(machine), "cxl_host_reg", cxl_size); memory_region_add_subregion(system_memory, cxl_base, mr); cxl_resv_end =3D cxl_base + cxl_size; - if (machine->cxl_devices_state->fixed_windows) { + if (pcms->cxl_devices_state.fixed_windows) { hwaddr cxl_fmw_base; GList *it; =20 cxl_fmw_base =3D ROUND_UP(cxl_base + cxl_size, 256 * MiB); - for (it =3D machine->cxl_devices_state->fixed_windows; it; it = =3D it->next) { + for (it =3D pcms->cxl_devices_state.fixed_windows; it; it =3D = it->next) { CXLFixedWindow *fw =3D it->data; =20 fw->base =3D cxl_fmw_base; @@ -974,7 +974,7 @@ void pc_memory_init(PCMachineState *pcms, res_mem_end +=3D memory_region_size(&machine->device_memory->m= r); } =20 - if (machine->cxl_devices_state->is_enabled) { + if (pcms->cxl_devices_state.is_enabled) { res_mem_end =3D cxl_resv_end; } *val =3D cpu_to_le64(ROUND_UP(res_mem_end, 1 * GiB)); @@ -1010,12 +1010,12 @@ uint64_t pc_pci_hole64_start(void) X86MachineState *x86ms =3D X86_MACHINE(pcms); uint64_t hole64_start =3D 0; =20 - if (ms->cxl_devices_state->host_mr.addr) { - hole64_start =3D ms->cxl_devices_state->host_mr.addr + - memory_region_size(&ms->cxl_devices_state->host_mr); - if (ms->cxl_devices_state->fixed_windows) { + if (pcms->cxl_devices_state.host_mr.addr) { + hole64_start =3D pcms->cxl_devices_state.host_mr.addr + + memory_region_size(&pcms->cxl_devices_state.host_mr); + if (pcms->cxl_devices_state.fixed_windows) { GList *it; - for (it =3D ms->cxl_devices_state->fixed_windows; it; it =3D i= t->next) { + for (it =3D pcms->cxl_devices_state.fixed_windows; it; it =3D = it->next) { CXLFixedWindow *fw =3D it->data; hole64_start =3D fw->mr.addr + memory_region_size(&fw->mr); } @@ -1691,7 +1691,6 @@ static void pc_machine_set_max_fw_size(Object *obj, V= isitor *v, static void pc_machine_initfn(Object *obj) { PCMachineState *pcms =3D PC_MACHINE(obj); - MachineState *ms =3D MACHINE(obj); =20 #ifdef CONFIG_VMPORT pcms->vmport =3D ON_OFF_AUTO_AUTO; @@ -1716,7 +1715,7 @@ static void pc_machine_initfn(Object *obj) pcms->pcspk =3D isa_new(TYPE_PC_SPEAKER); object_property_add_alias(OBJECT(pcms), "pcspk-audiodev", OBJECT(pcms->pcspk), "audiodev"); - cxl_machine_init(obj, ms->cxl_devices_state); + cxl_machine_init(obj, &pcms->cxl_devices_state); } =20 static void pc_machine_reset(MachineState *machine) diff --git a/include/hw/boards.h b/include/hw/boards.h index dd9fc56df2..031f5f884d 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -360,7 +360,6 @@ struct MachineState { CPUArchIdList *possible_cpus; CpuTopology smp; struct NVDIMMState *nvdimms_state; - struct CXLState *cxl_devices_state; struct NumaState *numa_state; CXLFixedMemoryWindowOptionsList *cfmws_list; }; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index ffcac5121e..21be7aff26 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -14,6 +14,7 @@ #include "qom/object.h" #include "hw/i386/sgx-epc.h" #include "hw/firmware/smbios.h" +#include "hw/cxl/cxl.h" =20 #define HPET_INTCAP "hpet-intcap" =20 @@ -55,6 +56,7 @@ typedef struct PCMachineState { hwaddr memhp_io_base; =20 SGXEPCState sgx_epc; + CXLState cxl_devices_state; } PCMachineState; =20 #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" --=20 2.32.0 From nobody Sun May 19 03:38:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1654700645; cv=none; d=zohomail.com; s=zohoarc; b=WdNIqA1+rycjdLOh7vqknZsLkUwl7pZxjbLvVhoftcoNE/dRP58KK9YKlfLFyZVdUJIwZAJwW/0ofyOJrJr1xS5Tb5rgLyzvVz+ZXz4JUVcMFl0azy+vbWdiB+BCXHHAWY1jB+rRPWXng80Wt522Jc+cnHl99POnSq03cAhD+Bc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654700645; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=yGwIBn0q/nBFhIqOXa/O597tzFQo/OJYqtKXANoy4vk=; b=aNb5WhgplHbL2dviZ2RqC6v/ih0RX7gJEQzHU/dIA+vF/pS6C1c1Ig/h18CnMExZk/ehWyh+yruzN+zrpXq0qa490KT9itgvd6N+bQvfUuD0qLzJA8pnrw3zWmp4ZABl33G0Gq8LTlfPx/kxsBn4p075dmwsWVaH+U0nv2XdztA= ARC-Authentication-Results: i=1; mx.zohomail.com; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654700645315373.8158914676802; Wed, 8 Jun 2022 08:04:05 -0700 (PDT) Received: from localhost ([::1]:45866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyxE4-0002DV-2N for importer@patchew.org; Wed, 08 Jun 2022 11:04:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx8t-0003kM-2h for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:58:43 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:2618) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyx8r-0006uB-J9 for qemu-devel@nongnu.org; Wed, 08 Jun 2022 10:58:42 -0400 Received: from fraeml735-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4LJ9LX3pN8z67yKf; Wed, 8 Jun 2022 22:57:24 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml735-chm.china.huawei.com (10.206.15.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 16:58:39 +0200 Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 15:58:38 +0100 To: Paolo Bonzini , , "Michael S . Tsirkin" , Ben Widawsky CC: , , , Marcel Apfelbaum , Igor Mammedov , Markus Armbruster , "Mark Cave-Ayland" , Adam Manzanares , Tong Zhang , "Shameerali Kolothum Thodi" Subject: [PATCH v3 8/8] hw/machine: Drop cxl_supported flag as no longer useful Date: Wed, 8 Jun 2022 15:54:40 +0100 Message-ID: <20220608145440.26106-9-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> References: <20220608145440.26106-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhreml703-chm.china.huawei.com (10.201.108.52) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected 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=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Jonathan Cameron From: Jonathan Cameron via X-ZM-MESSAGEID: 1654700646162100001 Content-Type: text/plain; charset="utf-8" As all the CXL elements have moved to boards that support CXL, there is no need to maintain a top level flag. Signed-off-by: Jonathan Cameron Reviewed-by: Ben Widawsky --- hw/i386/pc.c | 1 - include/hw/boards.h | 1 - 2 files changed, 2 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index a0c0d69698..1b6067ff22 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1804,7 +1804,6 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) mc->default_cpu_type =3D TARGET_DEFAULT_CPU_TYPE; mc->nvdimm_supported =3D true; mc->smp_props.dies_supported =3D true; - mc->cxl_supported =3D true; mc->default_ram_id =3D "pc.ram"; =20 object_class_property_add(oc, PC_MACHINE_MAX_RAM_BELOW_4G, "size", diff --git a/include/hw/boards.h b/include/hw/boards.h index 031f5f884d..d94edcef28 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -269,7 +269,6 @@ struct MachineClass { bool ignore_boot_device_suffixes; bool smbus_no_migration_support; bool nvdimm_supported; - bool cxl_supported; bool numa_mem_supported; bool auto_enable_numa; SMPCompatProps smp_props; --=20 2.32.0