From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 359B3C71136 for ; Fri, 13 Jun 2025 13:11:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ4BJ-0003gl-FI; Fri, 13 Jun 2025 09:10:53 -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 1uQ4B6-0003fQ-Tp; Fri, 13 Jun 2025 09:10:42 -0400 Received: from [185.176.79.56] (helo=frasgout.his.huawei.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uQ4B4-0001kj-3K; Fri, 13 Jun 2025 09:10:40 -0400 Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4bJfp55RkBz6K9kL; Fri, 13 Jun 2025 21:07:57 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 1257414038F; Fri, 13 Jun 2025 21:09:56 +0800 (CST) Received: from localhost (10.203.177.66) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 13 Jun 2025 15:09:55 +0200 Date: Fri, 13 Jun 2025 14:09:54 +0100 To: Peter Maydell CC: , Fan Ni , , Zhijian Li , Itaru Kitayama , , , , Yuquan Wang , Philippe =?ISO-8859-1?Q?Mathieu-Daud=E9?= , Alireza Sanaee , Alex =?ISO-8859-1?Q?Benn=E9e?= Subject: Re: [PATCH v15 2/4] hw/cxl: Make the CXL fixed memory windows devices. Message-ID: <20250613140954.000013f5@huawei.com> In-Reply-To: References: <20250612134338.1871023-1-Jonathan.Cameron@huawei.com> <20250612134338.1871023-3-Jonathan.Cameron@huawei.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.177.66] X-ClientProxiedBy: lhrpeml500002.china.huawei.com (7.191.160.78) To frapeml500008.china.huawei.com (7.182.85.71) X-Host-Lookup-Failed: Reverse DNS lookup failed for 185.176.79.56 (deferred) Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, RDNS_NONE=0.793, 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: , Reply-to: Jonathan Cameron From: Jonathan Cameron via Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Fri, 13 Jun 2025 13:33:51 +0100 Peter Maydell wrote: > On Thu, 12 Jun 2025 at 14:44, Jonathan Cameron > wrote: > > > > Previously these somewhat device like structures were tracked using a list > > in the CXLState in each machine. This is proving restrictive in a few > > cases where we need to iterate through these without being aware of the > > machine type. Just make them sysbus devices. > > > > +static void cxl_fmw_realize(DeviceState *dev, Error **errp) > > +{ > > + CXLFixedWindow *fw = CXL_FMW(dev); > > + > > + memory_region_init_io(&fw->mr, OBJECT(dev), &cfmws_ops, fw, > > + "cxl-fixed-memory-region", fw->size); > > + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &fw->mr); > > +} > > + > > +static void cxl_fmw_class_init(ObjectClass *klass, const void *data) > > +{ > > + DeviceClass *dc = DEVICE_CLASS(klass); > > + > > + dc->desc = "CXL Fixed Memory Window"; > > + dc->realize = cxl_fmw_realize; > > + /* Reason - created by machines as tightly coupled to machine memory map */ > > + dc->user_creatable = false; > > +} > > Do these things have any state that needs migrating or resetting? > If they do, they need a reset function and a vmstate. If not, > it's helpful to have a comment explaining that the device > has no state to be reset or migrated, so future readers of > the code know this wasn't just accidentally forgotten. Hi Peter, For these specific devices (the fixed memory windows) there isn't any state as they are representing fixed configuration of the system. The state is all in the host bridges and beyond. I'll add a comment as you suggest. Currently CXL emulation is completely broken wrt to migration and there are some known issues for reset as well. Both are on the list of things to fix. Migration is less important as the only current use for this stuff is running software stack test cases and for that migration isn't currently of interest - that will change for some of the virtualization related work that is just getting started. The reset thing needs more work for devices as we've tripped over a few corner cases triggered by people rebooting the guest and device state not being fully cleared. On top of that we have a complex nest of device reset types to cover at some point as some registers are sticky over some types of reset. Jonathan > > thanks > -- PMM