Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp3041276rwr; Fri, 21 Apr 2023 20:11:53 -0700 (PDT) X-Google-Smtp-Source: AKy350aZIJS4LUSaBIR/MOJb+SHC7YGkOaO0l1lG7WSnJIYyB1aHdc9kVrY6mOJb9vJtMS3dnSwC X-Received: by 2002:a17:90a:48:b0:249:64da:2f41 with SMTP id 8-20020a17090a004800b0024964da2f41mr5871132pjb.4.1682133112825; Fri, 21 Apr 2023 20:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682133112; cv=none; d=google.com; s=arc-20160816; b=hzDmWycL9v44svKe6vSE9Hj8fYO13eIAuCZbEBJgRpH9bu5xZAYTmo41xJDZ1wNen0 7tMLf6k+/H0SnNULbw4XG4NYId+lzwJJgEjg3AnmdWa8qrPvwbuCLUa+GAQ17EyIBY1Y W7oN52EL4ErdXzOY2F6exhV/JVLIORgerGxt9RrxsXEGHHLvdChPyw9qBPX16UipoReG yQoO+THmDldl2GKj35Zf7vVmG7D9DmXwShIm+om5t5/fwKBXnWDfJuFRBEtpUfnEYAHt 3h/URewzmwvbWATUYV9mL0lUhnltclEJENDTdHTDFFpq2N1mAnyFNplE8MMZEplwqM49 5qMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:dkim-signature; bh=I17WuBiJYp591ATnyAGMHFNXwlEj6jcpTB1jrJJiqRw=; b=n0aSJOrniqeZOLve48evpNWuLNPv4wMH9tovFfH5SUh46+cDTuiLkUyhQ+FSyLWQZp MZjB7D32WVjWpDHgSKktqvhn51c5I5uM+9Qgt16PYdfN2cH9Hdo9Wng+T9ljuX35Ahkb MNAiK8eiL2M+DSKa80yf7cYd4+EsFzJlLVJPR9ynogT0+3/dH+jpooO67tIYqydm3ECU Cg6xi3Olzi4yvM9xDBa/0mKPzDs5VIz+iN4wZY9/0sRzvigO5i9upGv3mHVDpWR0faTO ifimHA2kYFXPF48Qh/xKCIUrzadjvjQe4huSR5Ad1sG0+GGBQ+lXTufM24F1ahSc/o2x KwVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=A41eXh+n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 23-20020a17090a0a9700b0024b25bc9cc2si5732658pjw.50.2023.04.21.20.11.41; Fri, 21 Apr 2023 20:11:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=A41eXh+n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229704AbjDVDJi (ORCPT + 99 others); Fri, 21 Apr 2023 23:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbjDVDJg (ORCPT ); Fri, 21 Apr 2023 23:09:36 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B73F1FF7; Fri, 21 Apr 2023 20:09:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682132974; x=1713668974; h=from:subject:date:message-id:mime-version: content-transfer-encoding:to:cc; bh=6nXvMqoc0XfIWbY8flS/q6ajZvWZ0tjRB0xeWVdGp9E=; b=A41eXh+nu0aaXOCDSTXNqWn3f+pClXQDE2jVCJaD+ekOR+ynYFTtffwl fjYzncqu+zMd2u1P1lAD92JcnGCIv2CjDapZwcP5mR/uq+Lh8wJwdTcVM ouYu3092yUbhj3DtyKZu0xddyro/OFp5UhC6Z6G7OyMX2TO8z+vCN3sTr iZ3z4f8fyVFjlFLKhHg7fov59OvkK5QuZO3pIyEnSxhUFBJKVF4yJlSFO 9CyiOmfDBodGZTV7L8cY0a0+q8jQTPLa5ZazT7SNC6ZpQxqZijyXzvDbC xxWqFdicCs302RQ0WATVeASUuThWoEVZilbZtsmd3V0twQMTiwJpkd/BX Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10687"; a="343609052" X-IronPort-AV: E=Sophos;i="5.99,216,1677571200"; d="scan'208";a="343609052" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2023 20:09:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10687"; a="757092261" X-IronPort-AV: E=Sophos;i="5.99,216,1677571200"; d="scan'208";a="757092261" Received: from jwostman-mobl2.amr.corp.intel.com (HELO [192.168.1.200]) ([10.212.111.101]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2023 20:09:33 -0700 From: Vishal Verma Subject: [PATCH 0/4] cxl: Add a firmware update mechanism and cxl_test emulation Date: Fri, 21 Apr 2023 21:09:24 -0600 Message-Id: <20230421-vv-fw_update-v1-0-22468747d72f@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAORPQ2QC/x2N0QqDMAwAf0XyvEBbFdx+ZYyR2qgB6aTVThD/3 eDjHRx3QOYknOFVHZC4SJZfVLCPCvqJ4sgoQRmccbVpnMVScPh/tyXQytg+uW4pmGBsB5p4yow +UewnjeI2zyqXxIPs9+P9Oc8LrX2tanMAAAA= To: Alison Schofield , Ira Weiny , Dave Jiang , Ben Widawsky , Dan Williams Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso , Russ Weight , Vishal Verma X-Mailer: b4 0.13-dev-2eb1a X-Developer-Signature: v=1; a=openpgp-sha256; l=2391; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=6nXvMqoc0XfIWbY8flS/q6ajZvWZ0tjRB0xeWVdGp9E=; b=owGbwMvMwCXGf25diOft7jLG02pJDCnO/m9n7z+9+YtB2ILMKsMS/8xp3jvmxZWtnORzgZW9b GuikLBbRykLgxgXg6yYIsvfPR8Zj8ltz+cJTHCEmcPKBDKEgYtTACaiKMzwP6haz1Xnwh/xc0sX XDFQCHQ/77/6mpX44fZ8lv/P3E5sbGVkOFT3Q9Tmx7mt8gW+Rz75m1jOXrcu9LD1gg1yX467JAa rMAAA X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add firmware update capability to the CXL memdev driver, and emulation in cxl_test. Since the 'Transfer FW' mailbox command is a background command, this series depends on the initial background command support patches[1] from Davidlohr. These patches (patch 1 and 2) are included in this series, unchanged, for reference. Since the Transfer FW command can be a long-running background command, it is desirable to retain kernel control over it, so that one command doesn't monopolize the mailbox interface. The sysfs based firmware loader mechanism that was developed for FPGAs is a suitable candidate to help accomplish this. Patch 3 goes into more details on this. The poll interval for the Transfer FW command is arbitrarily set at 1 second, and a poll count of 300, giving us a total wait time of five minutes before which each slice of the transfer times out. This seems like a good mix of responsiveness and a total wait - the spec doesn't have any guidance on any upper or lower bounds for this. This likely does not need to be user-configurable, so for now it is just hard-coded in the driver. Patch 4 implements the emulation of firmware update related commands in the cxl_test environment to enable unit testing. [1]: https://lore.kernel.org/linux-cxl/20230421092321.12741-1-dave@stgolabs.net Signed-off-by: Vishal Verma --- Davidlohr Bueso (2): cxl/pci: Allocate irq vectors earlier in pci probe cxl/mbox: Add background cmd handling machinery Vishal Verma (2): cxl: add a firmware update mechanism using the sysfs firmware loader tools/testing/cxl: add firmware update emulation to CXL memdevs drivers/cxl/cxl.h | 7 + drivers/cxl/cxlmem.h | 84 +++++++++ drivers/cxl/core/mbox.c | 4 +- drivers/cxl/core/memdev.c | 324 ++++++++++++++++++++++++++++++++ drivers/cxl/pci.c | 112 ++++++++++- tools/testing/cxl/test/mem.c | 191 +++++++++++++++++++ Documentation/ABI/testing/sysfs-bus-cxl | 11 ++ drivers/cxl/Kconfig | 1 + 8 files changed, 728 insertions(+), 6 deletions(-) --- base-commit: 24b18197184ac39bb8566fb82c0bf788bcd0d45b change-id: 20230421-vv-fw_update-59e35ad0d018 Best regards, -- Vishal Verma