From patchwork Thu May 31 05:29:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rashmica Gupta X-Patchwork-Id: 923195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40xGHx1stnz9s01 for ; Thu, 31 May 2018 15:30:05 +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="pBpIu2pD"; 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 40xGHx0B4xzDrcW for ; Thu, 31 May 2018 15:30:05 +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="pBpIu2pD"; 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:c00::242; helo=mail-pf0-x242.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="pBpIu2pD"; dkim-atps=neutral Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (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 40xGHp570YzDrbS for ; Thu, 31 May 2018 15:29:58 +1000 (AEST) Received: by mail-pf0-x242.google.com with SMTP id v63-v6so10178497pfk.8 for ; Wed, 30 May 2018 22:29:58 -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=9UtiseBtBerD0eceOfBSfNtKywc9IYkzBQ7eU4DVqc4=; b=pBpIu2pDfEWHLOCAKdZwoIk3V/QxFyxxPKsj5KI+emBqH27X/rB5PHn3HiY7lFrFei +tR9Pudq6S7ObFtz4iYYL/FNRro3Qn/7SW3g+s2+JXpb08Z+3oTNU3LtUGq7NM4WBCPs IhuWgeoeSIl0m0/I70Eti8hg62QM12vj4M69q/2Ww4YuyRRmQ5hhICvyDmyEKX6GPziQ 07KeRS7l47SvN1O39aOUkpFrJZfre/YMniZLvx3rOWLO50GpFv5RxViPSZQIhFb0tEJC jdGLDhYnn+1ERnKMyOk4oIjeM6r70wPHzW8+4gCP41KJ1g0m+ByA3Bi1yRRSeIGrxuos /YHA== 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=9UtiseBtBerD0eceOfBSfNtKywc9IYkzBQ7eU4DVqc4=; b=XSkrznvG5HjKdYJobvwTlvynhQYxl0ErT1IfQvCFdjOieSkAw2aamKzNAjiDrfEzwP a6QF19PYVy1UWW76ZOUxm0/w7XR+2zdGvTibKN3aa2m654wGdaMxiGB5xJl2uvY5B36U Se2uRtffaR/d+OOpcqgqNPI8rh9m0xfnEl+7pU0uT/ACr9H63YVSYInLF4VZit03xrxk Ax68/bPnO88PTCAc2gGsDB+Qy7bZZ2rk8RzAAZ9Oy1MQ8EckVgJQnDeqCCQ7M9hDyCKG NQ4ChyDbwAmaqvXQ5joE8tIB0bj4B8/SWLgIhcTbDDw8JW/Ls5W1c0+39HwrUX1WneHs Ir5w== X-Gm-Message-State: ALKqPwco37nKQsfK5NotpsoAm5USseSAFramrktK4PdmG8UP+ZztZfle MP+aTJQMzyHVUpICWpz/BFZRiQ== X-Google-Smtp-Source: ADUXVKLPoTrZLGoBxxrDHGJtD05Q5n2YUBlPo6gTTYMVTAWnALM5tZ34BXMFpYHeM2l/9btoohYXVA== X-Received: by 2002:a63:7f1b:: with SMTP id a27-v6mr4489986pgd.410.1527744596653; Wed, 30 May 2018 22:29:56 -0700 (PDT) Received: from rashmica.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id h10-v6sm4500515pgc.28.2018.05.30.22.29.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 22:29:56 -0700 (PDT) From: Rashmica Gupta To: pdbg@lists.ozlabs.org Date: Thu, 31 May 2018 15:29:14 +1000 Message-Id: <20180531052915.31171-9-rashmica.g@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180531052915.31171-1-rashmica.g@gmail.com> References: <20180531052915.31171-1-rashmica.g@gmail.com> Subject: [Pdbg] [PATCH 09/10] 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libpdbg/host.c b/libpdbg/host.c index 5e0e08f..8dd3725 100644 --- a/libpdbg/host.c +++ b/libpdbg/host.c @@ -95,6 +95,14 @@ static int host_pib_probe(struct pdbg_target *target) if (chip_id == -1) goto out; + /* This check should probably be done earlier */ + if (access(XSCOM_BASE_PATH, F_OK) == -1) + { + fprintf(stderr, "Can not access %s. ", XSCOM_BASE_PATH); + fprintf(stderr, "Is CONFIG_SCOM_DEBUGFS set? "); + fprintf(stderr, "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;