From patchwork Wed Jan 17 19:44:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13522136 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2075.outbound.protection.outlook.com [40.107.94.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43894249EC; Wed, 17 Jan 2024 19:45:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705520736; cv=fail; b=tqn0ELnvNezDZYTytmpehJu/MZoqyp9rL/1/3dodCjFIGylErfFY8utcd0qOdwUdI2JQlOk9zRVSK2D376WD11XQCcBG/If5ljsv8UGrwwaQH5ovSxyF6crW5863C49CcYvmokk/2eKbo5VGJDLKS0DPAj5Cpf2gEfMMT/LtpFI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705520736; c=relaxed/simple; bh=9zbJL1jK0e8ha2NrWg58pAE32faVkLyM56FnnKYwKfE=; h=ARC-Message-Signature:ARC-Authentication-Results:DKIM-Signature: Received:Received:X-MS-Exchange-Authentication-Results: Received-SPF:Received:Received:From:To:CC:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; b=YLuXO17Lug85Ga6HrNy2SBpJSmSuNT9Vlg/N3W0vWBOyB2irvnjyKdjCv1YFLphRSHFKcBilEZLSbLDkYkwEG33A3LPPMSkI4mAUz3r0T8EACaBn4fdinE47P2+KVsn1Sb4sXykWAnMMlmKeRvvDjD4BgfcZM6lrhMkHAPId3HM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=aralbiP4; arc=fail smtp.client-ip=40.107.94.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="aralbiP4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i0dLwmoNedrPui1qiXFg8AyehZ4vSzbthoi0jWR9zsWQGdQeKTAVJHn4eC3WkQcCuqD135DWr/LvOIXUNjU9GOmAHtvbfPO/spHaU22wDYeqm2flDtqJ/kdxLpouo3LtXjhqr9iB7p2BJP/xOetwHIviY87drbilCaVIMyuAjslWZY2XwsfVKfahZ1Z92lFZQELFfq/9STZZOWP4D6csAWi62fh9q+Hp4pikcEXAAPYa4GbVFgitfKu7pezhT2pTU+d+vn8VDkr2vhKTFH33AaHDuejAq3zYLTxKEkxGTmL6Uwi6z1A9kQxqHkE5qTFE9TH9J104Ugw3Nja71rTibw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LE1Nayuo6cmerUv2S5v/MoIHyvnDMrrJcnis/eL0ayE=; b=dsoPllTgWvLJyPmvg57MoE/0+I67mChrCINvOuC7yj9Yzbw9BWJp4BfaS07W9422euJNOir1ulxi+owwrv5LtwHurJYmHiVVUQ3Nh7cl9wW4Z+n0tixkv4fte/DpazHKUQpDURxdJBaJ1HOgmcLSUGwZp/koARlyVj1LWZESOZEqH9/6RFPYdzsYM582hewQdpkLcuBphJxXjNbFIHNp0Z6eHmbqRQdscLdxmweuKqOnJg7hos+t8R1bRHGv0BF+Gh2C8bUMVS+w+WW0/lRIV5KrMFObFFUDa1Hrm/9c0X7AQjh7LN4XsFQoBeSR/6jVPxSaWbeAb3lSE9aEa1xhJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LE1Nayuo6cmerUv2S5v/MoIHyvnDMrrJcnis/eL0ayE=; b=aralbiP4HM385RqU1jDCxUtLsUQCAZ1LWE8bKjjGCry/w0tvQuL2zzXHvxsxylzerKkKw0jIIHYHDRI4/W1iQBoXeR5bFHXUIK3jvC1QKBT2auRSE48DL6mp0lybleMt1tpTM6nZHFXV3rqH5KTq52jCi9jaHD0LHn/s0w97dqg= Received: from BL1PR13CA0287.namprd13.prod.outlook.com (2603:10b6:208:2bc::22) by DS0PR12MB7608.namprd12.prod.outlook.com (2603:10b6:8:13b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.21; Wed, 17 Jan 2024 19:45:32 +0000 Received: from BL02EPF0001A103.namprd05.prod.outlook.com (2603:10b6:208:2bc:cafe::ca) by BL1PR13CA0287.outlook.office365.com (2603:10b6:208:2bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.19 via Frontend Transport; Wed, 17 Jan 2024 19:45:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF0001A103.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Wed, 17 Jan 2024 19:45:32 +0000 Received: from bcheatha-HP-EliteBook-845-G8-Notebook-PC.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 17 Jan 2024 13:45:28 -0600 From: Ben Cheatham To: , , , , , , , CC: , , Subject: [PATCH v10 1/5] cxl, ACPI, APEI, EINJ: Add CXL_EINJ Kconfig option Date: Wed, 17 Jan 2024 13:44:57 -0600 Message-ID: <20240117194501.298233-2-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240117194501.298233-1-Benjamin.Cheatham@amd.com> References: <20240117194501.298233-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A103:EE_|DS0PR12MB7608:EE_ X-MS-Office365-Filtering-Correlation-Id: 43a16f29-32fc-4c81-433a-08dc1794ddc8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xbl8WgJy7ZM4Plm6LqmKTYgxagTQqlqxtp1EyP/uKXe1ZXXagRQusw7I7qUOPuybrei2BjNuP/aex+XD5PrlV8kkST4lEhEZYDY2ktR632s5qPvr0G8v+Gcr0X3qZ6JZeol1rhyBVElgPXXFZI4vBuHCndvyIvGrY4wstACmdjTYDes3QMmGKIYqmagChTTEDyPPhqRgE5KOzMpZsauy96ZADYd/u5OKSO5TBIanWzi+W1Ms+sDEZ8cnR4GYu1Dazx1VehCm27qsiD7jsRQipkABi691yIviQmvoveG2NOzXm+5KRyYalfWDCMc4AigkohSmr/uzKQtxjwLq5T08g2yjg6HkDrFn8emLhel9bYc1jld9gM23S3bt24A75MEGWZkFzgJ1U/Ulfwt5lnjG6pbI4Cww9iY5CSj3smd/JEI371WEA+dERY3iQK8WQZBzA+DiAT+ECQCjZ7dzUBXr0jQS2B/Vr+BnhLFx/bZEMjYhJNXLoU6Z13ErQfAwEaM3/8OuYetc0FGdUOpkNHvcvMObBlztMXGGiHUj+WqB+suxdlf2mupgbgrkfr4ABcy/WIy51ciVMgt4lloGfUnc/02BY3Nr89h3oT90c6wPZEpKMa4UmJTbuSVS2ScrL8dxWpTt/yJZ4pS0OscUlz3Y7lrGwtCkzBLptOhTOIr4tOBsV6aDwUfL+u7D86TrsC/oQ4b9oZys33+8khoR8OGKdB1ifHtXmg6v3qDE4AtLGkn735W3zO+AfnHqjZIjeSTA8k2wNL7fx9GbgklZSR4RfR9+H6rT4K+jMncNDN9FwXc= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(376002)(346002)(39860400002)(396003)(230922051799003)(1800799012)(64100799003)(186009)(451199024)(82310400011)(36840700001)(46966006)(40470700004)(40480700001)(4326008)(5660300002)(356005)(7416002)(40460700003)(81166007)(8936002)(110136005)(316002)(54906003)(70206006)(70586007)(8676002)(82740400003)(86362001)(7696005)(478600001)(2616005)(2906002)(6666004)(83380400001)(41300700001)(1076003)(426003)(26005)(36860700001)(336012)(36756003)(16526019)(47076005)(36900700001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2024 19:45:32.2786 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43a16f29-32fc-4c81-433a-08dc1794ddc8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A103.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7608 Add CONFIG_CXL_EINJ to cxl/Kconfig. This option will allow for the CXL core module to access helpers inside the EINJ module, while also giving users the option of disabling CXL EINJ error types at build time. Also update CONFIG_ACPI_APEI_EINJ to set CONFIG_CXL_EINJ by default. Signed-off-by: Ben Cheatham --- drivers/cxl/Kconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/cxl/Kconfig b/drivers/cxl/Kconfig index 67998dbd1d46..95f215a2e5dc 100644 --- a/drivers/cxl/Kconfig +++ b/drivers/cxl/Kconfig @@ -157,4 +157,16 @@ config CXL_PMU monitoring units and provide standard perf based interfaces. If unsure say 'm'. + +config CXL_EINJ + bool "CXL Error INJection Support" + default ACPI_APEI_EINJ + depends on ACPI_APEI_EINJ >= CXL_BUS + help + Support for CXL protocol Error INJection through debugfs/cxl. + Availability and which errors are supported is dependent on + the host platform. Look to ACPI v6.5 section 18.6.4 and kernel + EINJ documentation for more information. + + If unsure say 'n' endif From patchwork Wed Jan 17 19:44:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13522137 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2065.outbound.protection.outlook.com [40.107.92.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E33124219; Wed, 17 Jan 2024 19:45:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705520754; cv=fail; b=oMipmYkPNwCVzEtPW5Q5AyhBMQ1Tv59hilCasxAMWBU36eCTvUy+xx9ZUpWbxdcFpRlCJqz64MUPw4+aK+jVY4PxhBKkA37d5Xjuqo34rtvvGw1HvgCu6nD0xRjHCc2cVgszRUpIcxevj3C0mQSJrr708mayK3bX1aMbybU7BSo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705520754; c=relaxed/simple; bh=soZy5crzWsuERBdLHCgPVMSaOmu+Ubr1ojVwt3f4jIY=; h=ARC-Message-Signature:ARC-Authentication-Results:DKIM-Signature: Received:Received:X-MS-Exchange-Authentication-Results: Received-SPF:Received:Received:From:To:CC:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; b=WJZ007h8VNhQP3PwGkmrEwrE9DYRvwtyJb5fFoc454xJk1GlCQJ2CfajqECLihGLElkCglq3BAqNFcVtxM9g/jEwh71NUsdHX9wpcqWa4nxgdLZBTB6t91QZD5NggVF0/tcPdat3wn/HLVqXWFRO9bHsAG2wRy/3RbvnEXK5mnI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=b/SKotK9; arc=fail smtp.client-ip=40.107.92.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="b/SKotK9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j8BptS/iFnbhDrpwtVFTib1ShwbM3+IlYIJMiOBCVNi2P3zGp8h9aZB/x77uqffdPQZJF40d2HfbMJS6u1ecR3K6yV1h42XrGkbQG2biyIiC1+FoUH211ChLnqJg7n5YAcRD77zSTCbjjxstI3hSfQLZFci9J8Ghix6QjnpaePsmqbBeBe9O12QZRR+4uxIeVSYggevbD5ccVJ4V5Wu5vBiWlu5blaIvKB7eRxhtPpGspyoTUjerHdH5ZIPm25fDeCPIctR7U5bBtB81Cl/f/jLBmQHUb5DWT+a32KU0BMxHq+POZEM/HeN4Wghk1JPUeuxeEyRlHfXrfOZ649b59A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1kzjgVKOBXPLOd9x0CGGBOaqaprj3QY2UgevqnYifa4=; b=Cv+HTXjA96bXFLHngD4Bx4b01/eNXD7BQTX31kdAMD2HQwiD/qrooHIGatLlWcgnvPYo/gj468wA7fcmuuiCtJzwjsUT3zHYAVBPjGdxJVffPII9kjQgXt8KoPd9fDJGJLqjWYYgIshjoPDdzOh4/b/6jgWXvhMMGRCOc7eiZFKI/2EjtrTj0VQBvIWcv8SqlAulyYXIP7YU1SORp5ldmpL+lQr7Yd9JU0t9p/uGH9+ZQo0Bvx/BamPSqhdCoxOcQiuAfHqs5XXGQCAOpFOoSGAfQPg4K1KNREA6pF7mSAeSAQFV52Gn3AhkO1lLp0dH9IY5VALf0NGXImKjYy6ADw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1kzjgVKOBXPLOd9x0CGGBOaqaprj3QY2UgevqnYifa4=; b=b/SKotK9zISxn+P3lE4DqU53LOruBbYXE42R7yRjn9V0I1IiU+fQ9PdQyQ9YYcAWHDbNI24JN0mWCBP5yV6XeuP6fO9s+OOIHDLeBlirsB78DCn5e/cEAjjwsNufqKVlrCAD/MMojlfHeMYXr0YQsmHIPkyv0TtHh2VLcsBpZds= Received: from BL1P221CA0007.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::33) by DS0PR12MB7876.namprd12.prod.outlook.com (2603:10b6:8:148::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.18; Wed, 17 Jan 2024 19:45:50 +0000 Received: from BL02EPF0001A105.namprd05.prod.outlook.com (2603:10b6:208:2c5:cafe::e1) by BL1P221CA0007.outlook.office365.com (2603:10b6:208:2c5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.23 via Frontend Transport; Wed, 17 Jan 2024 19:45:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF0001A105.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Wed, 17 Jan 2024 19:45:50 +0000 Received: from bcheatha-HP-EliteBook-845-G8-Notebook-PC.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 17 Jan 2024 13:45:45 -0600 From: Ben Cheatham To: , , , , , , , CC: , , Subject: [PATCH v10 2/5] ACPI: Add CXL protocol error defines Date: Wed, 17 Jan 2024 13:44:58 -0600 Message-ID: <20240117194501.298233-3-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240117194501.298233-1-Benjamin.Cheatham@amd.com> References: <20240117194501.298233-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A105:EE_|DS0PR12MB7876:EE_ X-MS-Office365-Filtering-Correlation-Id: 64d04676-5c88-4410-fa58-08dc1794e885 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xEbqVMEvTf5sntuqn5gSTe0Pd97IOP6yVhKmTZ2kq27hil+UxUR03gjSAX98gycqnUS2rAL/jtBPvp/4ilfUKfz5iOztK9hFy10OMPKml0Ygdlml6d9/6asR2onZYQS/UCAZmSa5fWojBFiLptnHMP/hYa9BkZV8FQauYUshYWfJxEAMeS62I/r4wRKeJC4px0q4QjfvXPdq2PeSxM1IM3nvzeQC89uLvT3km+3moYWDnLw0zb/bLqMDtnjCQfhhippzjUz9L+F/sJars50RB/a1oIR/oJYUzxiXOJdbbzd6kbnA4P+/wwnEuV98aywFT0RsM8XXhQ0+Ntq6ScCJc9Tgdf24FM386kN8L6RWnpX8r50qKwGCq6vDO1whQFwvcHYshIzxvpE4e1KR0GXMOMYN2X53ZXtE0Nu9bGA8NhMyi8v/n6KoaCJiwonhhU+TnVT7uay1wEpN6qJDc1yNSJL+GNdvnIFBweXyui5ASUy/TffSUrNJdUGn/cUwMUBzFdgEe/NFUDDcs1Y2ulZgC6m63rvAgxzBIfkkd6N6if3DojigFyS3Ci6ou0uWO14Bgp5oJsQlUGA+E7cblM5YpNJl6Du68JXVQ0+Uxk/ONxmMR6txktPfxdNc6E0OK5tpsqvWd/DJsycbcyCbtvy2El81Oy/Vlm9FsgQ6bfgba4lEZLN5TfbiUin4rgPaBbY/kybTo99n0Fm/lMa0Err8CCRFyAXSEO4uTF9LiWvgmQv46fvr51wUlK3ENqDRt55XwU2AxtNyvtLTNXDouS6LGK1mvoOdc1GdrueYBb/khwA= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(376002)(396003)(39860400002)(346002)(230922051799003)(64100799003)(1800799012)(451199024)(186009)(82310400011)(46966006)(36840700001)(40470700004)(2616005)(40460700003)(40480700001)(478600001)(426003)(16526019)(6666004)(82740400003)(83380400001)(336012)(7696005)(26005)(1076003)(356005)(36756003)(5660300002)(81166007)(2906002)(41300700001)(4326008)(7416002)(966005)(47076005)(36860700001)(8676002)(70206006)(86362001)(110136005)(70586007)(54906003)(316002)(8936002)(2101003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2024 19:45:50.2992 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64d04676-5c88-4410-fa58-08dc1794e885 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A105.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7876 Add CXL protocol error defines to include/actbl1.h. Signed-off-by: Ben Cheatham --- I made a pull request for this support in the ACPICA project which has been accepted (link below), so this patch is temporary and I expect it to be dropped once the kernel updates from ACPICA. [1]: Link: https://github.com/acpica/acpica/pull/884 Signed-off-by: Ben Cheatham --- include/acpi/actbl1.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index a33375e055ad..1f58c5d86869 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -1096,6 +1096,12 @@ enum acpi_einj_command_status { #define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9) #define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10) #define ACPI_EINJ_PLATFORM_FATAL (1<<11) +#define ACPI_EINJ_CXL_CACHE_CORRECTABLE (1<<12) +#define ACPI_EINJ_CXL_CACHE_UNCORRECTABLE (1<<13) +#define ACPI_EINJ_CXL_CACHE_FATAL (1<<14) +#define ACPI_EINJ_CXL_MEM_CORRECTABLE (1<<15) +#define ACPI_EINJ_CXL_MEM_UNCORRECTABLE (1<<16) +#define ACPI_EINJ_CXL_MEM_FATAL (1<<17) #define ACPI_EINJ_VENDOR_DEFINED (1<<31) /******************************************************************************* From patchwork Wed Jan 17 19:44:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13522138 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2068.outbound.protection.outlook.com [40.107.93.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAEEA22EE2; Wed, 17 Jan 2024 19:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705520772; cv=fail; b=nMYBgoqPO8u2GVpBx9rdCzrLzOcQroKyLZoMR+9USuoiZqZTqs5VeyuthVw7Ka7S0OEYgBhQJP6kCyLDczrEt86t44Vfoi8qDgOMK5DHo/TQVsM5G2LjmRGnXunCrX/1GuNOFjLigS7nhwreu6MallBpdeK/Y6nENTX8/X9idqw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705520772; c=relaxed/simple; bh=7ZRZC+tpGUvS41uE7ALwvyFXZ18Bwbz4IJzaqFIHdOE=; h=ARC-Message-Signature:ARC-Authentication-Results:DKIM-Signature: Received:Received:X-MS-Exchange-Authentication-Results: Received-SPF:Received:Received:From:To:CC:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; b=f+rDHtQfF2u/8FOVkPb1NRs5xR9iap8qmwbzUJJzeUDOa3BBydUBabiHlfmAvBqUyQgTn3NcypOoQhit8gtuTGRFBj8A3u0WBnOgW9R4lxWCmgPR7ah+JHotYYC2eYNthqKpPQiqX3MIRIsck6536zCqTHErYcQ51VRgY4rBxqk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=afBybLZe; arc=fail smtp.client-ip=40.107.93.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="afBybLZe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k7wSci2GGJeHwe1iz8BPKeqPBUKUV1bNKryx+xbBQN3GyQgPb12rDwUjwje/l5ulkyXDxaTDfjQyxfmfsjf2/vWFAbNZu/f3IsDm7thr18tEykL9NA7WPZbwkdGYq+EkcHufYFv1Xig4Pv/B7ZDK3ZuhsLIerXHQyAEq5zOdX0P/Egw6jHQT6h5JZXjn1Tp2T7n9ojenAnUxnafmrJazXrFAPf2D3dOXWVC02SgO3WR75/2cm+vqtlsDKF65ojjzmnU7j2brTdBVyCzGfM8dLidrAnC1WwUmr8Kv4Jes8esu/2HcHUYoBSN6UCh9Xy6DL9I9qIdQG9PvFw54EqMCYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fV4Ih4fAFHU0BmhY/boSFebhMyv3kTOUahUSqKGm/HI=; b=oRPEcvtmEgAkL+PmMJIdKLCi5jv830XVe8p6iatJQqshVdGg4hdpbQrdvmbMsBe/KRMtE3XVjeAyzcSVEgGKVY8PZbbar09kLNJuK5lrOxkYlVZp6uRNYO8y6RnpWbhn0a6CtnAlYrGxX+ura1Kjo6GgZ6Pa9JqpfxbB/QY+YaCm+zYHWmHIDYR+Ubzk6Eqq3WNDfe+sNpHQDyHE0Vh4n0/DoHqAkOLXfPBMIhUlvFrlCVYYG5RWYOvf0Qw69qpOSgqa75yNoNSTsDv7boSiRyExL2p/BIJXXsEaMvrKigPm31fRlQ/NZMojefBZgD8g+UrXhwKPGHoEacTKMFjB7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fV4Ih4fAFHU0BmhY/boSFebhMyv3kTOUahUSqKGm/HI=; b=afBybLZeEYWVPDtLlyacWCKHvkTzjhObcZun1q22hNrbB7NlxH1E1WqVF3GXbnsGwwQw6NWGi35+CSaE8+bWkKJBKzgFgvYT4WaooJHDNV5nyfshaUeDtc2kB7QvG3CV8WwI72eGZdQHguFkqxTfF/FK39bzqjYWGtDWf5Cp4nc= Received: from BLAPR03CA0023.namprd03.prod.outlook.com (2603:10b6:208:32b::28) by SJ1PR12MB6219.namprd12.prod.outlook.com (2603:10b6:a03:456::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.26; Wed, 17 Jan 2024 19:46:06 +0000 Received: from BL02EPF0001A102.namprd05.prod.outlook.com (2603:10b6:208:32b:cafe::81) by BLAPR03CA0023.outlook.office365.com (2603:10b6:208:32b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24 via Frontend Transport; Wed, 17 Jan 2024 19:46:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF0001A102.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Wed, 17 Jan 2024 19:46:05 +0000 Received: from bcheatha-HP-EliteBook-845-G8-Notebook-PC.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 17 Jan 2024 13:46:03 -0600 From: Ben Cheatham To: , , , , , , , CC: , , Subject: [PATCH v10 3/5] EINJ: Migrate to a platform driver Date: Wed, 17 Jan 2024 13:44:59 -0600 Message-ID: <20240117194501.298233-4-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240117194501.298233-1-Benjamin.Cheatham@amd.com> References: <20240117194501.298233-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A102:EE_|SJ1PR12MB6219:EE_ X-MS-Office365-Filtering-Correlation-Id: 57d53c8f-645c-4d79-8a52-08dc1794f1bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rsMdAktbLsk20p8BUAc4XyApK7+yxFdksAkU6cpJIztdg9OuMyMgJ2YRZ2EQvG1qp7uhdPCFVyvmsX6bMloq119JX7d9FuXVoiuIkfLw9i84UNjkUOftltJQ5iIB24+8/B8pfkPKhf27PwCadWjerzwygipEEFyUesDqHbb8hNQG/pfa+ggs5yB7tBqceFC1j+ipYuvqulEcFqKLzGzQtBHaIAi4+lPr9K1siuj2+CRec44KvMXvZGHU7JqGz+OFlPkycpuIb7T1RnP9INJZvFiOtwi6XA2qaVBGj1P/qVUtjXQrv5oYt9LsePG0Q6T55kaI3GLAIiNfHPvyohqD6/d5xJsplSbil4wTTmr6ZfJGaA1Uu4TI/Y7mEzin2qfDdO8PmjYz8XiMcPpd+SJXSv2dUBtKPn+Nso8DHfgZgnoNxuc0d92GiwPrN5vgcNOReqMMU8xTOO76/m0ZkLBpVvYo5H7nRYQGDQcDzXfb2HoK6C92kgzCH/PQSiJGDMo3tSflg9+K+CcM4Bz/SB7fkJJjrLA77lJQBGFWtSykconGrd4YQChUliQ/3Orx4cwWsd7MWUD7JTI2fYWkcRXeGpG1hiDzbIkAcsnL9DMo59gTKQORtgLZXlz+OOE2AkF12vqpxn/uFbtOlnYNs2jGK+U7+6OVKSfZzIHmf0B3RcZc5Ul9PMpc5Ps+V/LIxvTttIE1o5jYJ73ashHUmDPPwh+lQ+GJvvtaN0OpqmsO4M6+2ekiv2NxJjVxtgPtoNeP3G8VM4JYVTJcZntkDhkM9atE2GZsxijWUbgW+059cPBLOzSkyl31S3MZbb/uP2nlALmqGHVEmwTI8nSNUM/pfg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(136003)(346002)(376002)(230173577357003)(230273577357003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(82310400011)(40470700004)(36840700001)(46966006)(40480700001)(40460700003)(16526019)(6666004)(7696005)(426003)(1076003)(26005)(2616005)(336012)(86362001)(82740400003)(36756003)(81166007)(356005)(83380400001)(36860700001)(7416002)(5660300002)(2906002)(47076005)(478600001)(41300700001)(54906003)(4326008)(110136005)(8936002)(70586007)(8676002)(316002)(70206006)(2101003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2024 19:46:05.7562 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57d53c8f-645c-4d79-8a52-08dc1794f1bc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A102.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6219 Change the EINJ module to install a platform device/driver on module init and move the module init() and exit() functions to driver probe and remove. This change allows the EINJ module to load regardless of whether setting up EINJ succeeds, which allows dependent modules to still load (i.e. the CXL core). Since EINJ may no longer be initialized when the module loads, any functions that are called from dependent/external modules should check the einj_initialized variable before calling any EINJ functions. Signed-off-by: Ben Cheatham --- drivers/acpi/apei/einj.c | 44 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 013eb621dc92..73dde21d3e89 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "apei-internal.h" @@ -136,6 +137,11 @@ static struct apei_exec_ins_type einj_ins_type[] = { */ static DEFINE_MUTEX(einj_mutex); +/* + * Exported APIs use this flag to exit early if einj_probe() failed. + */ +static bool einj_initialized __ro_after_init; + static void *einj_param; static void einj_exec_ctx_init(struct apei_exec_context *ctx) @@ -684,7 +690,7 @@ static int einj_check_table(struct acpi_table_einj *einj_tab) return 0; } -static int __init einj_init(void) +static int __init einj_probe(struct platform_device *pdev) { int rc; acpi_status status; @@ -782,7 +788,7 @@ static int __init einj_init(void) return rc; } -static void __exit einj_exit(void) +static void __exit einj_remove(struct platform_device *pdev) { struct apei_exec_context ctx; @@ -801,6 +807,40 @@ static void __exit einj_exit(void) acpi_put_table((struct acpi_table_header *)einj_tab); } +static struct platform_device *einj_dev; +struct platform_driver einj_driver = { + .remove_new = einj_remove, + .driver = { + .name = "acpi-einj", + }, +}; + +static int __init einj_init(void) +{ + struct platform_device_info einj_dev_info = { + .name = "acpi-einj", + .id = -1, + }; + int rc; + + einj_dev = platform_device_register_full(&einj_dev_info); + if (IS_ERR_OR_NULL(einj_dev)) + return PTR_ERR(einj_dev); + + rc = platform_driver_probe(&einj_driver, einj_probe); + einj_initialized = rc == 0; + + return 0; +} + +static void __exit einj_exit(void) +{ + if (einj_initialized) + platform_driver_unregister(&einj_driver); + + platform_device_del(einj_dev); +} + module_init(einj_init); module_exit(einj_exit); From patchwork Wed Jan 17 19:45:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13522139 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2044.outbound.protection.outlook.com [40.107.223.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 726AF22EE2; Wed, 17 Jan 2024 19:46:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705520790; cv=fail; b=DP75TUXQqWq3xlzu2SMz04H25aFKMxk9cV4ilNfMxI62H8Iy5i4QnWF1TCLAlQNsv4PEAM7v0UWXeBVUvB0RybsuW9TgdrQytEeiN2tXl0K6q6N60vwp0bP6ky32VFrzBoMZPY6px6kd9XgEmQKcig9Os/OLKzxpzKeH3SrMuH8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705520790; c=relaxed/simple; bh=ohZVRS47fpDD+LvOcOchaN7BUZ4GiPZXi01299lRzDE=; h=ARC-Message-Signature:ARC-Authentication-Results:DKIM-Signature: Received:Received:X-MS-Exchange-Authentication-Results: Received-SPF:Received:Received:From:To:CC:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; b=YixDvIFLLTPeN8EEEKIwIylitQ0dUi8QHCNk8n2g2Hd54yGk4B/D27d8cZJgX2Fwi0v7Yk0H6MW87ik43bXSLALI25/8tZj6A3/TjvpgcGWkrjgNbi74UvdLpwCdfErl3mhjp+1rAyFnbS75jLUUmxf7geUqB0uUwenSN4s8/ng= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=XDjdjKoo; arc=fail smtp.client-ip=40.107.223.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="XDjdjKoo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M33gsv7oq+2Rsc5faxw3oFTtyU4f75i+mDX7Rl006DbgqiUr0qiqSU4Tyq6pWjM1fSaKYDpY46Lh6WxYNY27wgk6fbi3yFNm0yTOUSQ89jPMPQd8nK7SrCslK2HFA5cL+x+Di5cYKlzrexaZ0sad6tGsFRA768pVyqsM0uKLgI+rZOk9xZKZ2nLzr76iJYFYWHqDkff5SABgx84p0WD80yPNH+uThdtTn3PEg+7BC0o/vfZUCfgn74/ua2RKgCkeYFM3Mio7v+sHq57yurDTc6v5QdUuQsBzQNtcWD4tC736kHuKocZlyab5RjVH8l68+oD8ZxGKEbD5b7cCzLnnlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PenidkGxwhKWH5THddEzYVrwtn46WPVm2AMyFwq5Mrk=; b=c7IRerbASu4JcXeUsjhHXUaMT2q37lL7oAnG48sZJ6Hlh92EYrVc/F7vVadZyv4/V/K2gaGQsaTgQChM7as7oarc26E+7Sr1NDFOt8AnBbtV6XgPIQNpL6dsneUeY97Jkjf3yEYhgH+HidCnp62V+zmibJTwyOK5hZbwyMX40n+sLnS3XHe0CM40z0p/yxMVa1KMYgA7PDhiTVx6O9gTCDJCm8TuUP1GZc2UIJiMf97G7BJYDSihXSfJQIsdBoFKP8XpRdMAtoOTL7efFpqfIScqHq+sF0EjZzHJyPm/XwW/fG3MDS6Whpn7zYzXggiYRj3dpljYrE+4mxf45kufqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PenidkGxwhKWH5THddEzYVrwtn46WPVm2AMyFwq5Mrk=; b=XDjdjKoosrUNoCNPtmAaY3FcezpB2bchRRgKqeObM9ZItkO++6wGubqspyW2zaOBFpICYtMRq7kySYFXWjcftZrGVtqKd/kUFACjMzKmfl08VHuxCxZmlcOBTXfA3qJBzluNVoRFasP2qPu/Hq0KS8+zUscOrfgXmtOnVpNIu8M= Received: from BLAPR03CA0004.namprd03.prod.outlook.com (2603:10b6:208:32b::9) by PH8PR12MB8429.namprd12.prod.outlook.com (2603:10b6:510:258::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.30; Wed, 17 Jan 2024 19:46:26 +0000 Received: from BL02EPF0001A102.namprd05.prod.outlook.com (2603:10b6:208:32b:cafe::ef) by BLAPR03CA0004.outlook.office365.com (2603:10b6:208:32b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24 via Frontend Transport; Wed, 17 Jan 2024 19:46:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF0001A102.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Wed, 17 Jan 2024 19:46:25 +0000 Received: from bcheatha-HP-EliteBook-845-G8-Notebook-PC.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 17 Jan 2024 13:46:23 -0600 From: Ben Cheatham To: , , , , , , , CC: , , Subject: [PATCH v10 4/5] cxl/core, EINJ: Add EINJ CXL debugfs files and EINJ helper functions Date: Wed, 17 Jan 2024 13:45:00 -0600 Message-ID: <20240117194501.298233-5-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240117194501.298233-1-Benjamin.Cheatham@amd.com> References: <20240117194501.298233-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A102:EE_|PH8PR12MB8429:EE_ X-MS-Office365-Filtering-Correlation-Id: c544db13-d7b3-48f1-2418-08dc1794fd6f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CRee/Kcf/Fyjibi7Ym7w3I8ccP7p66PTFKDrBnlW602bWoZT0bJBguP008pgVH4IpSf+yghX+ZkDRuk4guPZ78aF/jvR763M+vMHig7gWtktpBntBcZnlzbLkn8LE++jDQnwptGH9WKXMOiF9FM212jzwt946mgAC5MEKujj1j79hisA0OKQkdAIlRrqO5UCx4quFatfF+8R8QKCPYNw37nqkxw7TQG6rqxsEnK2pRGj7QRjFzaEtFAmyIMnSflfL8Cc8kAG8Lu+op8NnvtTSe6sDas/3R2L68AYwGjYeBdfUauRb2hwZf7O8U1DI1tIkVM85wro2tVKHHiSToZXRwX4C6hT4CNA8AFgqtIoLA5lrq+M3meQIC82xTN44oMktLeJkXNoqkTfzf4u5Kj50FSnhNh7iriIIcJKPTDXrJlCUWYnBSivLEWNDS2mkF+ck9WG5V+wNT8zpF6EdUSAcgT3VrY82PiR3G0d/VqCsVRQrHtqYBTtYfLv3QgPbiKM63b1IfcGsW1HEsTcVyXywd7tz4+Br7UwkdIbH4oXXYehkmXgvSbc7bAX/MfFgsqssr/yADiX8dozPJTVD9V4phzSATSGk0JOsl+QGOiP/qTbRE4ka/23VQnu4wIpVv7vG89Ul2/IN15IDRn/C9gRsZ1wyX88Ml/kTI04yMKxvoCEO5pI7omQzI0cmJGs6dK6xxLOO2L+eZi+XiOrJCLjZqnu207DN73yiJXYd5XMmgq0GHFUK+U8lzOt3eglHdxWx/GDIs3BmgCW7tT4MlvOghOFYoM/QvQexn3cweZlzBk= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(39860400002)(376002)(396003)(346002)(230922051799003)(82310400011)(64100799003)(186009)(451199024)(1800799012)(36840700001)(40470700004)(46966006)(40460700003)(40480700001)(16526019)(336012)(426003)(83380400001)(2616005)(36756003)(47076005)(26005)(1076003)(82740400003)(86362001)(356005)(81166007)(41300700001)(8676002)(5660300002)(110136005)(7416002)(54906003)(4326008)(6666004)(7696005)(36860700001)(30864003)(70206006)(316002)(2906002)(8936002)(478600001)(70586007)(36900700001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2024 19:46:25.3817 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c544db13-d7b3-48f1-2418-08dc1794fd6f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A102.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB8429 Implement CXL helper functions in the EINJ module for getting/injecting available CXL protocol error types and export them to sysfs under kernel/debug/cxl. The kernel/debug/cxl/einj_types file will print the available CXL protocol errors in the same format as the available_error_types file provided by the EINJ module. The kernel/debug/cxl/$dport_dev/einj_inject is functionally the same as the error_type and error_inject files provided by the EINJ module, i.e.: writing an error type into $dport_dev/einj_inject will inject said error type into the CXL dport represented by $dport_dev. Signed-off-by: Ben Cheatham --- Documentation/ABI/testing/debugfs-cxl | 22 ++++ MAINTAINERS | 1 + drivers/acpi/apei/einj.c | 150 ++++++++++++++++++++++++-- drivers/cxl/core/port.c | 39 +++++++ include/linux/einj-cxl.h | 45 ++++++++ 5 files changed, 247 insertions(+), 10 deletions(-) create mode 100644 include/linux/einj-cxl.h diff --git a/Documentation/ABI/testing/debugfs-cxl b/Documentation/ABI/testing/debugfs-cxl index fe61d372e3fa..bcd985cca66a 100644 --- a/Documentation/ABI/testing/debugfs-cxl +++ b/Documentation/ABI/testing/debugfs-cxl @@ -33,3 +33,25 @@ Description: device cannot clear poison from the address, -ENXIO is returned. The clear_poison attribute is only visible for devices supporting the capability. + +What: /sys/kernel/debug/cxl/einj_types +Date: January, 2024 +KernelVersion: v6.9 +Contact: linux-cxl@vger.kernel.org +Description: + (RO) Prints the CXL protocol error types made available by + the platform in the format "0x ". + The can be written to einj_inject to inject + into a chosen dport. + +What: /sys/kernel/debug/cxl/$dport_dev/einj_inject +Date: January, 2024 +KernelVersion: v6.9 +Contact: linux-cxl@vger.kernel.org +Description: + (WO) Writing an integer to this file injects the corresponding + CXL protocol error into $dport_dev ($dport_dev will be a device + name from /sys/bus/pci/devices). The integer to type mapping for + injection can be found by reading from einj_types. If the dport + was enumerated in RCH mode, a CXL 1.1 error is injected, otherwise + a CXL 2.0 error is injected. diff --git a/MAINTAINERS b/MAINTAINERS index 9104430e148e..02d7feb2ed1f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5246,6 +5246,7 @@ L: linux-cxl@vger.kernel.org S: Maintained F: drivers/cxl/ F: include/uapi/linux/cxl_mem.h +F: include/linux/einj-cxl.h F: tools/testing/cxl/ COMPUTE EXPRESS LINK PMU (CPMU) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 73dde21d3e89..0337fff336f9 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -37,6 +38,12 @@ #define MEM_ERROR_MASK (ACPI_EINJ_MEMORY_CORRECTABLE | \ ACPI_EINJ_MEMORY_UNCORRECTABLE | \ ACPI_EINJ_MEMORY_FATAL) +#define CXL_ERROR_MASK (ACPI_EINJ_CXL_CACHE_CORRECTABLE | \ + ACPI_EINJ_CXL_CACHE_UNCORRECTABLE | \ + ACPI_EINJ_CXL_CACHE_FATAL | \ + ACPI_EINJ_CXL_MEM_CORRECTABLE | \ + ACPI_EINJ_CXL_MEM_UNCORRECTABLE | \ + ACPI_EINJ_CXL_MEM_FATAL) /* * ACPI version 5 provides a SET_ERROR_TYPE_WITH_ADDRESS action. @@ -543,8 +550,11 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, if (type & ACPI5_VENDOR_BIT) { if (vendor_flags != SETWA_FLAGS_MEM) goto inject; - } else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM)) + } else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM)) { goto inject; + } else if ((type & CXL_ERROR_MASK) && (flags & SETWA_FLAGS_MEM)) { + goto inject; + } /* * Disallow crazy address masks that give BIOS leeway to pick @@ -596,6 +606,9 @@ static const char * const einj_error_type_string[] = { "0x00000200\tPlatform Correctable\n", "0x00000400\tPlatform Uncorrectable non-fatal\n", "0x00000800\tPlatform Uncorrectable fatal\n", +}; + +static const char * const einj_cxl_error_type_string[] = { "0x00001000\tCXL.cache Protocol Correctable\n", "0x00002000\tCXL.cache Protocol Uncorrectable non-fatal\n", "0x00004000\tCXL.cache Protocol Uncorrectable fatal\n", @@ -621,29 +634,44 @@ static int available_error_type_show(struct seq_file *m, void *v) DEFINE_SHOW_ATTRIBUTE(available_error_type); -static int error_type_get(void *data, u64 *val) +int einj_cxl_available_error_type_show(struct seq_file *m, void *v) { - *val = error_type; + int cxl_err, rc; + u32 available_error_type = 0; + + if (!einj_initialized) + return -ENXIO; + + rc = einj_get_available_error_type(&available_error_type); + if (rc) + return rc; + + for (int pos = 0; pos < ARRAY_SIZE(einj_cxl_error_type_string); pos++) { + cxl_err = ACPI_EINJ_CXL_CACHE_CORRECTABLE << pos; + + if (available_error_type & cxl_err) + seq_puts(m, einj_cxl_error_type_string[pos]); + } return 0; } +EXPORT_SYMBOL_NS_GPL(einj_cxl_available_error_type_show, CXL); -static int error_type_set(void *data, u64 val) +static int validate_error_type(u64 type) { + u32 tval, vendor, available_error_type = 0; int rc; - u32 available_error_type = 0; - u32 tval, vendor; /* Only low 32 bits for error type are valid */ - if (val & GENMASK_ULL(63, 32)) + if (type & GENMASK_ULL(63, 32)) return -EINVAL; /* * Vendor defined types have 0x80000000 bit set, and * are not enumerated by ACPI_EINJ_GET_ERROR_TYPE */ - vendor = val & ACPI5_VENDOR_BIT; - tval = val & 0x7fffffff; + vendor = type & ACPI5_VENDOR_BIT; + tval = type & 0x7fffffff; /* Only one error type can be specified */ if (tval & (tval - 1)) @@ -652,9 +680,105 @@ static int error_type_set(void *data, u64 val) rc = einj_get_available_error_type(&available_error_type); if (rc) return rc; - if (!(val & available_error_type)) + if (!(type & available_error_type)) return -EINVAL; } + + return 0; +} + +static int cxl_dport_get_sbdf(struct pci_dev *dport_dev, u64 *sbdf) +{ + struct pci_bus *pbus; + struct pci_host_bridge *bridge; + u64 seg = 0, bus; + + pbus = dport_dev->bus; + bridge = pci_find_host_bridge(pbus); + + if (!bridge) + return -ENODEV; + + if (bridge->domain_nr != PCI_DOMAIN_NR_NOT_SET) + seg = bridge->domain_nr << 24; + + bus = pbus->number << 16; + *sbdf = seg | bus | dport_dev->devfn; + + return 0; +} + +int einj_cxl_inject_rch_error(u64 rcrb, u64 type) +{ + u64 param1 = 0, param2 = 0, param4 = 0; + u32 flags; + int rc; + + if (!einj_initialized) + return -ENXIO; + + /* Only CXL error types can be specified */ + if (type & ~CXL_ERROR_MASK || (type & ACPI5_VENDOR_BIT)) + return -EINVAL; + + rc = validate_error_type(type); + if (rc) + return rc; + + param1 = (u64) rcrb; + param2 = 0xfffffffffffff000; + flags = 0x2; + + return einj_error_inject(type, flags, param1, param2, 0, param4); +} +EXPORT_SYMBOL_NS_GPL(einj_cxl_inject_rch_error, CXL); + +int einj_cxl_inject_error(struct pci_dev *dport, u64 type) +{ + u64 param1 = 0, param2 = 0, param4 = 0; + u32 flags; + int rc; + + if (!einj_initialized) + return -ENXIO; + + /* Only CXL error types can be specified */ + if (type & ~CXL_ERROR_MASK || (type & ACPI5_VENDOR_BIT)) + return -EINVAL; + + rc = validate_error_type(type); + if (rc) + return rc; + + rc = cxl_dport_get_sbdf(dport, ¶m4); + if (rc) + return rc; + + flags = 0x4; + + return einj_error_inject(type, flags, param1, param2, 0, param4); +} +EXPORT_SYMBOL_NS_GPL(einj_cxl_inject_error, CXL); + +static int error_type_get(void *data, u64 *val) +{ + *val = error_type; + + return 0; +} + +static int error_type_set(void *data, u64 val) +{ + int rc; + + /* CXL error types have to be injected from cxl debugfs */ + if (val & CXL_ERROR_MASK && !(val & ACPI5_VENDOR_BIT)) + return -EINVAL; + + rc = validate_error_type(val); + if (rc) + return rc; + error_type = val; return 0; @@ -690,6 +814,12 @@ static int einj_check_table(struct acpi_table_einj *einj_tab) return 0; } +bool einj_is_initialized(void) +{ + return einj_initialized; +} +EXPORT_SYMBOL_GPL(einj_is_initialized); + static int __init einj_probe(struct platform_device *pdev) { int rc; diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 8c00fd6be730..c52c92222be5 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -797,6 +798,37 @@ static int cxl_dport_setup_regs(struct device *host, struct cxl_dport *dport, return rc; } +DEFINE_SHOW_ATTRIBUTE(einj_cxl_available_error_type); + +static int cxl_einj_inject(void *data, u64 type) +{ + struct cxl_dport *dport = data; + + if (dport->rch) + return einj_cxl_inject_rch_error(dport->rcrb.base, type); + + return einj_cxl_inject_error(to_pci_dev(dport->dport_dev), type); +} +DEFINE_DEBUGFS_ATTRIBUTE(cxl_einj_inject_fops, NULL, cxl_einj_inject, "%llx\n"); + +static void cxl_debugfs_create_dport_dir(struct cxl_dport *dport) +{ + struct dentry *dir; + + /* + * dport_dev needs to be a PCIe port for CXL 2.0+ ports because + * EINJ expects a dport SBDF to be specified for 2.0 error injection. + */ + if (!einj_is_initialized() || + (!dport->rch && !dev_is_pci(dport->dport_dev))) + return; + + dir = cxl_debugfs_create_dir(dev_name(dport->dport_dev)); + + debugfs_create_file("einj_inject", 0200, dir, dport, + &cxl_einj_inject_fops); +} + static struct cxl_port *__devm_cxl_add_port(struct device *host, struct device *uport_dev, resource_size_t component_reg_phys, @@ -1144,6 +1176,8 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev, if (dev_is_pci(dport_dev)) dport->link_latency = cxl_pci_get_latency(to_pci_dev(dport_dev)); + cxl_debugfs_create_dport_dir(dport); + return dport; } @@ -2220,6 +2254,11 @@ static __init int cxl_core_init(void) cxl_debugfs = debugfs_create_dir("cxl", NULL); + if (einj_is_initialized()) { + debugfs_create_file("einj_types", 0400, cxl_debugfs, NULL, + &einj_cxl_available_error_type_fops); + } + cxl_mbox_init(); rc = cxl_memdev_init(); diff --git a/include/linux/einj-cxl.h b/include/linux/einj-cxl.h new file mode 100644 index 000000000000..af57cc8580a6 --- /dev/null +++ b/include/linux/einj-cxl.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * CXL protocol Error INJection support. + * + * Copyright (c) 2023 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Ben Cheatham + */ +#ifndef CXL_EINJ_H +#define CXL_EINJ_H + +#include + +#if IS_ENABLED(CONFIG_ACPI_APEI_EINJ) +int einj_cxl_available_error_type_show(struct seq_file *m, void *v); +int einj_cxl_inject_error(struct pci_dev *dport_dev, u64 type); +int einj_cxl_inject_rch_error(u64 rcrb, u64 type); +bool einj_is_initialized(void); +#else +static inline int einj_cxl_available_error_type_show(struct seq_file *m, + void *v) +{ + return -ENXIO; +} + +static inline int einj_cxl_type_show(struct seq_file *m, void *data) +{ + return -ENXIO; +} + +static inline int einj_cxl_inject_error(struct pci_dev *dport_dev, u64 type) +{ + return -ENXIO; +} + +static inline int einj_cxl_inject_rch_error(u64 rcrb, u64 type) +{ + return -ENXIO; +} + +static inline bool einj_is_initialized(void) { return false; } +#endif + +#endif From patchwork Wed Jan 17 19:45:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13522140 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2068.outbound.protection.outlook.com [40.107.93.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E712B249E6; Wed, 17 Jan 2024 19:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705520804; cv=fail; b=qwpj3/6T9xjoCCm6ueq6kt6EARMgL6CF6ML+9iMeK31g9G/lIaowRJi2u+heVln9yWEoo1FWDbFwjcnb/3dhlhquVfd8v/91mByJUK76p423nnwfzwGDS6ydVB8LWZK3e7HEKf1yJYmPjd/KQ3XFDUz1pIhXAhQEdNRMXtkwHSQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705520804; c=relaxed/simple; bh=oqrcFpSmloJ0ujgX1EfpmmUshQE5fbVFGi4XHyWBNuI=; h=ARC-Message-Signature:ARC-Authentication-Results:DKIM-Signature: Received:Received:X-MS-Exchange-Authentication-Results: Received-SPF:Received:Received:From:To:CC:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; b=clktE8ttxFy/ta1x9wE0C/xpM3gd96bliBwH6M3FTnKaZDppLy3Yc0bZLEecapXwH9GPl+9kdVH9rpfizPdrWoksnBA+F6YRZ0L8BLEmxXp6e0019RJjc2hN5FGcOT09w+t3pJtpWdUw3Ot1g9kHumfiOiBMktKAcSMdvzA36Go= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=c3U1bbd9; arc=fail smtp.client-ip=40.107.93.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="c3U1bbd9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H5iBgdgIWfjRZd2VeYiM01lhovrIBLc1ntQVxUVkMsrwQUC8i8VILIYzKAYfx8bwwq/cWyChE91xatFJamYsfw7QhsQUccuP1gwUIzbRlOVoKxM6HuHnlgwiSyut9Nm3rbQj7Nm4E6Sk5Ncia2XsaACB/0oILrocFI5kBIF5NlSvz2kTZaiDwz5BpFpdJLnRC5fljs5M1q2bT3DWT8d7OmAyhX+nwGMNNOHB9kiIYnc1wUqJQbS+/hlItWHXLrOd4Sg05k79GBFWNIKjypBH47P774CmsyIY4SriVUhCmipaf3FFzpMXd0pn08sg40skRPvu9Yg15u4076XHwO51Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yqhhHGaj3Y7oKTCj5iaf6t7b1djS4Bc+6uGSrdpCjCI=; b=GpDKeDvu6oJHDB5+YeUjDhksYLqbwMe9tsNWvtvptptg3jsgkqkFLmkt7UE8eU6iU8F9amEEYywobUOMuwZX6OmoYrKgsYkjF4RXqoJotF+yN81PrM6GUbSpHQWNt5s4oqZUrqty1lHaN+is7Ge0hTVupN3KsUNN1x7Rzw9+6W/KnQ68apZez7a9wB+EtkouIWT6EaG4viL2ugtYtyScB6K87w+pJtddyB03lB7YyeJOxoXHxV77Ey+76OE6AKgb0WzFlZMYoPs/VBHtUeb3qNgBJbHADMdYZ0cnc+WKdKm+l/6rf378ni//Zmv6TYEB3H/5HkUNr9C0lVlGR9OOBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yqhhHGaj3Y7oKTCj5iaf6t7b1djS4Bc+6uGSrdpCjCI=; b=c3U1bbd9fcwlkUv9xYM2oK4KQLZk0l44hOgF6i1nEbhU5tpuHTVxf2HEVpoCGv/u4h3CXYL1wCfOCL6JGIzCm1w6EjI1C222RQIM55ChLZIz2MIahiv+XermIwSyX8o8FYdolA25FPD5osNeerRnqDXOmaRSvuMRgJnnw1aCyLI= Received: from BL1PR13CA0435.namprd13.prod.outlook.com (2603:10b6:208:2c3::20) by CYYPR12MB9013.namprd12.prod.outlook.com (2603:10b6:930:c2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Wed, 17 Jan 2024 19:46:41 +0000 Received: from BL02EPF0001A108.namprd05.prod.outlook.com (2603:10b6:208:2c3:cafe::a1) by BL1PR13CA0435.outlook.office365.com (2603:10b6:208:2c3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.23 via Frontend Transport; Wed, 17 Jan 2024 19:46:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF0001A108.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Wed, 17 Jan 2024 19:46:40 +0000 Received: from bcheatha-HP-EliteBook-845-G8-Notebook-PC.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 17 Jan 2024 13:46:38 -0600 From: Ben Cheatham To: , , , , , , , CC: , , Subject: [PATCH v10 5/5] EINJ, Documentation: Update EINJ kernel doc Date: Wed, 17 Jan 2024 13:45:01 -0600 Message-ID: <20240117194501.298233-6-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240117194501.298233-1-Benjamin.Cheatham@amd.com> References: <20240117194501.298233-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A108:EE_|CYYPR12MB9013:EE_ X-MS-Office365-Filtering-Correlation-Id: 94eb1b87-8eeb-4f33-f4b3-08dc179506aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S17VzGY3ouGpn4c1UZwHWMcHCig6P7yw80H+kli/ehLWUrEMwUlf8AVmVC0GKDjPXqHyZLjSQ96CP6IEsIYIvU3fUzm6ViwxNOerTpERe5DFAiQxUYLbG412nAwx3si+eO0Nae0hiuAOOGYaQvumGRmlEtg0hWxiSfaySU/3BSlhN8TxjqObrYrJ9uvyFdYTEYlwBlFbHQAgT1azlf5deqffY40VwkdaM96x+tHwkzz/A+7YGQoFJ3c2qDq2xiQgHjN+lPUXVdfs9s51heuKWjrHl1jtiIlTMWuPLVSyv5uUd6ZeYO2i4ClWWqJMg2Ypf+qQj+v0kWSlEwb7zUGXLTbgebm04evGb8nQveR3oLtONruApMaJMKaz8lihLnhXnwjbctKgCu1/lQ6FKiuv36QGXfdwbtEiB23c7wQyUge4pLl8GcQbG0EJe+o/oGaXTfGC+b8tG/4Oi9dDlslQiyuk2lW0q5rMep+j8oZ/kbF5JU+4hBlGW6lc9JO5I5+y7ZFp2u0Ho/83VXhKCK7Z4/MFM42MxYZbmpsVBgC6K6BgJAS8oEjICtBpRNMNrf7D+NalRldlIKGZ+BKE25uWr29f3SduB5SXATmceMk5WVBwDSs1KuYs3+xwgsm+bAN2wBN6MuMfXYD3wyCyx8Yzb4OKnlZ6dAivPmToVfHuTu+/7+0d8fMYkvDDr3baPfrh1Lu4hx8oWQe0WO5aFJyX5M9GOnfnVi+gfqOHRYIP5QcEW7pXwxsAslLwW2Q6XDVZcq4XI9ALt8oVBGuODOU50TQ5xpwjqtZ++t5CXT+xDJA= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(39860400002)(396003)(376002)(346002)(230922051799003)(1800799012)(82310400011)(451199024)(186009)(64100799003)(40470700004)(36840700001)(46966006)(26005)(16526019)(1076003)(6666004)(7696005)(336012)(426003)(36860700001)(83380400001)(15650500001)(5660300002)(7416002)(8936002)(8676002)(4326008)(41300700001)(47076005)(2906002)(19627235002)(478600001)(70586007)(54906003)(110136005)(70206006)(316002)(36756003)(86362001)(356005)(82740400003)(81166007)(2616005)(40460700003)(40480700001)(36900700001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2024 19:46:40.8732 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94eb1b87-8eeb-4f33-f4b3-08dc179506aa X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A108.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB9013 Update EINJ kernel document to include how to inject CXL protocol error types, build the kernel to include CXL error types, and give an example injection. Signed-off-by: Ben Cheatham --- .../firmware-guide/acpi/apei/einj.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Documentation/firmware-guide/acpi/apei/einj.rst b/Documentation/firmware-guide/acpi/apei/einj.rst index d6b61d22f525..f179adf7b61c 100644 --- a/Documentation/firmware-guide/acpi/apei/einj.rst +++ b/Documentation/firmware-guide/acpi/apei/einj.rst @@ -181,6 +181,25 @@ You should see something like this in dmesg:: [22715.834759] EDAC sbridge MC3: PROCESSOR 0:306e7 TIME 1422553404 SOCKET 0 APIC 0 [22716.616173] EDAC MC3: 1 CE memory read error on CPU_SrcID#0_Channel#0_DIMM#0 (channel:0 slot:0 page:0x12345 offset:0x0 grain:32 syndrome:0x0 - area:DRAM err_code:0001:0090 socket:0 channel_mask:1 rank:0) +CXL error types are supported from ACPI 6.5 onwards. These error types +are not available in the legacy interface at /sys/kernel/debug/apei/einj, +and are instead at /sys/kernel/debug/cxl/. There is a file under debug/cxl +called "einj_type" that is analogous to available_error_type under debug/cxl. +There is also a "einj_inject" file in each $dport_dev directory under debug/cxl +that will inject a given error into the dport represented by $dport_dev. +For example, to inject a CXL.mem protocol correctable error into +$dport_dev=pci0000:0c:: + + # cd /sys/kernel/debug/cxl/ + # cat einj_type # See which error can be injected + 0x00008000 CXL.mem Protocol Correctable + 0x00010000 CXL.mem Protocol Uncorrectable non-fatal + 0x00020000 CXL.mem Protocol Uncorrectable fatal + # cd 0000:e0:01.1 # Navigate to dport to inject into + # echo 0x8000 > einj_inject # Inject error + +To use CXL error types, ``CONFIG_CXL_EINJ`` will need to be enabled. + Special notes for injection into SGX enclaves: There may be a separate BIOS setup option to enable SGX injection.