[PATCH v5 5/6] hw/cxl: Add poison injection via the mailbox.

2023-04-23 Thread Jonathan Cameron via
Very simple implementation to allow testing of corresponding kernel code. Note that for now we track each 64 byte section independently. Whilst a valid implementation choice, it may make sense to fuse entries so as to prove out more complex corners of the kernel code. Reviewed-by: Ira Weiny

[PATCH v5 4/6] hw/cxl: QMP based poison injection support

2023-04-23 Thread Jonathan Cameron via
Inject poison using qmp command cxl-inject-poison to add an entry to the poison list. For now, the poison is not returned CXL.mem reads, but only via the mailbox command Get Poison List. So a normal memory read to an address that is on the poison list will not yet result in a synchronous

[PATCH v5 3/6] bswap: Add the ability to store to an unaligned 24 bit field

2023-04-23 Thread Jonathan Cameron via
From: Ira Weiny CXL has 24 bit unaligned fields which need to be stored to. CXL is specified as little endian. Define st24_le_p() and the supporting functions to store such a field from a 32 bit host native value. The use of b, w, l, q as the size specifier is limiting. So "24" was used for

[PATCH v5 2/6] hw/cxl: Introduce cxl_device_get_timestamp() utility function

2023-04-23 Thread Jonathan Cameron via
From: Ira Weiny There are new users of this functionality coming shortly so factor it out from the GET_TIMESTAMP mailbox command handling. Signed-off-by: Ira Weiny Reviewed-by: Fan Ni Signed-off-by: Jonathan Cameron --- v5: No change. --- hw/cxl/cxl-device-utils.c | 15 +++

[PATCH v5 0/6] hw/cxl: Poison get, inject, clear

2023-04-23 Thread Jonathan Cameron via
v5: More details in each patch. - Simpler algorithm to find entry when clearing. - Improvements to debugability and docs for 24 bit endian functions. - Use of ROUND_DOWN() to simplify the various alignment questions. - Use CXL_CACHELINE_SIZE define to explain the mysterious 64 byte

[PATCH v5 1/6] hw/cxl: rename mailbox return code type from ret_code to CXLRetCode

2023-04-23 Thread Jonathan Cameron via
Given the increasing usage of this mailbox return code type, now is a good time to switch to QEMU style naming. Reviewed-by: Ira Weiny Reviewed-by: Fan Ni Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Jonathan Cameron --- v5: Picked up Philippe's tag. --- hw/cxl/cxl-mailbox-utils.c |

Re: [PATCH v4 5/6] hw/cxl: Add poison injection via the mailbox.

2023-04-21 Thread Jonathan Cameron via
On Tue, 14 Mar 2023 07:27:52 +0100 Philippe Mathieu-Daudé wrote: > On 3/3/23 16:09, Jonathan Cameron wrote: > > Very simple implementation to allow testing of corresponding > > kernel code. Note that for now we track each 64 byte section > > independently. Whilst a valid implementation choice,

[RFC] hw/arm/virt: Provide DT binding generation for PCI eXpander Bridges

2023-04-21 Thread Jonathan Cameron via
This patch and the problem it is trying to resolve will form part of a talk I will be giving next week at Linaro Connect. https://sched.co/1K85p So in the spirit of giving people almost no warning... Plus being able to say the discussion has kicked off here is the simplest solution I could come

[PATCH v5 3/3] hw/cxl: Multi-Region CXL Type-3 Devices (Volatile and Persistent)

2023-04-21 Thread Jonathan Cameron via
From: Gregory Price This commit enables each CXL Type-3 device to contain one volatile memory region and one persistent region. Two new properties have been added to cxl-type3 device initialization: [volatile-memdev] and [persistent-memdev] The existing [memdev] property has been

[PATCH v5 2/3] hw/mem: Use memory_region_size() in cxl_type3

2023-04-21 Thread Jonathan Cameron via
Accessors prefered over direct use of int128_get64() as they clamp out of range values. None are expected here but cleaner to always use the accessor than mix and match. Signed-off-by: Jonathan Cameron --- v5: New patch to tidy up existing instance before adding more of them. - Use

[PATCH v5 1/3] tests/qtest/cxl-test: whitespace, line ending cleanup

2023-04-21 Thread Jonathan Cameron via
From: Gregory Price Defines are starting to exceed line length limits, align them for cleanliness before making modifications. Signed-off-by: Gregory Price Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Jonathan Cameron --- tests/qtest/cxl-test.c | 84

[PATCH v5 0/3] hw/mem: CXL Type-3 Volatile Memory Support

2023-04-21 Thread Jonathan Cameron via
v5: Thanks to Michael Tsirkin for review - Use memory_region_size() instead of incorrect open coding. Add a precursor patch tidying up existing uses. Depends on some of the fix series posted (mostly fuzz). [PATCH 0/2] hw/cxl: CDAT file handling fixes. [PATCH v2 0/3] hw/cxl: Fix decoder

Re: [PATCH v4 0/7] QEMU CXL Provide mock CXL events and irq support

2023-04-21 Thread Jonathan Cameron via
On Fri, 21 Apr 2023 03:25:45 -0400 "Michael S. Tsirkin" wrote: > On Fri, Mar 03, 2023 at 03:28:56PM +, Jonathan Cameron wrote: > > Whilst I'm an optimist, I suspect this is now 8.1 material because we have > > 5 CXL patch sets outstanding before it. Current bottleneck being QAPI review > >

[PATCH v2 3/3] hw/cxl: Fix incorrect reset of commit and associated clearing of committed.

2023-04-21 Thread Jonathan Cameron via
The hardware clearing the commit bit is not spec compliant. Clearing of committed bit when commit is cleared is not specifically stated in the CXL spec, but is the expected (and simplest) permitted behaviour so use that for QEMU emulation. Reviewed-by: Fan Ni Tested-by: Fan Ni Reviewed-by: Dave

[PATCH v2 2/3] hw/cxl: Fix endian handling for decoder commit.

2023-04-21 Thread Jonathan Cameron via
Not a real problem yet as all supported architectures are little endian, but continue to tidy these up when touching code for other reasons. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Jonathan Cameron --- v2: - Split patch so the memory_region_transaction_* calls are dropped first. ---

[PATCH v2 1/3] hw/cxl: drop pointless memory_region_transaction_guards

2023-04-21 Thread Jonathan Cameron via
Not clear what intent was here, but probably based on a misunderstanding of what these guards are for. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Jonathan Cameron --- hw/cxl/cxl-component-utils.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/cxl/cxl-component-utils.c

[PATCH v2 0/3] hw/cxl: Fix decoder commit and uncommit handling

2023-04-21 Thread Jonathan Cameron via
v2: - Split dropping the transaction guards out as precursor (Phillipe) - Picked up tags Issue reported in discussion of: https://lore.kernel.org/all/20230228224014.1402545-1-fan...@samsung.com/ The committed bit for HDM decoders is expected reset when commit transitions from 1->0. Whilst

Re: Error : "cxl_pci 0000:0d:00.0: Failed to get interrupt for event Info log"

2023-04-21 Thread Jonathan Cameron via
On Fri, 21 Apr 2023 19:14:05 +0530 RAGHU H wrote: > Hi Jonathan, > > The log is from the upstream version. > I have your repo, I can work on it if you provide some basic details > like the commit ID. I tag the latest branch with cxl--MM-DD https://gitlab.com/jic23/qemu cxl-2023-04-19

[PATCH 3/3] docs/cxl: Replace unsupported AARCH64 with x86_64

2023-04-21 Thread Jonathan Cameron via
From: Raghu H Currently Qemu CXL emulation support is not availabe on AARCH64 but its available with qemu x86_64 architecture, updating the document to reflect the supported platform. Signed-off-by: Raghu H Signed-off-by: Jonathan Cameron --- docs/system/devices/cxl.rst | 6 +++--- 1 file

[PATCH 2/3] docs/cxl: Remove incorrect CXL type 3 size parameter

2023-04-21 Thread Jonathan Cameron via
From: Raghu H cxl-type3 memory size is read directly from the provided memory backed end device. Remove non existent size option Signed-off-by: Raghu H Signed-off-by: Jonathan Cameron --- docs/system/devices/cxl.rst | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH 1/3] docs/cxl: fix some typos

2023-04-21 Thread Jonathan Cameron via
From: Brice Goglin Signed-off-by: Brice Goglin Signed-off-by: Jonathan Cameron --- docs/system/devices/cxl.rst | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/system/devices/cxl.rst b/docs/system/devices/cxl.rst index f25783a4ec..b65480af6f 100644 ---

[PATCH 0/3] docs/cxl: Gathering of fixes for 8.0 CXL docs.

2023-04-21 Thread Jonathan Cameron via
Some documentation fixes that were on the CXL staging tree that for upstream now 8.1 cycle has started. Brice Goglin (1): docs/cxl: fix some typos Raghu H (2): docs/cxl: Remove incorrect CXL type 3 size parameter docs/cxl: Replace unsupported AARCH64 with x86_64

[PATCH 2/2] hw/cxl: cdat: Fix failure to free buffer in erorr paths

2023-04-21 Thread Jonathan Cameron via
The failure paths in CDAT file loading did not clear up properly. Change to using g_auto_free and a local pointer for the buffer to ensure this function has no side effects on error. Also drop some unnecessary checks that can not fail. Cleanup properly after a failure to load a CDAT file.

[PATCH 1/2] hw/cxl: cdat: Fix open file not closed in ct3_load_cdat()

2023-04-21 Thread Jonathan Cameron via
hieu-Daudé Suggested-by: Peter Maydell Suggested-by: Jonathan Cameron via Signed-off-by: Jonathan Cameron -- Changes since v5: - Drop if guard on g_free() as per checkpatch warning. --- hw/cxl/cxl-cdat.c | 29 - 1 file changed, 8 insertions(+), 21 deletions(-) diff

[PATCH 0/2] hw/cxl: CDAT file handling fixes.

2023-04-21 Thread Jonathan Cameron via
I've picked up Hao Zeng's v5 and added a patch to deal with the issues that Peter pointed out in this area. On error, the CDAT file handling left resource dangling and didn't cleanly exit from calling functions. Hao Zeng dealt with closing the file. The second patch deals with the buffer

Re: [PATCH v5] cxl-cdat:Fix open file not closed in ct3_load_cdat

2023-04-21 Thread Jonathan Cameron via
ation") > Signed-off-by: Zeng Hao > Suggested-by: Philippe Mathieu-Daudé > Suggested-by: Peter Maydell > Suggested-by: Jonathan Cameron via > > --- > ChangeLog: > v4-v5: > fixes some style issues and keep the protection after using g_free() > v3

Re: Error : "cxl_pci 0000:0d:00.0: Failed to get interrupt for event Info log"

2023-04-21 Thread Jonathan Cameron via
On Thu, 20 Apr 2023 18:07:40 +0530 RAGHU H wrote: > Hello, > > I am using qemu config listed in CXL documentation to emulate CXL device > > > -object > memory-backend-file,id=cxl-mem1,share=on,mem-path=/tmp/cxltest.raw,size=256M > \ > -object >

Re: [PATCH 4/9] docs/cxl: Fix sentence

2023-04-21 Thread Jonathan Cameron via
On Thu, 20 Apr 2023 16:57:18 +0100 Alex Bennée wrote: > From: Stefan Weil via > > Signed-off-by: Stefan Weil > Reviewed-by: Richard Henderson > Acked-by: Jonathan Cameron > Message-Id: <20230409201828.1159568-1...@weilnetz.de> > Signed-off-by: Alex Bennée Thomas already sent a pull

[RFC PATCH v2] hw/pci-bridge: Fix release ordering by embedding PCIBridgeWindows within PCIBridge

2023-04-21 Thread Jonathan Cameron via
The lifetime of the PCIBridgeWindows instance accessed via the windows pointer in struct PCIBridge is managed separately from the PCIBridge itself. Triggered by ./qemu-system-x86_64 -M x-remote -display none -monitor stdio QEMU monitor: device_add cxl-downstream In some error handling paths

Re: [PATCH 0/2] hw/pci-bridge: pci_expander_bridge: Fix wrong type and rework inheritance.

2023-04-21 Thread Jonathan Cameron via
On Fri, 21 Apr 2023 09:59:57 +0100 Peter Maydell wrote: > On Fri, 21 Apr 2023 at 09:19, Michael S. Tsirkin wrote: > > > > On Thu, Apr 20, 2023 at 03:27:48PM +0100, Jonathan Cameron wrote: > > > Peter Maydell highlighted an incorrect conversion to TYPE_PXB_DEVICE from > > > a device that

Re: [RFC PATCH] hw/pci-bridge: Fix release ordering by embedding PCIBridgeWindows within PCIBridge

2023-04-21 Thread Jonathan Cameron via
On Fri, 21 Apr 2023 08:26:43 +0200 Philippe Mathieu-Daudé wrote: > Hi Jonathan, > > On 20/4/23 16:59, Jonathan Cameron via wrote: > > The lifetime of the PCIBridgeWindows instance accessed via the windows > > pointer > > in struct PCIBridge is managed separatel

Re: [PATCH] hw/pci-bridge: Fix release ordering by embedding PCIBridgeWindows within PCIBridge

2023-04-20 Thread Jonathan Cameron via
This was intended to be [RFC] for reasons given below. + I failed to CC Thomas who reported the issue. Not my finest hour. On Thu, 20 Apr 2023 15:59:37 +0100 Jonathan Cameron wrote: > The lifetime of the PCIBridgeWindows instance accessed via the windows pointer > in struct PCIBridge is

[PATCH] hw/pci-bridge: Fix release ordering by embedding PCIBridgeWindows within PCIBridge

2023-04-20 Thread Jonathan Cameron via
The lifetime of the PCIBridgeWindows instance accessed via the windows pointer in struct PCIBridge is managed separately from the PCIBridge itself. Triggered by ./qemu-system-x86_64 -M x-remote -display none -monitor stdio QEMU monitor: device_add cxl-downstream In some error handling paths

[PATCH 2/2] hw/pci-bridge: Make PCIe and CXL PXB Devices inherit from TYPE_PXB_DEV

2023-04-20 Thread Jonathan Cameron via
Previously, PXB_CXL_DEVICE, PXB_PCIE_DEVICE and PXB_DEVICE all have PCI_DEVICE as their direct parent but share a common state struct PXBDev. convert_to_pxb() is used to get the PXBDev instance from which ever of these types it is called on. This patch switches to an explicit heirarchy based on

[PATCH 1/2] hw/pci-bridge: pci_expander_bridge fix type in pxb_cxl_dev_reset()

2023-04-20 Thread Jonathan Cameron via
Reproduce issue with configure --enable-qom-cast-debug ... qemu-system-x86_64 -display none -machine q35,cxl=on -device pxb-cxl,bus=pcie.0 hw/pci-bridge/pci_expander_bridge.c:54:PXB_DEV: Object 0x5570e0b1ada0 is not an instance of type pxb Aborted The type conversion results in the right

[PATCH 0/2] hw/pci-bridge: pci_expander_bridge: Fix wrong type and rework inheritance.

2023-04-20 Thread Jonathan Cameron via
Peter Maydell highlighted an incorrect conversion to TYPE_PXB_DEVICE from a device that didn't have that a an ancestor type. PXB_DEV() used instead of PXB_CXL_DEV()/ https://lore.kernel.org/qemu-devel/cafeaca-+de+eelce4ysaw1o-qyd_4w1ra05mgdsu_-3a6d9...@mail.gmail.com/ During the discussion it

Re: [PULL 70/73] hw/pxb-cxl: Support passthrough HDM Decoders unless overridden

2023-04-19 Thread Jonathan Cameron via
On Wed, 19 Apr 2023 17:25:17 +0100 Peter Maydell wrote: > On Wed, 19 Apr 2023 at 15:50, Jonathan Cameron > wrote: > > > > On Wed, 19 Apr 2023 14:57:54 +0100 > > Jonathan Cameron via wrote: > > > > > On Tue, 11 Apr 2023 11:26:16 +0100 >

Re: [PULL 70/73] hw/pxb-cxl: Support passthrough HDM Decoders unless overridden

2023-04-19 Thread Jonathan Cameron via
On Wed, 19 Apr 2023 14:57:54 +0100 Jonathan Cameron via wrote: > On Tue, 11 Apr 2023 11:26:16 +0100 > Peter Maydell wrote: > > > On Wed, 8 Mar 2023 at 01:14, Michael S. Tsirkin wrote: > > > > > > From: Jonathan Cameron > > > > > > The C

Re: [PULL 70/73] hw/pxb-cxl: Support passthrough HDM Decoders unless overridden

2023-04-19 Thread Jonathan Cameron via
On Tue, 11 Apr 2023 11:26:16 +0100 Peter Maydell wrote: > On Wed, 8 Mar 2023 at 01:14, Michael S. Tsirkin wrote: > > > > From: Jonathan Cameron > > > > The CXL r3.0 specification allows for there to be no HDM decoders on CXL > > Host Bridges if they have only a single root port. Instead, all

Re: [PULL 70/73] hw/pxb-cxl: Support passthrough HDM Decoders unless overridden

2023-04-19 Thread Jonathan Cameron via
On Mon, 17 Apr 2023 15:04:41 +0200 Thomas Huth wrote: > On 17/04/2023 13.29, Michael S. Tsirkin wrote: > > On Mon, Apr 17, 2023 at 01:22:51PM +0200, Thomas Huth wrote: > >> On 11/04/2023 12.26, Peter Maydell wrote: > >>> On Wed, 8 Mar 2023 at 01:14, Michael S. Tsirkin wrote: > >

Re: [PATCH v4] cxl-cdat:Fix open file not closed in ct3_load_cdat

2023-04-13 Thread Jonathan Cameron via
On Thu, 13 Apr 2023 17:33:28 +0800 Hao Zeng wrote: > opened file processor not closed,May cause file processor leaks Patch description needs to say more on how this is fixed. Perhaps something like: "Open file descriptor not closed in error paths. Fix by replace open coded handling of read of

Re: [PATCH v1 0/2] Update CXL documentation

2023-04-13 Thread Jonathan Cameron via
On Thu, 6 Apr 2023 18:58:37 +0530 Raghu H wrote: > Thanks Jonathan for quick review/comments on earlier patch, as suggested > splitting into two separate patches > https://www.mail-archive.com/qemu-devel@nongnu.org/msg952999.html > > Removed the unsupported size option for cxl-type3 device,

Re: [PULL v4 23/83] hw/cxl/cdat: CXL CDAT Data Object Exchange implementation

2023-04-12 Thread Jonathan Cameron via
On Tue, 11 Apr 2023 16:52:58 +0100 Peter Maydell wrote: > On Mon, 7 Nov 2022 at 22:49, Michael S. Tsirkin wrote: > > > > From: Huai-Cheng Kuo > > > > The Data Object Exchange implementation of CXL Coherent Device Attribute > > Table (CDAT). This implementation is referring to "Coherent Device

Re: [PULL v4 23/83] hw/cxl/cdat: CXL CDAT Data Object Exchange implementation

2023-04-12 Thread Jonathan Cameron via
On Tue, 11 Apr 2023 16:52:58 +0100 Peter Maydell wrote: > On Mon, 7 Nov 2022 at 22:49, Michael S. Tsirkin wrote: > > > > From: Huai-Cheng Kuo > > > > The Data Object Exchange implementation of CXL Coherent Device Attribute > > Table (CDAT). This implementation is referring to "Coherent Device

Re: [PATCH v2 2/2] cxl-cdat:Fix the check on the return value of fread()

2023-04-12 Thread Jonathan Cameron via
On Wed, 12 Apr 2023 12:02:47 +0200 Philippe Mathieu-Daudé wrote: > On 12/4/23 09:16, Hao Zeng wrote: > > The bug in this code (CID 1507822) is that the > > check on the return value of fread() is wrong. fread() > > returns the number of items read or written, so > > checking for == 0 only

Re: [PATCH for-8.0] docs/cxl: Fix sentence

2023-04-11 Thread Jonathan Cameron via
On Sun, 9 Apr 2023 22:18:28 +0200 Stefan Weil wrote: > Signed-off-by: Stefan Weil Acked-by: Jonathan Cameron > --- > > If my change is okay I suggest to apply the patch for 8.0 > because it fixes documentation. > > Regards, > Stefan W. > > docs/system/devices/cxl.rst | 2 +- > 1 file

Re: [PATCH] docs:remove cxl3 device size

2023-04-06 Thread Jonathan Cameron via
On Wed, 5 Apr 2023 15:57:38 +0530 Raghu H wrote: Hi Raghu, Thanks for tidying this up! (and reporting it in the first place) A few minor comments for v2. A better title might be docs/cxl: Remove incorrect CXL type 3 size parameter. > cxl device typ3 size is read from the memory backend

Re: [RFC PATCH 0/4] hw/i386: Factor out PXB parts of DSDT into an SSDT table

2023-04-06 Thread Jonathan Cameron via
On Fri, 17 Mar 2023 16:54:36 + Jonathan Cameron via wrote: > Michael Tsirkin raised that we have recently had churn in the bios-tables-test > and perhaps it was worth factoring some parts of DSDT out as SSDT files. > This is an attempt to do that for the entries from pxb-pcie an

Re: [PULL 02/10] pci-bridge/cxl_downstream: Add a CXL switch downstream port

2023-04-03 Thread Jonathan Cameron via
On Fri, 24 Mar 2023 11:17:50 +0100 Thomas Huth wrote: > On 07/12/2022 14.26, Thomas Huth wrote: > > On 07/12/2022 14.21, Jonathan Cameron wrote: > >> On Mon, 05 Dec 2022 14:59:39 + > >> Alex Bennée wrote: > >> > >>> Jonathan Cameron via

Re: property 'cxl-type3.size' not found

2023-04-03 Thread Jonathan Cameron via
On Mon, 3 Apr 2023 16:03:20 +0530 Maverickk 78 wrote: > Hi Jonathan > > Do you want me to modify the doc(remove size)? I can do that. That would be great. Also whilst there, a second patch to modify the architecture to be x86_64 would be good. Thanks, Jonathan > > Regards > Raghu > > On

Re: property 'cxl-type3.size' not found

2023-04-03 Thread Jonathan Cameron via
On Mon, 3 Apr 2023 14:34:33 +0530 Maverickk 78 wrote: > Hello, > > I am trying qemu-system-aarch64 & cxl configuration listed in > > https://www.qemu.org/docs/master/system/devices/cxl.html > > qemu-system-aarch64 -M virt,gic-version=3,cxl=on -m 4g,maxmem=8G,slots=8 > -cpu max \ > ... >

Re: Cxl devel!

2023-03-28 Thread Jonathan Cameron via
On Fri, 24 Mar 2023 04:32:52 +0530 Maverickk 78 wrote: > Hello Jonathan > > Raghu here, I'm going over your cxl patches for past few days, it's very > impressive. > > I want to get involved and contribute in your endeavor, may be bits & > pieces to start. > > If you're specific trivial

Re: [RESEND PATCH 2/2] hw/cxl: Fix incorrect reset of commit and associated clearing of committed.

2023-03-24 Thread Jonathan Cameron via
On Wed, 22 Mar 2023 16:21:26 + Fan Ni wrote: > On Wed, Mar 22, 2023 at 10:33:00AM +, Jonathan Cameron wrote: > > The hardware clearing the commit bit is not spec compliant. > > Clearing of committed bit when commit is cleared is not specifically > > stated in the CXL spec, but is the

[PATCH 0/2] hw/cxl: Fix decoder commit and uncommit handling

2023-03-22 Thread Jonathan Cameron via
Issue reported in discussion of: https://lore.kernel.org/all/20230228224014.1402545-1-fan...@samsung.com/ The committed bit for HDM decoders is expected reset when commit transitions from 1->0. Whilst looking at that it was noticed that hardware was resetting the commit bit which is not an

[PATCH 2/2] hw/cxl: Fix incorrect reset of commit and associated clearing of committed.

2023-03-22 Thread Jonathan Cameron via
The hardware clearing the commit bit is not spec compliant. Clearing of committed bit when commit is cleared is not specifically stated in the CXL spec, but is the expected (and simplest) permitted behaviour so use that for QEMU emulation. Signed-off-by: Jonathan Cameron ---

Re: [PATCH] hw/acpi/cxl: Drop device-memory support from CFMWS entries

2023-03-22 Thread Jonathan Cameron via
On Mon, 20 Mar 2023 23:08:31 -0700 Dan Williams wrote: > While it was a reasonable idea to specify no window restricitions at the > outset of the CXL emulation support, it turns out that in practice a > platform will never follow the QEMU example of specifying simultaneous > support for HDM-H

[RESEND PATCH 2/2] hw/cxl: Fix incorrect reset of commit and associated clearing of committed.

2023-03-22 Thread Jonathan Cameron via
The hardware clearing the commit bit is not spec compliant. Clearing of committed bit when commit is cleared is not specifically stated in the CXL spec, but is the expected (and simplest) permitted behaviour so use that for QEMU emulation. Signed-off-by: Jonathan Cameron ---

[RESEND PATCH 2/2] hw/cxl: Fix incorrect reset of commit and associated clearing of committed.

2023-03-22 Thread Jonathan Cameron via
The hardware clearing the commit bit is not spec compliant. Clearing of committed bit when commit is cleared is not specifically stated in the CXL spec, but is the expected (and simplest) permitted behaviour so use that for QEMU emulation. Signed-off-by: Jonathan Cameron ---

Re: [PATCH 1/2] hw/cxl: Fix endian handling for decoder commit.

2023-03-22 Thread Jonathan Cameron via
On Tue, 21 Mar 2023 19:28:02 + Fan Ni wrote: > On Tue, Mar 21, 2023 at 06:00:11PM +, Jonathan Cameron wrote: > > Not a real problem yet as all supported architectures are > > little endian, but continue to tidy these up when touching > > code for other reasons. > > > > Signed-off-by:

[RESEND PATCH 1/2] hw/cxl: Fix endian handling for decoder commit.

2023-03-22 Thread Jonathan Cameron via
Not a real problem yet as all supported architectures are little endian, but continue to tidy these up when touching code for other reasons. Signed-off-by: Jonathan Cameron --- hw/cxl/cxl-component-utils.c | 10 -- hw/mem/cxl_type3.c | 9 ++--- 2 files changed, 10

[RESEND PATCH 0/2] hw/cxl: Fix decoder commit and uncommit handling

2023-03-22 Thread Jonathan Cameron via
Resending because all but patch 1 seem to have failed to make it out of our network. Issue reported in discussion of: https://lore.kernel.org/all/20230228224014.1402545-1-fan...@samsung.com/ The committed bit for HDM decoders is expected reset when commit transitions from 1->0. Whilst looking

[PATCH 1/2] hw/cxl: Fix endian handling for decoder commit.

2023-03-21 Thread Jonathan Cameron via
Not a real problem yet as all supported architectures are little endian, but continue to tidy these up when touching code for other reasons. Signed-off-by: Jonathan Cameron --- hw/cxl/cxl-component-utils.c | 10 -- hw/mem/cxl_type3.c | 9 ++--- 2 files changed, 10

Re: Call failed: MCTP Endpoint did not respond: Qemu CXL switch with mctp-1.0

2023-03-17 Thread Jonathan Cameron via
On Fri, 17 Mar 2023 16:37:20 + Jonathan Cameron via wrote: > On Fri, 17 Mar 2023 00:11:10 +0530 > Maverickk 78 wrote: > > > Hi > > > > I am trying mctp & mctpd with aspeed +buildroot(master) + linux v6.2 > > with Qemu 7.2. > > > >

[RFC PATCH 4/4] tests/acpi: Updated DSDT and SSDT due to move of PXB info to SSDT

2023-03-17 Thread Jonathan Cameron via
Signed-off-by: Jonathan Cameron --- tests/data/acpi/q35/DSDT.cxl| Bin 9673 -> 8474 bytes tests/data/acpi/q35/DSDT.viot | Bin 9470 -> 8429 bytes tests/data/acpi/q35/SSDT.cxl| Bin 0 -> 1235 bytes tests/data/acpi/q35/SSDT.viot | Bin 0

[RFC PATCH 3/4] hw/i386/acpi: Separate PXB related parts of DSDT into an SSDT table.

2023-03-17 Thread Jonathan Cameron via
The dependencies between the CRS entries and bus numbers due to PCI eXpander Bridges taking resources from the primary bus make this a slightly complex dance. The rules we have to fit into are: 1) FACP is first table in RSDT and points to the DSDT. 2) Thus DSDT is created before FACP 3) SSDT must

[RFC PATCH 2/4] tests/acpi: Allow changes to DSDT.cxl/viot and SSDT.cxl/viot

2023-03-17 Thread Jonathan Cameron via
Splitting the PXB parts out of DSDT will change these files. Signed-off-by: Jonathan Cameron --- tests/data/acpi/q35/SSDT.cxl| 0 tests/data/acpi/q35/SSDT.viot | 0 tests/qtest/bios-tables-test-allowed-diff.h | 4 3 files changed, 4 insertions(+) diff --git

[RFC PATCH 1/4] hw/acpi: Make Aml and / or crs_range_set optional in build_crs

2023-03-17 Thread Jonathan Cameron via
This allows the same code to be used for two purposes. 1) To fill in the crs_range_set as is later used to generate the actual AML for the primary PCI host bridge. 2) Create the _CRS AML for the PXB bridges. The separation is need to allow for DSDT to be generated before an SSDT for any PXB

[RFC PATCH 0/4] hw/i386: Factor out PXB parts of DSDT into an SSDT table

2023-03-17 Thread Jonathan Cameron via
Michael Tsirkin raised that we have recently had churn in the bios-tables-test and perhaps it was worth factoring some parts of DSDT out as SSDT files. This is an attempt to do that for the entries from pxb-pcie and pxb-cxl PCI root bridges. The main PCI root bridge and related elements are left

Re: Call failed: MCTP Endpoint did not respond: Qemu CXL switch with mctp-1.0

2023-03-17 Thread Jonathan Cameron via
On Fri, 17 Mar 2023 00:11:10 +0530 Maverickk 78 wrote: > Hi > > I am trying mctp & mctpd with aspeed +buildroot(master) + linux v6.2 > with Qemu 7.2. > > > I have added necessary FMAPI related patches into QEMU to support CLX > switch emulation > >

Re: [RESEND PATCH v6 8/8] hw/mem/cxl_type3: Add CXL RAS Error Injection Support.

2023-03-14 Thread Jonathan Cameron via
> > diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h > > index 7e5ad65c1d..d589f78202 100644 > > --- a/include/hw/cxl/cxl_device.h > > +++ b/include/hw/cxl/cxl_device.h > > @@ -232,6 +232,14 @@ REG64(CXL_MEM_DEV_STS, 0) > > FIELD(CXL_MEM_DEV_STS, MBOX_READY, 4, 1) > >

Re: [PATCH v4 6/6] hw/cxl: Add clear poison mailbox command support.

2023-03-13 Thread Jonathan Cameron via
On Fri, 3 Mar 2023 15:09:08 + Jonathan Cameron wrote: > Current implementation is very simple so many of the corner > cases do not exist (e.g. fragmenting larger poison list entries) > > Signed-off-by: Jonathan Cameron Another case in here of directly accessing MemoryRegion->size. I'll fix

Re: [PATCH v4 2/2] hw/cxl: Multi-Region CXL Type-3 Devices (Volatile and Persistent)

2023-03-13 Thread Jonathan Cameron via
... > > +if (vmr) { > > +if (*dpa_offset < int128_get64(vmr->size)) { > > +*as = >hostvmem_as; > > +} else { > > +*as = >hostpmem_as; > > +*dpa_offset -= vmr->size; > > You can't do math on vmr->size, it's Int128. > And generally please

Re: [PATCH v4 6/6] hw/cxl: Add clear poison mailbox command support.

2023-03-06 Thread Jonathan Cameron via
On Fri, 3 Mar 2023 22:47:20 -0800 Ira Weiny wrote: > Jonathan Cameron wrote: > > Current implementation is very simple so many of the corner > > cases do not exist (e.g. fragmenting larger poison list entries) > > One coding style change at the bottom and I'm still hung up on that loop >

[PATCH v4 7/7] hw/cxl/events: Add injection of Memory Module Events

2023-03-03 Thread Jonathan Cameron via
These events include a copy of the device health information at the time of the event. Actually using the emulated device health would require a lot of controls to manipulate that state. Given the aim of this injection code is to just test the flows when events occur, inject the contents of the

[PATCH v4 6/7] hw/cxl/events: Add injection of DRAM events

2023-03-03 Thread Jonathan Cameron via
Defined in CXL r3.0 8.2.9.2.1.2 DRAM Event Record, this event provides information related to DRAM devices. Example injection command in QMP: { "execute": "cxl-inject-dram-event", "arguments": { "path": "/machine/peripheral/cxl-mem0", "log": "informational", "flags":

[PATCH v4 5/7] hw/cxl/events: Add injection of General Media Events

2023-03-03 Thread Jonathan Cameron via
From: Ira Weiny To facilitate testing provide a QMP command to inject a general media event. The event can be added to the log specified. Signed-off-by: Ira Weiny Signed-off-by: Jonathan Cameron --- v4: * Fix endian conversion on physaddr. --- hw/mem/cxl_type3.c | 111

[PATCH v4 3/7] hw/cxl/events: Wire up get/clear event mailbox commands

2023-03-03 Thread Jonathan Cameron via
From: Ira Weiny CXL testing is benefited from an artificial event log injection mechanism. Add an event log infrastructure to insert, get, and clear events from the various logs available on a device. Replace the stubbed out CXL Get/Clear Event mailbox commands with commands that operate on

[PATCH v4 4/7] hw/cxl/events: Add event interrupt support

2023-03-03 Thread Jonathan Cameron via
From: Ira Weiny Replace the stubbed out CXL Get/Set Event interrupt policy mailbox commands. Enable those commands to control interrupts for each of the event log types. Skip the standard input mailbox length on the Set command due to DCD being optional. Perform the checks separately.

[PATCH v4 2/7] hw/cxl: Move CXLRetCode definition to cxl_device.h

2023-03-03 Thread Jonathan Cameron via
Following patches will need access to the mailbox return code type so move it to the header. Reviewed-by: Ira Weiny Signed-off-by: Jonathan Cameron --- hw/cxl/cxl-mailbox-utils.c | 28 include/hw/cxl/cxl_device.h | 28 2 files changed,

[PATCH v4 1/7] hw/cxl/events: Add event status register

2023-03-03 Thread Jonathan Cameron via
From: Ira Weiny The device status register block was defined. However, there were no individual registers nor any data wired up. Define the event status register [CXL 3.0; 8.2.8.3.1] as part of the device status register block. Wire up the register and initialize the event status for each

[PATCH v4 0/7] QEMU CXL Provide mock CXL events and irq support

2023-03-03 Thread Jonathan Cameron via
Whilst I'm an optimist, I suspect this is now 8.1 material because we have 5 CXL patch sets outstanding before it. Current bottleneck being QAPI review for the RAS error series. v4 changes: Thanks to Ira and to some feedback I received off list. - More endian fixes for a future big endian

[PATCH v4 6/6] hw/cxl: Add clear poison mailbox command support.

2023-03-03 Thread Jonathan Cameron via
Current implementation is very simple so many of the corner cases do not exist (e.g. fragmenting larger poison list entries) Signed-off-by: Jonathan Cameron --- v4: - Fix off by one on check of edge of vmr (cut and paste from similar but long fixed in the volatile memory series) - Drop

[PATCH v4 5/6] hw/cxl: Add poison injection via the mailbox.

2023-03-03 Thread Jonathan Cameron via
Very simple implementation to allow testing of corresponding kernel code. Note that for now we track each 64 byte section independently. Whilst a valid implementation choice, it may make sense to fuse entries so as to prove out more complex corners of the kernel code. Reviewed-by: Ira Weiny

[PATCH v4 4/6] hw/cxl: QMP based poison injection support

2023-03-03 Thread Jonathan Cameron via
Inject poison using qmp command cxl-inject-poison to add an entry to the poison list. For now, the poison is not returned CXL.mem reads, but only via the mailbox command Get Poison List. See CXL rev 3.0, sec 8.2.9.8.4.1 Get Poison list (Opcode 4300h) Kernel patches to use this interface here:

[PATCH v4 3/6] bswap: Add the ability to store to an unaligned 24 bit field

2023-03-03 Thread Jonathan Cameron via
From: Ira Weiny CXL has 24 bit unaligned fields which need to be stored to. CXL is specified as little endian. Define st24_le_p() and the supporting functions to store such a field from a 32 bit host native value. The use of b, w, l, q as the size specifier is limiting. So "24" was used for

[PATCH v4 2/6] hw/cxl: Introduce cxl_device_get_timestamp() utility function

2023-03-03 Thread Jonathan Cameron via
From: Ira Weiny There are new users of this functionality coming shortly so factor it out from the GET_TIMESTAMP mailbox command handling. Signed-off-by: Ira Weiny Reviewed-by: Fan Ni Signed-off-by: Jonathan Cameron --- v8: Picked up tag from Fan Ni --- hw/cxl/cxl-device-utils.c | 15

[PATCH v4 1/6] hw/cxl: rename mailbox return code type from ret_code to CXLRetCode

2023-03-03 Thread Jonathan Cameron via
Given the increasing usage of this mailbox return code type, now is a good time to switch to QEMU style naming. Reviewed-by: Ira Weiny Reviewed-by: Fan Ni Signed-off-by: Jonathan Cameron --- v8: Picked up tag from Fan Ni --- hw/cxl/cxl-mailbox-utils.c | 64

[PATCH v4 0/6] hw/cxl: Poison get, inject, clear

2023-03-03 Thread Jonathan Cameron via
Note there are several series ahead of this one and in particular the RAS error injection series needs some QAPI review. The QAPI stuff in this patch is similar but in essence very similar to what we have in that series. Whilst I'm an always an optimist, this may well end up as 8.1 material now.

Re: [PATCH v3 6/7] hw/cxl/events: Add injection of DRAM events

2023-03-03 Thread Jonathan Cameron via
On Wed, 1 Mar 2023 22:38:26 -0800 Ira Weiny wrote: > Jonathan Cameron wrote: > > Defined in CXL r3.0 8.2.9.2.1.2 DRAM Event Record, this event > > provides information related to DRAM devices. > > > > Example injection command in QMP: > > > > { "execute": "cxl-inject-dram-event", > >

Re: [PATCH v3 4/6] hw/cxl: QMP based poison injection support

2023-03-03 Thread Jonathan Cameron via
> > +memset(out, 0, out_pl_len); > > +QLIST_FOREACH(ent, poison_list, node) { > > +uint64_t start, stop; > > + > > +/* Check for no overlap */ > > +if (ent->start >= query_start + query_length || > > +ent->start + ent->length <= query_start) { > > +

Re: [PATCH v3 6/6] hw/cxl: Add clear poison mailbox command support.

2023-03-03 Thread Jonathan Cameron via
On Thu, 2 Mar 2023 17:05:22 -0800 Ira Weiny wrote: > Jonathan Cameron wrote: > > Current implementation is very simple so many of the corner > > cases do not exist (e.g. fragmenting larger poison list entries) > > > > Signed-off-by: Jonathan Cameron > > --- > > v2: > > - Endian fix > > --- > >

Re: [PATCH v3 5/7] hw/cxl/events: Add injection of General Media Events

2023-03-02 Thread Jonathan Cameron via
On Mon, 27 Feb 2023 17:34:14 + Jonathan Cameron wrote: > From: Ira Weiny > > To facilitate testing provide a QMP command to inject a general media > event. The event can be added to the log specified. > > Signed-off-by: Ira Weiny > Link: >

Re: [PATCH v6 8/8] hw/mem/cxl_type3: Add CXL RAS Error Injection Support.

2023-03-02 Thread Jonathan Cameron via
with lots > of stuff among them QAPI. Thanks for the tip. Resent with additional CCs (hopefully to right people!) and a note that we are looking for qapi review. With the benefit of hindsight I'd have ordered the series differently if I'd guessed we'd bottleneck here. Jonathan > &g

[RESEND PATCH v6 8/8] hw/mem/cxl_type3: Add CXL RAS Error Injection Support.

2023-03-02 Thread Jonathan Cameron via
CXL uses PCI AER Internal errors to signal to the host that an error has occurred. The host can then read more detailed status from the CXL RAS capability. For uncorrectable errors: support multiple injection in one operation as this is needed to reliably test multiple header logging support in

[RESEND PATCH v6 7/8] hw/pci/aer: Make PCIE AER error injection facility available for other emulation to use.

2023-03-02 Thread Jonathan Cameron via
This infrastructure will be reused for CXL RAS error injection in patches that follow. Reviewed-by: Dave Jiang Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Jonathan Cameron --- hw/pci/pci-internal.h | 1 - include/hw/pci/pcie_aer.h | 1 + 2 files changed, 1 insertion(+), 1

[RESEND PATCH v6 6/8] hw/cxl: Fix endian issues in CXL RAS capability defaults / masks

2023-03-02 Thread Jonathan Cameron via
As these are about to be modified, fix the endian handle for this set of registers rather than making it worse. Note that CXL is currently only supported in QEMU on x86 (arm64 patches out of tree) so we aren't going to yet hit an problems with big endian. However it is good to avoid making things

[RESEND PATCH v6 5/8] hw/mem/cxl-type3: Add AER extended capability

2023-03-02 Thread Jonathan Cameron via
This enables AER error injection to function as expected. It is intended as a building block in enabling CXL RAS error injection in the following patches. Signed-off-by: Jonathan Cameron Reviewed-by: Dave Jiang --- hw/mem/cxl_type3.c | 13 + 1 file changed, 13 insertions(+) diff

[RESEND PATCH v6 4/8] hw/pci-bridge/cxl_root_port: Wire up MSI

2023-03-02 Thread Jonathan Cameron via
Done to avoid fixing ACPI route description of traditional PCI interrupts on q35 and because we should probably move with the times anyway. Signed-off-by: Jonathan Cameron Reviewed-by: Dave Jiang --- hw/pci-bridge/cxl_root_port.c | 61 +++ 1 file changed, 61

[RESEND PATCH v6 3/8] hw/pci-bridge/cxl_root_port: Wire up AER

2023-03-02 Thread Jonathan Cameron via
We are missing necessary config write handling for AER emulation in the CXL root port. Add it based on pcie_root_port.c Signed-off-by: Jonathan Cameron Reviewed-by: Dave Jiang --- hw/pci-bridge/cxl_root_port.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/pci-bridge/cxl_root_port.c

[RESEND PATCH v6 2/8] hw/pci/aer: Add missing routing for AER errors

2023-03-02 Thread Jonathan Cameron via
PCIe r6.0 Figure 6-3 "Pseudo Logic Diagram for Selected Error Message Control and Status Bits" includes a right hand branch under "All PCI Express devices" that allows for messages to be generated or sent onwards without SERR# being set as long as the appropriate per error class bit in the PCIe

<    3   4   5   6   7   8   9   10   11   12   >