From patchwork Fri May 26 17:00:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13257177 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6653DC7EE23 for ; Fri, 26 May 2023 17:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237371AbjEZRAR (ORCPT ); Fri, 26 May 2023 13:00:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230248AbjEZRAQ (ORCPT ); Fri, 26 May 2023 13:00:16 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B205FBC for ; Fri, 26 May 2023 10:00:13 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4QSWMN4tg1z67hv7; Sat, 27 May 2023 00:58:08 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 26 May 2023 18:00:09 +0100 From: Jonathan Cameron To: , Michael Tsirkin , Fan Ni CC: , , Ira Weiny , Michael Roth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Dave Jiang , Markus Armbruster , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Eric Blake , Mike Maslenkin , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Thomas Huth Subject: [PATCH v8 0/4] hw/cxl: Poison get, inject, clear Date: Fri, 26 May 2023 18:00:06 +0100 Message-ID: <20230526170010.574-1-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml500003.china.huawei.com (7.191.162.67) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org v8: Formatting fixes for QMP docs from Markus Armbruster (thanks!) The bswap naming discussions seems to have died down, so I'll stick with this version (24) Precursors now all upstream which make this email easier to write :) The kernel support for Poison handling is now upstream. This code has been very useful for testing and helped identify various corner cases. Updated cover letter. The series supports: 1) Injection of variable length poison regions via QMP (to fake real memory corruption and ensure we deal with odd overflow corner cases such as clearing the middle of a large region making the list overflow as we go from one long entry to two smaller entries. 2) Read of poison list via the CXL mailbox. 3) Injection via the poison injection mailbox command (limited to 64 byte entries - spec constraint) 4) Clearing of poison injected via either method. The implementation is meant to be a valid combination of impdef choices based on what the spec allowed. There are a number of places where it could be made more sophisticated that we might consider in future: * Fusing adjacent poison entries if the types match. * Separate injection list and main poison list, to test out limits on injected poison list being smaller than the main list. * Poison list overflow event (needs event log support in general) * Connecting up to the poison list error record generation (rather complex and not needed for currently kernel handling testing). * Triggering the synchronous and asynchronous errors that occur on reads and writes of the memory when the host receives poison. As the kernel code is currently fairly simple, it is likely that the above does not yet matter but who knows what will turn up in future! Ira Weiny (1): bswap: Add the ability to store to an unaligned 24 bit field Jonathan Cameron (3): hw/cxl: QMP based poison injection support hw/cxl: Add poison injection via the mailbox. hw/cxl: Add clear poison mailbox command support. docs/devel/loads-stores.rst | 2 + qapi/cxl.json | 21 ++++ include/hw/cxl/cxl.h | 1 + include/hw/cxl/cxl_device.h | 21 ++++ include/qemu/bswap.h | 25 +++++ hw/cxl/cxl-mailbox-utils.c | 214 ++++++++++++++++++++++++++++++++++++ hw/mem/cxl_type3.c | 93 ++++++++++++++++ hw/mem/cxl_type3_stubs.c | 6 + 8 files changed, 383 insertions(+)