From patchwork Fri May 25 04:52:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 920232 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 40sYls3t5Bz9s19 for ; Fri, 25 May 2018 14:52:57 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="YHuz8LE/"; 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 40sYls1cB3zF1fk for ; Fri, 25 May 2018 14:52:57 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="YHuz8LE/"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40sYlk25k9zF1fR for ; Fri, 25 May 2018 14:52:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="YHuz8LE/"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 40sYlj6qryz9s19; Fri, 25 May 2018 14:52:49 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1527223970; bh=PvDXvT2EY4CXmMdS2URQov6+6ulizUPy9AAxMmsZpWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YHuz8LE/jlGPGLHVyytOIRMUx3NRsd2C4jS2o7eRNMF6+RAhcUfpzqNuFuABiatSV wgWuw0DZwyrAResF8vkY6Ficr74SFZUcQfDj+dhElgbM2f/McWM2do3RSGnmdfHSON ttdPPinkK0foR70jxlrByTvevtG+5z4ro6PYjsJjhmkOwoPfVla/36+35A9/N/fpp1 2wWpKrllMTaCWTDHXarSNdJZxAdymF8oIGrogOKxPtWnbgjkaAGWlQ5nTnYyd9JSov jkxBmLmWkpYuVhEFbWSN7wJj2w7KhLcJpJbPizpxxiW8adERZcTKLgazbigGjpbdrr UAGpTEG5dJyuQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 25 May 2018 14:52:35 +1000 Message-Id: <20180525045240.24196-2-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180525045240.24196-1-amitay@ozlabs.org> References: <20180525045240.24196-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 1/6] main: Overhaul target selection 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: , Cc: Amitay Isaacs MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Support explicit multiple target selection using ranges and lists. For options -p/-c/-t, support the following valid arguments: 3 0-7 1,2,3 0-5,7,9-11,17,19 For loss of sanity, make sense of the following valid arguments: 3,3,3,3,3,3 1-6,2-5 1,2,3,0-7 Conjunction of -p/-c/-t with -a also works and it's insensitive to order of options specified. -a -c 1,2 processors 0-max; chips 1-2; threads 0-max -p 0 -c 0 -a processors 0; chips 0; threads 0-max -a -c 1 -t 1 processors 0-max; chips 1; threads 1 Signed-off-by: Amitay Isaacs --- src/main.c | 171 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 131 insertions(+), 40 deletions(-) diff --git a/src/main.c b/src/main.c index 2200a01..457cda2 100644 --- a/src/main.c +++ b/src/main.c @@ -131,9 +131,9 @@ static void print_usage(char *pname) printf("Usage: %s [options] command ...\n\n", pname); printf(" Options:\n"); - printf("\t-p, --processor=processor-id\n"); - printf("\t-c, --chip=core-id\n"); - printf("\t-t, --thread=thread\n"); + printf("\t-p, --processor=<0-%d>||\n", MAX_PROCESSORS); + printf("\t-c, --chip=<0-%d>||\n", MAX_CHIPS); + printf("\t-t, --thread=<0-%d>||\n", MAX_THREADS); printf("\t-a, --all\n"); printf("\t\tRun command on all possible processors/chips/threads (default)\n"); printf("\t-b, --backend=backend\n"); @@ -166,11 +166,72 @@ static void print_usage(char *pname) } } +/* Parse argument of the form 0-5,7,9-11,15,17 */ +static bool parse_list(const char *arg, int max, int *list, int *count) +{ + char str[strlen(arg)+1]; + char *tok, *tmp, *saveptr = NULL; + int i, n; + + strcpy(str, arg); + + for (i=0; i= max) { + return false; + } + } + + b = strtok_r(NULL, "-", &saveptr2); + if (b == NULL) { + to = from; + } else { + to = atoi(b); + if (to >= max) { + return false; + } + } + + if (from > to) + return false; + + for (i=from; i<=to; i++) + list[i] = 1; + + tmp = NULL; + }; + + n = 0; + for (i=0; i= MAX_PROCESSORS) - opt_error = true; - else - processorsel[current_processor] = &chipsel[current_processor][0]; - } + if (!parse_list(optarg, MAX_PROCESSORS, p_list, &p_count)) + fprintf(stderr, "Failed to parse '-p %s'\n", optarg); + else + opt_error = false; break; case 'c': - errno = 0; - current_chip = strtoul(optarg, &endptr, 0); - opt_error = (errno || *endptr != '\0'); - if (!opt_error) { - if (current_chip >= MAX_CHIPS) - opt_error = true; - else - chipsel[current_processor][current_chip] = &threadsel[current_processor][current_chip][0]; - } + if (!parse_list(optarg, MAX_CHIPS, c_list, &c_count)) + fprintf(stderr, "Failed to parse '-c %s'\n", optarg); + else + opt_error = false; break; case 't': - errno = 0; - current_thread = strtoul(optarg, &endptr, 0); - opt_error = (errno || *endptr != '\0'); - if (!opt_error) { - if (current_thread >= MAX_THREADS) - opt_error = true; - else - threadsel[current_processor][current_chip][current_thread] = 1; - } + if (!parse_list(optarg, MAX_THREADS, t_list, &t_count)) + fprintf(stderr, "Failed to parse '-t %s'\n", optarg); + else + opt_error = false; break; case 'b': @@ -292,10 +348,45 @@ static bool parse_options(int argc, char *argv[]) } } while (c != EOF && !opt_error); - if (opt_error) + if (opt_error) { print_usage(basename(argv[0])); + return false; + } + + if ((c_count > 0 || t_count > 0) && p_count == 0) { + fprintf(stderr, "No processor(s) selected\n"); + fprintf(stderr, "Use -p or -a to select processor(s)\n"); + return false; + } + + if (t_count > 0 && c_count == 0) { + fprintf(stderr, "No chip(s) selected\n"); + fprintf(stderr, "Use -c or -a to select chip(s)\n"); + return false; + } + + for (i=0; i X-Patchwork-Id: 920233 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 40sYlx1yZMz9s19 for ; Fri, 25 May 2018 14:53:01 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="lVjwkUsf"; 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 40sYlx0KhgzF1fr for ; Fri, 25 May 2018 14:53:01 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="lVjwkUsf"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40sYlk3zWLzF1fP for ; Fri, 25 May 2018 14:52:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="lVjwkUsf"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 40sYlk1lxbz9s15; Fri, 25 May 2018 14:52:50 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1527223970; bh=4oRuNOLBsaShF+Fkk+InsMJQmv5PHBxxhoG9FQbxEsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lVjwkUsfF9NTvfWAhY2sO//TI+zI9Mwi9+cH7AIg0/HI8AwVYSqj+SbClFvRmeoSi 0b2Bg3RjiY0hpk+hN332TtjFm/aquNabXCYvSvc+9UxL0+cloU8RjHiCCb9Qwfbv57 gBKsXRW1988Ma54CwHNKkjKfkHVjgQ9rH1b2FvUzFrk8O/3uW1tQFEbl0038ovFkYR biWgD9KLnnYbR28sahvUlwzAiwdL+gbkggkyI/CbpvcC6Ws78ymGVB+LL44zr9QMJA xalmO+3q8x7h2yePQDv5Sfibkoq24mgoyZfD/uOFwPPwD5QSru7Swbc6u/91WE1Day R5ACcSm4dyFrA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 25 May 2018 14:52:36 +1000 Message-Id: <20180525045240.24196-3-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180525045240.24196-1-amitay@ozlabs.org> References: <20180525045240.24196-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 2/6] main: Print specific errors for invalid arguments 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: , Cc: Amitay Isaacs MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" This avoids the large usage message obscuring the actual errors from parsing options. Print usage only if an option is invalid. Signed-off-by: Amitay Isaacs --- src/main.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/main.c b/src/main.c index 457cda2..4a1b0e0 100644 --- a/src/main.c +++ b/src/main.c @@ -226,7 +226,7 @@ static bool parse_list(const char *arg, int max, int *list, int *count) static bool parse_options(int argc, char *argv[]) { int c; - bool opt_error = true; + bool opt_error = false; int p_list[MAX_PROCESSORS]; int c_list[MAX_CHIPS]; int t_list[MAX_THREADS]; @@ -255,8 +255,6 @@ static bool parse_options(int argc, char *argv[]) switch(c) { case 'a': - opt_error = false; - if (p_count == 0) { p_count = MAX_PROCESSORS; for (i=0; i X-Patchwork-Id: 920234 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 40sYlz6tRzz9s19 for ; Fri, 25 May 2018 14:53:03 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="x4vWWlBZ"; 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 40sYlz5Dg8zF1fl for ; Fri, 25 May 2018 14:53:03 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="x4vWWlBZ"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40sYlk69FBzF1fR for ; Fri, 25 May 2018 14:52:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="x4vWWlBZ"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 40sYlk3fWZz9s1b; Fri, 25 May 2018 14:52:50 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1527223970; bh=bR4gvvXTaWuiZBkuWl0CpOupxLwDTEOy9ulsaumTtmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x4vWWlBZlOM6aQi3cJIKeIue1RC8KkZWWbCXcvtmj+PIUktsG6+pwdLLKuU1WupgU pLUFgyrO2AwH7igLhB5wFVigj3WzbC617/k0DjWQCDOrvD1fcRB9sCOmk/qqufXxo/ PPtd+3N0MCHdrf0ar2L6M+3+oZHBoo+eF+A5u8moiogy68/V+AyrpeykYSWXDngYCK Rb4H4dKRcpjK5k0XuTPv6+UbiObzAueaUB+i4s3tuS+3eI3OAvfHtnb+VRlqL+7NKr RhBJVilfqhwCe4Tb0iASZjWQkgovaJtfYnOOIk9XxjzWtTNnM+hOFpUkMUOBEvR0Kt KkZEDWidC9HdQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 25 May 2018 14:52:37 +1000 Message-Id: <20180525045240.24196-4-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180525045240.24196-1-amitay@ozlabs.org> References: <20180525045240.24196-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 3/6] main: Print specific errors for invalid commands 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: , Cc: Amitay Isaacs MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" This avoids large usage message obscuring the actual error message. Signed-off-by: Amitay Isaacs --- src/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.c b/src/main.c index 4a1b0e0..07c3677 100644 --- a/src/main.c +++ b/src/main.c @@ -732,7 +732,6 @@ int main(int argc, char *argv[]) } PR_ERROR("Unsupported command: %s\n", argv[optind]); - print_usage(basename(argv[0])); return 1; found_action: From patchwork Fri May 25 04:52:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 920235 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 40sYm228qtz9s19 for ; Fri, 25 May 2018 14:53:06 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="ehkU0Gdp"; 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 40sYm20CkxzF1fp for ; Fri, 25 May 2018 14:53:06 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="ehkU0Gdp"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40sYll0cvNzF1fP for ; Fri, 25 May 2018 14:52:51 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="ehkU0Gdp"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 40sYlk5nD2z9s19; Fri, 25 May 2018 14:52:50 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1527223970; bh=3C9ENttpFnUfDlYh/ityNGM/02Q7s/YPttyb4TRIUbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ehkU0Gdp/5P9YDbzK3+Fa4fquC0h1a/u9mfWTEOWn8IJVvbMw5vTTSy+5kMi384o1 h9jLOVgnRH1t6XWweuRa9GOnw0bj9r+eQG739xzAof+6NS/gRvE2r1qIBQ6XMGG7WH cp6jURRX3s4CiW5QLlm4Wf6NEQiLPVqRoEGMvKrAPe2WdvwwdXlUyw+HJ3oLsBsuLa IqbUhjDhPg8qLv61AMNhi4mk37Bdkli1fQ1j6iw7ZoFQ+zwsjqoUwOpFTDtEZAFMy6 MRfQCYq+MpWiSMC1n11dvCXJETBWv8cLLpXdv2OAWeDreSubkQAUvNNKiNySaAi1zU tNxjytmbrrCBA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 25 May 2018 14:52:38 +1000 Message-Id: <20180525045240.24196-5-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180525045240.24196-1-amitay@ozlabs.org> References: <20180525045240.24196-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 4/6] fake.dts: Add more targets for testing 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: , Cc: Amitay Isaacs MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" The number of targets (pib/core/thread) can be changed easily by changing the arguments to dump_fsi() macro. The targets have unique addresses, so can be used for testing range-checking (if any) for getscom/putscom operations. Signed-off-by: Amitay Isaacs --- fake.dts.m4 | 121 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 103 insertions(+), 18 deletions(-) diff --git a/fake.dts.m4 b/fake.dts.m4 index 56bf35e..4c6c145 100644 --- a/fake.dts.m4 +++ b/fake.dts.m4 @@ -1,22 +1,107 @@ +dnl +dnl forloop([var], [start], [end], [iterator]) +dnl +divert(`-1') +define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') +define(`_forloop', + `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') + +dnl +dnl dump_thread([index]) +dnl +define(`dump_thread', +` + thread@$1 { + #address-cells = <0x0>; + #size-cells = <0x0>; + compatible = "ibm,fake-thread"; + reg = <0x$1 0x0>; + index = <0x$1>; + }; +')dnl + +dnl +dnl dump_core_pre([index], [addr]) +dnl +define(`dump_core_pre', +` + core@$2 { + #address-cells = <0x1>; + #size-cells = <0x1>; + compatible = "ibm,fake-core"; + reg = <0x$2 0x0>; + index = <0x$1>;') + +dnl +dnl dump_core_post() +dnl +define(`dump_core_post', ` }; +')dnl + +dnl +dnl dump_core([index], [addr], [num_threads]) +dnl +define(`dump_core', +`dump_core_pre(`$1', `$2') +forloop(`i', `0', eval(`$3-1'), `dump_thread(i)') +dump_core_post()') + +dnl +dnl dump_processor_pre([index], [addr]) +dnl +define(`dump_processor_pre', +` + pib@$2 { + #address-cells = <0x1>; + #size-cells = <0x1>; + compatible = "ibm,fake-pib"; + reg = <0x$2 0x0>; + index = <0x$1>;') + +dnl +dnl dump_processor_post() +dnl +define(`dump_processor_post', ` }; +')dnl + +dnl +dnl dump_processor([index], [addr], [num_cores], [num_threads]) +dnl +define(`dump_processor',dnl +`dump_processor_pre(`$1', `$2') +forloop(`i', `0', eval(`$3-1'), `dump_core(i, eval($2+(i+1)*10), $4)') +dump_processor_post()') + +dnl +dnl dump_fsi_pre([index], [addr]) +dnl +define(`dump_fsi_pre', +` + fsi@$2 { + #address-cells = <0x1>; + #size-cells = <0x1>; + compatible = "ibm,fake-fsi"; + reg = <0x$2 0x0>; + index = <0x$1>;') + +dnl +dnl dump_fsi_post() +dnl +define(`dump_fsi_post', ` };') + +dnl +dnl dump_fsi([index], [addr], [num_processors], [num_cores], [num_threads]) +dnl +define(`dump_fsi', +`dump_fsi_pre(`$1', `$2') +forloop(`i', `0', eval(`$3-1'), `dump_processor(i, eval(10000+i*1000), $4, $5)') +dump_fsi_post()') +divert`'dnl + /dts-v1/; / { - #address-cells = <0x1>; - #size-cells = <0x0>; - - fsi@0 { - #address-cells = <0x2>; - #size-cells = <0x1>; - compatible = "ibm,fake-fsi"; - reg = <0x0 0x0 0x0>; - - index = <0x0>; - status = "mustexist"; - - pib@0 { - compatible = "ibm,fake-pib"; - reg = <0x0 0x0 0x0>; - index = <0x0>; - }; - }; + #address-cells = <0x1>; + #size-cells = <0x1>; +dump_fsi(0, 0, 8, 4, 2) }; From patchwork Fri May 25 04:52:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 920236 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 40sYm456vmz9s19 for ; Fri, 25 May 2018 14:53:08 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="pCRket8D"; 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 40sYm43RTKzF1fW for ; Fri, 25 May 2018 14:53:08 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="pCRket8D"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40sYll2j10zF1fR for ; Fri, 25 May 2018 14:52:51 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="pCRket8D"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 40sYll0GVYz9s15; Fri, 25 May 2018 14:52:51 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1527223971; bh=XxzB6ezHzf56HlADj5vzNHk43r4NIsIjQfWj4hW562s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pCRket8DzyUjJNXyWwd2N2QkfHkSultEkMsdrI3R0Rt6GKrD38j0t3TkmmhlihevH yzfxdNRgmYo3sGAQe2H3IPqTqgqvpUjAKnvnpVUCUyDxfHRy6kquhijwbFH5m5A/ff djB0OfiLIeZF5RaOPG8txghI1cGWuxgOoQxtppKx1i/O0pq373JwkUf5diDPPPMozj NooNt4NBvlHJ5NmVEW5WDIOwxLHPzRMEXyjRj9aMB0uABTOeu9bEKnZDxFeEtCTa9C ENeMVb6qIp7Bj5H4NCsAQb3d6gRqMcfI0+WR9mJMmhOwqtdv3wwLQgVOGrAVHVal9A jO9SEXep5tp5g== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 25 May 2018 14:52:39 +1000 Message-Id: <20180525045240.24196-6-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180525045240.24196-1-amitay@ozlabs.org> References: <20180525045240.24196-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 5/6] fake: Add fake targets for testing 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: , Cc: Amitay Isaacs MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- libpdbg/fake.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libpdbg/fake.c b/libpdbg/fake.c index ec03ccf..58e7e18 100644 --- a/libpdbg/fake.c +++ b/libpdbg/fake.c @@ -64,3 +64,21 @@ static struct pib fake_pib = { .write = fake_pib_write, }; DECLARE_HW_UNIT(fake_pib); + +static struct core fake_core = { + .target = { + .name = "Fake Core", + .compatible = "ibm,fake-core", + .class = "core", + }, +}; +DECLARE_HW_UNIT(fake_core); + +static struct thread fake_thread = { + .target = { + .name = "Fake Thread", + .compatible = "ibm,fake-thread", + .class = "thread", + }, +}; +DECLARE_HW_UNIT(fake_thread); From patchwork Fri May 25 04:52:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 920237 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 40sYm71rYvz9s19 for ; Fri, 25 May 2018 14:53:11 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="wdztorRb"; 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 40sYm675DPzF1fk for ; Fri, 25 May 2018 14:53:10 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="wdztorRb"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40sYll4V4mzF1fP for ; Fri, 25 May 2018 14:52:51 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="wdztorRb"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 40sYll2PL2z9s1b; Fri, 25 May 2018 14:52:51 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1527223971; bh=rKR8e8hQW8P/pJDN+prPm9KyETjclutnZ6hKWnH4xyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wdztorRbAHhw4LnxVc8c/+i2z8sKv6CSRsNjRsFm5/xFaZlKc+YuVhePInW/IC4Zg 3bV1iYV3muVxzOEyLVNtcCZ+Xl4JUj6EZM2TlsHM3w9EzGG8UQTzRgn8y+i7ruR0aB +RE4uu6f2fJ0OWqhO/qLoW0g31ypwBU+ge7JI5O6+XFDsqzbCQukFcOpmi5maGY0k1 kHtrdrpa3Idvlb27+w5KACPZNnMXChOc142x/KpP6wjTLrbsdnzFY4hLpJsaDZm+Jm Vb7xrLqH9NNxdzt+9pK7TiJUzb4w6IA8hyesq/AY5RxNs8pY6J4IF1WEtOoRXvFoF5 qFdl+Satyw5fg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 25 May 2018 14:52:40 +1000 Message-Id: <20180525045240.24196-7-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180525045240.24196-1-amitay@ozlabs.org> References: <20180525045240.24196-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 6/6] dts: Fix more warnings from dtc 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: , Cc: Amitay Isaacs MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- p8-fsi.dts.m4 | 4 +++- p8-i2c.dts.m4 | 2 ++ p9-fsi.dtsi.m4 | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/p8-fsi.dts.m4 b/p8-fsi.dts.m4 index 5b83781..16dbe3a 100644 --- a/p8-fsi.dts.m4 +++ b/p8-fsi.dts.m4 @@ -50,8 +50,10 @@ }; hmfsi@180000 { + #address-cells = <0x2>; + #size-cells = <0x1>; compatible = "ibm,power8-opb-hmfsi"; - reg = <0x180000 0x80000>; + reg = <0x0 0x180000 0x80000>; port = <0x2>; index = <0x2>; diff --git a/p8-i2c.dts.m4 b/p8-i2c.dts.m4 index b6d2ddc..f1fcbd3 100644 --- a/p8-i2c.dts.m4 +++ b/p8-i2c.dts.m4 @@ -40,6 +40,8 @@ }; hmfsi@180000 { + #address-cells = <0x2>; + #size-cells = <0x1>; compatible = "ibm,power8-opb-hmfsi"; reg = <0x180000 0x80000>; port = <0x2>; diff --git a/p9-fsi.dtsi.m4 b/p9-fsi.dtsi.m4 index 5109f81..afa7d39 100644 --- a/p9-fsi.dtsi.m4 +++ b/p9-fsi.dtsi.m4 @@ -13,6 +13,8 @@ status = "mustexist"; pib@1000 { + #address-cells = <0x2>; + #size-cells = <0x1>; reg = <0x0 0x1000 0x7>; index = <0x0>; compatible = "ibm,fsi-pib", "ibm,power9-fsi-pib"; @@ -20,12 +22,16 @@ }; hmfsi@100000 { + #address-cells = <0x2>; + #size-cells = <0x1>; compatible = "ibm,fsi-hmfsi"; reg = <0x0 0x100000 0x8000>; port = <0x1>; index = <0x1>; pib@1000 { + #address-cells = <0x2>; + #size-cells = <0x1>; reg = <0x0 0x1000 0x7>; index = <0x1>; compatible = "ibm,fsi-pib", "ibm,power9-fsi-pib";