From patchwork Fri Jun 22 04:51:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rashmica Gupta X-Patchwork-Id: 933107 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41BmQ14njsz9s52 for ; Fri, 22 Jun 2018 14:52:09 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Xvc205FN"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41BmQ133XHzF0x8 for ; Fri, 22 Jun 2018 14:52:09 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Xvc205FN"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::243; helo=mail-pl0-x243.google.com; envelope-from=rashmica.g@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Xvc205FN"; dkim-atps=neutral Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41BmPt5HTPzF0wy for ; Fri, 22 Jun 2018 14:52:02 +1000 (AEST) Received: by mail-pl0-x243.google.com with SMTP id w17-v6so2836509pll.9 for ; Thu, 21 Jun 2018 21:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7MwA6agLgjK11S8EHY0d+LMkJOYa4wbpoOUop05RR0M=; b=Xvc205FNsSyP/zMNtAvs9bGg5xtsykAxiVFoYwQFZFAAYQ0oV6mDfWopzE6E6bfEqZ guiqOoqDXJtlOIOQWaiG5RnbLtPHJMELjI4I2eUMopniB9exJYRF1lFpC6eoeEG07SZg hJxwFZPyzcRx8ariMkL+PgkJ2dHkD4CUgeFYINrDteksnVyxrEQsNVVzZXg2++8Wn4dZ EiZo/6+06Urggr/ybSEVpPCVuB1qyKVVKeQC1bcF8wgwFx/bkWczmR+2i0QiutIgkIqc ERuLR5LEiSm6UiDyQMFORqmxd1Hkr8QONK7VWBJTNO2SXJ8vrWnNZjIRXLBVQuk8zSd6 UeCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7MwA6agLgjK11S8EHY0d+LMkJOYa4wbpoOUop05RR0M=; b=PBnYml/l9t6bwhhjO6CjX9TtORILQi9O8d5g5Am0DPzWIoetpBSoxFTgZhwEBMqqoy Qvpnkjf6EBJLgwc6de4HZ9GK/L28hdeDnild7EDmKxqaQAFcNV/VQln2MB2rnZgJBq1r eqQ2xinM6glDFRk897HYlRNmdaO+12cAuCQl6sjN7rJGn1XUQe8gOK+dAzJHLI7x2I5W kxqXHbBKMAm3XnNmxU5GgvWWrMlGwSfmL8I27rL8xsq9DWW8RUmi55n+2fyy9B/h3nyZ zpQFixshwl1mPhRzl8MR9IZ7rGAAiGtFTdn6T+htXj1pMcJe3LuGJUBMMApxFtudYsJ+ 75AQ== X-Gm-Message-State: APt69E3t7UPZGR03HxhUKL4ZZ7Tn2PbQ25i+7EXDXtih0azKzpS8z6o1 Muj7LRJ5lDQwCUbQDtQySQab+Q== X-Google-Smtp-Source: ADUXVKI2juAjgWw+27vECXAhtdlJQYOgBWGXvmmS+I77764Mz2VqtQLsNEqKvjycMfYssk9DfPtSJw== X-Received: by 2002:a17:902:6b0b:: with SMTP id o11-v6mr38243plk.101.1529643120453; Thu, 21 Jun 2018 21:52:00 -0700 (PDT) Received: from rashmica.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id v27-v6sm11874992pfi.23.2018.06.21.21.51.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Jun 2018 21:52:00 -0700 (PDT) From: Rashmica Gupta To: pdbg@lists.ozlabs.org Date: Fri, 22 Jun 2018 14:51:15 +1000 Message-Id: <20180622045116.12059-8-rashmica.g@gmail.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180622045116.12059-1-rashmica.g@gmail.com> References: <20180622045116.12059-1-rashmica.g@gmail.com> Subject: [Pdbg] [PATCH 7/8] libpdbg: Check if scom controllers are exposed X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" If CONFIG_SCOM_DEBUGFS is not set in the running kernel then the scom controllers are not exposed and so using getscom won't work. Add check for /sys/kernel/debug/powerpc/scom to give a more useful error message. Signed-off-by: Rashmica Gupta --- libpdbg/host.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libpdbg/host.c b/libpdbg/host.c index 483e048..eb627be 100644 --- a/libpdbg/host.c +++ b/libpdbg/host.c @@ -95,7 +95,15 @@ static int host_pib_probe(struct pdbg_target *target) if (chip_id == -1) goto out; - if (asprintf(&access_fn, "%s/%08x/access", XSCOM_BASE_PATH, chip_id) < 0) + /* This check should probably be done earlier */ + if (access(XSCOM_BASE_PATH, F_OK) == -1) + { + PR_ERROR("Can not access %s. ", XSCOM_BASE_PATH); + PR_ERROR("Is CONFIG_SCOM_DEBUGFS set? "); + PR_ERROR("You may need to re-run the command as root.\n"); + } + + if (asprintf(&access_fn, "%s/%08d/access", XSCOM_BASE_PATH, chip_id) < 0) goto out; *fd = open(access_fn, O_RDWR);