From patchwork Tue Aug 1 12:59:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 796215 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 3xMGfZ177sz9sR8 for ; Tue, 1 Aug 2017 23:01:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VMY5xzUv"; 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 3xMGfY73QNzDsSP for ; Tue, 1 Aug 2017 23:01:25 +1000 (AEST) 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="VMY5xzUv"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::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 3xMGdY5MM9zDrFy for ; Tue, 1 Aug 2017 23:00:33 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VMY5xzUv"; dkim-atps=neutral Received: by mail-pg0-x243.google.com with SMTP id u185so2632266pgb.0 for ; Tue, 01 Aug 2017 06:00:33 -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=YFivaqPrR4gcvoN6x3O290huVw7Y4U0M6V8uqtujIII=; b=VMY5xzUv5brc4P4//j8zCX5/gGPbAfeM9UNZ2dbN7TbEj4yZYJjDTFXPbs/gxftU6k 3LAz/MdUPcg2xwYM+djxv7lX9VnUCq0D5oJXKftr9XkemS57f/QFDrNyvipgoVCXulF6 8vrpb5TPIo/OV0xGgqwxvyI8UNKjxQK0xDEVZgqv1HB8DBKpooc+Sakz/mMsudI2xdLo 7bn4P8787bik0Ug9MK4ynqq/T5v62iNXfJ70KHOnD2TNgC2rPK5LYpXsqq4ZEjzCq3pR ywOTsWwFtDtrBUuJoURwmvUnC5fMMEZnx0ebgxufAcrTrACupJz+BvKUxWbo0xHRgxi0 gMog== 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=YFivaqPrR4gcvoN6x3O290huVw7Y4U0M6V8uqtujIII=; b=r0AUIYvt13M1SYXBl2NmrJlc6j46rGVvYibR0IesZ4dMGAoj4UYxh9d8xM7PyUNtAO dnW/nUNVASgJEhCgrRc3myp4xYujQmxnj/rcd7rIVuHiHFoiS/RMtbjXvtL0d10ImGae QqPO5jQdZUOhsutwkgqfMoKlvZVv7J1VaQiBfXlYiC1sIUCYmC8XdBbSeIiyZC5YYarM x4rOWRVJwXbU42soNL8m8DS5q7RD401HeTLsnN55kwjmBTR74VCwHfY3jcMbrws/XGjQ QPKTTRddJMqTGHyxLcBO6IKsI4ErIISL7MED98axWrMRBytaYm2eUEgTX51LO1+PdqBq oBQQ== X-Gm-Message-State: AIVw1123pGIME88YHjRoDBMkK7RjdOl8UCjgpRRjC6A5lAF2nim7NNET hvlKIJpcHDS3O4WE X-Received: by 10.84.129.103 with SMTP id 94mr20468122plb.63.1501592431709; Tue, 01 Aug 2017 06:00:31 -0700 (PDT) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id g22sm3235806pgn.65.2017.08.01.06.00.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 06:00:31 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Tue, 1 Aug 2017 22:59:58 +1000 Message-Id: <20170801130007.8990-4-oohall@gmail.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170801130007.8990-1-oohall@gmail.com> References: <20170801130007.8990-1-oohall@gmail.com> Subject: [Skiboot] [RFC 03/12] astbmc/slots: Add NVLink targeting information X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Add per-slot information about which NVLink groups are paired to this slot. Note that we don't support NVLinks from multiple chips targeting a single devices to binding a device to a single NVLink group is reasonable. This patch is to prepare for removing the NPUs. Signed-off-by: Oliver O'Halloran --- platforms/astbmc/astbmc.h | 10 ++++++++++ platforms/astbmc/garrison.c | 4 ++++ platforms/astbmc/p8dnu.c | 4 ++++ platforms/astbmc/witherspoon.c | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h index d538f97538dc..2d0e35e4a325 100644 --- a/platforms/astbmc/astbmc.h +++ b/platforms/astbmc/astbmc.h @@ -28,6 +28,15 @@ */ #define ST_LOC_NPU_GROUP(group_id) (group_id << 3) +/* + * For the .nvlink property we set the high bit to indicate that this slot + * has a paired NVLink. This is mainly so we can test for an nvlink by doing + * if (entry->nvlink) + */ +#define ST_LOC_NVLINK_VALID (1 << 31) +#define ST_LOC_NPU_TARGET(chip_id, group_id) \ + (ST_LOC_NVLINK_VALID | ((chip_id) << 16) | (group_id)) + struct slot_table_entry { enum slot_table_etype { st_end, /* End of list */ @@ -39,6 +48,7 @@ struct slot_table_entry { uint32_t location; const char *name; const struct slot_table_entry *children; + uint32_t nvlink; /* set by ST_LOC_NPU_GROUP */ }; extern const struct bmc_platform astbmc_ami; diff --git a/platforms/astbmc/garrison.c b/platforms/astbmc/garrison.c index db886cbbfd63..1697b66f56c6 100644 --- a/platforms/astbmc/garrison.c +++ b/platforms/astbmc/garrison.c @@ -48,6 +48,7 @@ static const struct slot_table_entry garrison_phb0_2_slot[] = { .etype = st_pluggable_slot, .location = ST_LOC_DEVFN(0,0), .name = "GPU1", + .nvlink = ST_LOC_NPU_TARGET(0, 1), }, { .etype = st_end }, }; @@ -57,6 +58,7 @@ static const struct slot_table_entry garrison_phb0_3_slot[] = { .etype = st_pluggable_slot, .location = ST_LOC_DEVFN(0,0), .name = "GPU2", + .nvlink = ST_LOC_NPU_TARGET(0, 0), }, { .etype = st_end }, }; @@ -127,6 +129,7 @@ static const struct slot_table_entry garrison_phb1_2_slot[] = { .etype = st_pluggable_slot, .location = ST_LOC_DEVFN(0,0), .name = "GPU3", + .nvlink = ST_LOC_NPU_TARGET(1, 1), }, { .etype = st_end }, }; @@ -136,6 +139,7 @@ static const struct slot_table_entry garrison_phb1_3_slot[] = { .etype = st_pluggable_slot, .location = ST_LOC_DEVFN(0,0), .name = "GPU4", + .nvlink = ST_LOC_NPU_TARGET(1, 0), }, { .etype = st_end }, }; diff --git a/platforms/astbmc/p8dnu.c b/platforms/astbmc/p8dnu.c index e4aeed4712eb..8cf532e26b8e 100644 --- a/platforms/astbmc/p8dnu.c +++ b/platforms/astbmc/p8dnu.c @@ -90,6 +90,7 @@ static const struct slot_table_entry p8dnu_phb0_2_slot[] = { .etype = st_pluggable_slot, .location = ST_LOC_DEVFN(0,0), .name = "GPU1", + .nvlink = ST_LOC_NPU_TARGET(0, 1), }, { .etype = st_end }, }; @@ -99,6 +100,7 @@ static const struct slot_table_entry p8dnu_phb0_3_slot[] = { .etype = st_pluggable_slot, .location = ST_LOC_DEVFN(0,0), .name = "GPU2", + .nvlink = ST_LOC_NPU_TARGET(0, 0), }, { .etype = st_end }, }; @@ -169,6 +171,7 @@ static const struct slot_table_entry p8dnu_phb1_2_slot[] = { .etype = st_pluggable_slot, .location = ST_LOC_DEVFN(0,0), .name = "GPU3", + .nvlink = ST_LOC_NPU_TARGET(1, 1), }, { .etype = st_end }, }; @@ -178,6 +181,7 @@ static const struct slot_table_entry p8dnu_phb1_3_slot[] = { .etype = st_pluggable_slot, .location = ST_LOC_DEVFN(0,0), .name = "GPU4", + .nvlink = ST_LOC_NPU_TARGET(1, 0), }, { .etype = st_end }, }; diff --git a/platforms/astbmc/witherspoon.c b/platforms/astbmc/witherspoon.c index 3c64cb17095b..aa260f94af1a 100644 --- a/platforms/astbmc/witherspoon.c +++ b/platforms/astbmc/witherspoon.c @@ -35,16 +35,19 @@ static const struct slot_table_entry witherspoon_plx0_down[] = { .etype = st_builtin_dev, .location = ST_LOC_DEVFN(0xa,0), .name = "GPU0", + .nvlink = ST_LOC_NPU_TARGET(0, 0), }, { .etype = st_builtin_dev, .location = ST_LOC_DEVFN(0xb,0), .name = "GPU1", + .nvlink = ST_LOC_NPU_TARGET(0, 1), }, { .etype = st_builtin_dev, .location = ST_LOC_DEVFN(0xc,0), .name = "GPU2", + .nvlink = ST_LOC_NPU_TARGET(0, 2), }, { .etype = st_end }, }; @@ -54,16 +57,19 @@ static const struct slot_table_entry witherspoon_plx1_down[] = { .etype = st_builtin_dev, .location = ST_LOC_DEVFN(0x4,0), .name = "GPU3", + .nvlink = ST_LOC_NPU_TARGET(8, 0), }, { .etype = st_builtin_dev, .location = ST_LOC_DEVFN(0x8,0), .name = "GPU4", + .nvlink = ST_LOC_NPU_TARGET(8, 1), }, { .etype = st_builtin_dev, .location = ST_LOC_DEVFN(0xd,0), .name = "GPU5", + .nvlink = ST_LOC_NPU_TARGET(8, 2), }, { .etype = st_end }, };