From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 8C03734C98C for ; Fri, 18 Sep 2026 05:23:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789709032; cv=none; b=rWujOlmNgUKiiLgNRcTMVS4bu1q3/fy08i+LlpKFLr0cKR3u377aMR2A3XKC0utbDaxGBlD0m7DJ/P8oEV2zGqnBJJbzE2eckQcXltz0g+v9wmoWrqELVwSUW0jPS5bgGCc4CRvHEPMOU+fefMpqojw4bKhIkljLGn6hXSLBaOE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789709032; c=relaxed/simple; bh=DgCZOnlq00OnWT/HiPkhh5PO1J+Y/0WDscZPZDo6d64=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RVd3ulprPs6X0h0zklJuw5xL4zOPWVGwNN8uVI7yw1qy7+EviWFebDOnJSnjAY67JtmMlB23/O+jWsEkehXmfQG3zJzPAEbEpel0AFpWiP/qrPuUo2ZoQksesknan92lZMRDiuTCbNnRLpvRfjEfv8g1yWOE91xZAFnxDz9V754= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=rnyMd0rO; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="rnyMd0rO" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68I2Vk5e083724; Fri, 18 Sep 2026 05:23:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=RhuygjSH7/2BgPnwi F8DOFy6xdwqVL9Tr9lBYJ1KRE8=; b=rnyMd0rOAm53uXkFO/fs/vVPJUFZ/9zos YLa7PG3jrJFL/5SNhfe2SzgLH6QZp6tmEEijKflIs86A89+AN3QZx8i0CK2Uy7ju Tp8ss82VRrlzWg5mvhS2RfhIaQE2OBHwl3ro7E2TKNTRADVWArwqEZV8+Nz2MuBH nqCdt7UCcWJ3EuV908VPq5pxK+cu+2vO+xfWt4Fxf56UUvTg7N/INlXzLtrw7BV5 wvbfwRmpP2wbAAUyBl4ZHOJ4irlw7Rbo+1+fBu/pj7nrEAA/ggAqOLEqOKCiBZFf +E2W0kCUivcGtYmHnTgoi5vrHFjnelNCs3xeE5IKgXrddDplMxw+Q== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4gmxcvdr31-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 18 Sep 2026 05:23:47 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 68I2Z3M5015583; Fri, 18 Sep 2026 05:23:46 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4gra3yvy9h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 18 Sep 2026 05:23:46 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 68I5NgPr45023596 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Sep 2026 05:23:42 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 876C720040; Fri, 18 Sep 2026 05:23:42 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81A512004B; Fri, 18 Sep 2026 05:23:38 +0000 (GMT) Received: from li-d12addcc-2792-11b2-a85c-bd8df30615ab.ibm.com.com (unknown [9.66.68.7]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 18 Sep 2026 05:23:38 +0000 (GMT) From: Shirisha G To: linuxppc-dev@lists.ozlabs.org Cc: linux-kselftest@vger.kernel.org, maddy@linux.ibm.com, venkat88@linux.ibm.com, shirisha@linux.ibm.com Subject: [PATCH 3/7] Subject: [PATCH] selftests/powerpc: Add RTAS /proc interface test Date: Fri, 18 Sep 2026 10:52:38 +0530 Message-ID: <20260918052321.932660-3-shirisha@linux.ibm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260918052321.932660-1-shirisha@linux.ibm.com> References: <20260918052321.932660-1-shirisha@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE4MDA2NCBTYWx0ZWRfXz/gpuIPqHmGw LWQtEmbAA3L3OyjvjWAFt7OSJtb6ShcjHxN6iXQBGkPp0QO5gzp2IHEpDoLVOTXaD8Oj5NQWyQF XKmz2M3vdG/1ejC0U3OLZ8CUcPGttxI= X-Proofpoint-ORIG-GUID: vpxBtLILpve4gLvSH4i-jWdidtM96VnK X-Proofpoint-GUID: vpxBtLILpve4gLvSH4i-jWdidtM96VnK X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE4MDA2NCBTYWx0ZWRfX+TmabSztmDSG lnaf3wR/e+7k7mXBmWypO0H8wUdROCoT0z3W8Acpkm6nMJS07Em3vBzFzg7zBQ+oU2Zz+lWylOJ cxT5Uk5rwItS1fFDSoYJ8cQQS9ZDkRWU1ZrueV0pFj1MoGq6bcOe1oYjGNJcYKHXZ16ZVjEfbPL WkWIhj5q2SaY8AZ8rWp4uao52tRMoOf9qlSO5+NmbLvZAkwH9VVS5ehVbINiFHv6+2UEGLpXsi6 m401XJmb3YLiPiPdv8Wwbx2vuoGoK41/hLUf1SR3uxku8jm/0ElvqiD4mHf7+od3Tk03dHXtvFh t6IOULroUdej8zRgJGXswMeFt3ofQqJ/7tZmNLSiSbWBB52Zf9SK2dcRsCjyPjb9lEOAtgKvU3q zMWKcOnfJQr4lqAvQxWxIqY+IjjBUpnGgpMWgugRN11dN6JVkM8HfyrHT1f/n4kj2KCdAlWopCd mdJ1s4pBSEiGyeEwbhw== X-Authority-Analysis: v=2.4 cv=F+7C5ahN c=1 sm=1 tr=0 ts=6aaccae3 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=VdqzKS8jKosA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=EplBi5tRZ083qCpsOPwA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-18_01,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 phishscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 impostorscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609180064 Add kselftest for the RTAS /proc interface on pseries/PowerVM systems. This test validates event logging and status reporting via `/proc/ppc64/rtas/`. The test verifies: - Enumeration of `/proc/ppc64/rtas/` entries - Reading and basic validation of `rtas_log` - Parsing RTAS event log headers (version, severity, length) - Structure of log entries (header, timestamp, severity) - Handling of invalid RTAS tokens - Error log rotation behavior Signed-off-by: Shirisha G --- .../selftests/powerpc/rtas/rtas_proc_test.c | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 tools/testing/selftests/powerpc/rtas/rtas_proc_test.c diff --git a/tools/testing/selftests/powerpc/rtas/rtas_proc_test.c b/tools/testing/selftests/powerpc/rtas/rtas_proc_test.c new file mode 100644 index 000000000000..0f8d1408745f --- /dev/null +++ b/tools/testing/selftests/powerpc/rtas/rtas_proc_test.c @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * RTAS /proc Interface Test + * Copyright (C) 2026 IBM Corporation + */ + +#include +#include +#include +#include +#include +#include +#include +#include "utils.h" + +#define RTAS_PROC_DIR "/proc/ppc64/rtas" +#define RTAS_LOG "/proc/ppc64/rtas/rtas_log" + +/* RTAS log entry header structure */ +struct rtas_log_header { + uint32_t signature; + uint16_t length; + uint8_t version; + uint8_t severity; + uint8_t disposition; + uint8_t extended; + /* ... more fields ... */ +} __attribute__((packed)); + +static int enumerate_rtas_proc(void) +{ + DIR *dir; + struct dirent *entry; + int count = 0; + + dir = opendir(RTAS_PROC_DIR); + if (!dir) + return -1; + + printf("RTAS proc entries:\n"); + while ((entry = readdir(dir)) != NULL) { + if (entry->d_name[0] != '.') { + printf(" %s\n", entry->d_name); + count++; + } + } + + closedir(dir); + return count; +} + +static int read_rtas_log(void) +{ + int fd; + char buf[4096]; + ssize_t bytes; + + fd = open(RTAS_LOG, O_RDONLY); + if (fd < 0) + return -1; + + bytes = read(fd, buf, sizeof(buf)); + close(fd); + + if (bytes > 0) { + printf("Read %zd bytes from RTAS log\n", bytes); + /* Basic validation of log format */ + if (bytes >= sizeof(struct rtas_log_header)) { + struct rtas_log_header *hdr = (struct rtas_log_header *)buf; + printf(" Log entry: version=%u, severity=%u, length=%u\n", + hdr->version, hdr->severity, hdr->length); + } + } + + return bytes; +} + +int main(void) +{ + int count, ret; + + test_harness_set_timeout(10); + + /* Test 1: Verify RTAS proc directory exists */ + SKIP_IF(access(RTAS_PROC_DIR, R_OK) != 0); + + /* Test 2: Enumerate RTAS proc entries */ + count = enumerate_rtas_proc(); + FAIL_IF_MSG(count < 0, "Failed to enumerate RTAS proc entries"); + FAIL_IF_MSG(count == 0, "No RTAS proc entries found"); + + /* Test 3: Read RTAS log */ + ret = read_rtas_log(); + /* Log may be empty, which is OK */ + if (ret < 0) { + printf("RTAS log not available (may be empty)\n"); + } + + printf("RTAS proc test passed\n"); + return 0; +} -- 2.43.5