From patchwork Fri Mar 22 05:45:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1060837 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44QXgx22dPz9sNm for ; Fri, 22 Mar 2019 16:45:49 +1100 (AEDT) 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="b5IlkVHH"; 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 44QXgw3bDjzDqSr for ; Fri, 22 Mar 2019 16:45:48 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::442; helo=mail-pf1-x442.google.com; envelope-from=oohall@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="b5IlkVHH"; dkim-atps=neutral Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44QXgm4tgGzDqSZ for ; Fri, 22 Mar 2019 16:45:40 +1100 (AEDT) Received: by mail-pf1-x442.google.com with SMTP id i17so751116pfo.6 for ; Thu, 21 Mar 2019 22:45:40 -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:mime-version :content-transfer-encoding; bh=g6xZtejhEJLxZ64MV2CZhr0Xfkex0450ON1N7U2CYug=; b=b5IlkVHHnIyt9RUPIg+1Zhzxf6eE+igyZ4NX/rWIKOtiN1oGPVD8g1muYrukeFXuth rL/TqnnkR1y9LmfRa0M166Xa01pEtYzY5Ss5e+yuHQ6FKu9vUtqR/rcAJHME5JlCxu9P 4DlZNbYF+AZuu9NoxiTW//iY82i+K/N+FfkfR5LaJIHZH8BEDVGkt5mW6Q2DJtY0Ml88 TxIbvl2XAND7nS59CeE70aApiwOIMp+533lQOt6LaSz46b5cloRrf1oE6xnwbljZ4gs1 PWI6hNxXYDrhKaIozS0Nvow1ZO3rXKVVQrPZ09Nf3HL4H2/SMTjdIV4yOTqNjhIveIxK WW0A== 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:mime-version :content-transfer-encoding; bh=g6xZtejhEJLxZ64MV2CZhr0Xfkex0450ON1N7U2CYug=; b=Pn/oMRIUF9DcW8c/XMLD6h8fOAEVTah9+e2E17PSFA9rRaRo2EGCy85Bih5TXav88U mIN1jlnMFSEhE9ubs9h/x0dN0MPpNW4brsnvjWItyu/5pKQARyAMGGjSBf8e45n4PS1/ UdwyFXn4p/vivbEEafekJIR2wlkzP0/hbw9igQ8TS7TxJ6INeI6a9DoCtAoKHnAnbP0l xMwxJsKAfsH9KvV9m15cTuB3M0s91euUdlsJGg7GzQBMBaoGx6+T5/dCx35E050lsesu eZedWL5XeYrdbOfcODhnJvQIj/EbPlOMr3TsZ8g5J+tX/BvKz84dFFtZUWTZfNj0bJH3 Y8SQ== X-Gm-Message-State: APjAAAVAxO7F9AMZJrY5VFb3FHIwpN8JlAgAm/i798/l8G+4kyYvBSrp 36dqCmbkDHaSOg5cR5OD3dxckPWy X-Google-Smtp-Source: APXvYqxT9WwpQMB8TP/K6eKoLO7IwQDhuvqw6hrH74hpLTGEvI/Fzw3vGvgjSRmae62u0pFbAhoRug== X-Received: by 2002:a65:6283:: with SMTP id f3mr7213618pgv.125.1553233536642; Thu, 21 Mar 2019 22:45:36 -0700 (PDT) Received: from localhost.ibm.com ([1.144.157.35]) by smtp.gmail.com with ESMTPSA id u13sm12522029pfa.169.2019.03.21.22.45.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Mar 2019 22:45:35 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Fri, 22 Mar 2019 16:45:23 +1100 Message-Id: <20190322054523.29670-1-oohall@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Skiboot] [PATCH] hw/npu2: Merge reset functions X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Reza Arbab Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Seems like we should be doing the same cache purge operation in the CRESET case, and we don't even implement FRESET. Cc: Reza Arbab Signed-off-by: Oliver O'Halloran --- hw/npu2.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/hw/npu2.c b/hw/npu2.c index 4ecc91350e82..a630536ca418 100644 --- a/hw/npu2.c +++ b/hw/npu2.c @@ -1200,14 +1200,14 @@ static int64_t npu2_get_power_state(struct pci_slot *slot __unused, uint8_t *val return OPAL_SUCCESS; } -static int64_t npu2_hreset(struct pci_slot *slot __unused) +static int64_t npu2_reset(const char *reset_type) { struct npu2 *p; int i; struct npu2_dev *ndev; p = phb_to_npu2_nvlink(slot->phb); - NPU2INF(p, "Hreset PHB state\n"); + NPU2INF(p, "%s PHB state\n", reset_type); for (i = 0; i < p->total_devices; i++) { ndev = &p->devices[i]; @@ -1219,28 +1219,19 @@ static int64_t npu2_hreset(struct pci_slot *slot __unused) return purge_l2_l3_caches(); } +static int64_t npu2_hreset(struct pci_slot *slot __unused) +{ + return npu2_reset("Hreset"); +} + static int64_t npu2_freset(struct pci_slot *slot __unused) { - return OPAL_SUCCESS; + return npu2_reset("Freset"); } static int64_t npu2_creset(struct pci_slot *slot) { - struct npu2 *p; - int i; - struct npu2_dev *ndev; - - p = phb_to_npu2_nvlink(slot->phb); - NPU2INF(p, "Creset PHB state\n"); - - for (i = 0; i < p->total_devices; i++) { - ndev = &p->devices[i]; - if (ndev) { - NPU2DEVINF(ndev, "Resetting device\n"); - reset_ntl(ndev); - } - } - return OPAL_SUCCESS; + return npu2_reset("Creset"); } static struct pci_slot *npu2_slot_create(struct phb *phb)