Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3492706imm; Sun, 17 Jun 2018 21:49:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKCdWFTp60n+0h3bgI9g4NT4snByBIjsmTN3sa+qCEcSeuin9pIBxWn555err2QcWOOeuYF X-Received: by 2002:a62:fb05:: with SMTP id x5-v6mr11960141pfm.210.1529297347397; Sun, 17 Jun 2018 21:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529297347; cv=none; d=google.com; s=arc-20160816; b=ZPeBleuIzlfdyMUbrtVoxjb+ywPqZ/TanqQF0AtUIkaDdlkjBRRto4d9i518mTxkPK ZR1zeGEvQmoOnjhs9rBlbTvUfpMgumzp6aZG1FmHVg1KcFSD8Vx085fbuIRC1j5ZdOq+ C0K6L1BFi5qNY+dAEsuV2mvXrvd4c6lq0yyeCQWK/lD6+vyjrmG64oeeuM+UiVxEZBmg DdiZlcO4yzki6x8WiUJv0J24FvmbuoPsHO68SanYGF69Prtjtm8bJNYIfhp/bVAsF0Fq XsrJnrq5UIJZl79VtI2uXLny9BroTg0FTs4Wz8cr4WewCcQPzLrCiqWJHzkZ1qELBapZ zSHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=LswBJGUkNIBiFym3S1x186VkztdZyzNgaF6pOJYQENE=; b=PKL4/Jbju8rkBU6me2CMpT2ghcTcYpxmp3XgIDbfNSXlv5o/qtX/ttVUnBSFmE+sZc U/BfTY1WHuxL3UjgTwTT3izVqGxknqfjkCtH4/g3OPj396wsVfoD1hKTNqQtK7TqGqoZ +vpB82A4quDuiLgC3NA/x6cw2gSfFqS+2indOLEZJt4Lu9R62fIx2S2gIo51RsBCeIAy jexQCnoTVKJR0GGGscYyLz0XR9YTKnlc+JgxrzrHFqolzV1QXJM748xtQOhzW/jBUUF9 fCf5VW976T0rhaMmRQHILSipBz0PsuX/FYrbLP7iXTr4ucDTiCfrPpwe6LhTrhBmwW1U Lrag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5-v6si13140442pfn.109.2018.06.17.21.48.28; Sun, 17 Jun 2018 21:49:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753936AbeFREq7 (ORCPT + 99 others); Mon, 18 Jun 2018 00:46:59 -0400 Received: from gate.crashing.org ([63.228.1.57]:59514 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751462AbeFREq6 (ORCPT ); Mon, 18 Jun 2018 00:46:58 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w5I4kYJs011416; Sun, 17 Jun 2018 23:46:35 -0500 Message-ID: <33924c2e545b2dfabf2849d9c485f165c339323f.camel@kernel.crashing.org> Subject: Re: [RFC PATCH 5/5] fsi/scom: Major overhaul From: Benjamin Herrenschmidt To: Alistair Popple , openbmc@lists.ozlabs.org Cc: Joel Stanley , Andrew Jeffery , Greg Kroah-Hartman , Linux Kernel Mailing List Date: Mon, 18 Jun 2018 14:46:33 +1000 In-Reply-To: <1908243.hVhg7auBNd@new-mexico> References: <20180612051911.20690-1-benh@kernel.crashing.org> <1908243.hVhg7auBNd@new-mexico> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.2 (3.28.2-1.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2018-06-18 at 14:09 +1000, Alistair Popple wrote: > On Sunday, 17 June 2018 11:22:11 AM AEST Benjamin Herrenschmidt wrote: > > On Sun, 2018-06-17 at 11:17 +1000, Benjamin Herrenschmidt wrote: > > > > > > We have everything that cronus needs and more than pdbg needs afaik :-) > > Yep, has what we need and more (such as put scom under mask and indirect scom). > Only other useful thing would be repeated getsom/putscom operations (eg. read > the same scom address n times) as they would help with ADU access which can do > autoincrement or scanscom (although we should just use the scan engine directly > for that so not a big issue). > > > + for (retries = 0; retries < SCOM_MAX_RETRIES; retries++) { > > + rc = raw_get_scom(scom, value, addr, &status); > > + if (rc) { > > + /* Try resetting the bridge if FSI fails */ > > + if (rc != -ENODEV && retries == 0) { > > + fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG, > > + &dummy, sizeof(uint32_t)); > > + rc = -EBUSY; > > + } else > > + return rc; > > + } else > > + rc = handle_fsi2pib_status(scom, status); > > + if (rc && rc != -EBUSY) > > + break; > > + if (rc == 0) { > > + rc = handle_pib_status(scom, > > + (status & SCOM_STATUS_PIB_RESP_MASK) > > + >> SCOM_STATUS_PIB_RESP_SHIFT); > > + if (rc && rc != -EBUSY) > > + break; > > + } > > + if (rc == 0) > > + break; > > + msleep(1); > > + } > > The rc handling above took me a little while to grok but I didn't come up with a > cleaner alternative and I think it's correct. Ack-by or Reviewed-by tag pls ? :-) Cheers, Ben. > - Alistair > > > > > > > That said, cronus does a bunch of other stupid things that I'm still > > > trying to figure out how to fix. > > > > > > We might need to create a /dev/cfam rather than going through that > > > magic sysfs "raw" file, and I wouldn't mind using a single IDA so that > > > all the devices below a given FSI slace (cfam itself, sbefifo, occ, > > > ...) have the same "number". > > > > Also while we're at reworking how all this is exposed to our broken > > userspace, I wouldn't mind putting all these dev entries under a > > directory, if I can figure out how to do that (I haven't really looked > > yet). > > > > /dev/fsi/{cfamN,sbefifoN,occN, ...} and possibly similar by-id and by- > > path that other subsystems use, so we have something more deterministic > > than the "random number" crap we do now. > > > > We can always keep hacks to do symlinks in our kernel tree until we > > have converted all our userspace users. > > > > We currently control the only userspace users of this, so now is a good > > time to cleanup how we expose things. This won't always be the case. > > > > Cheers, > > Ben. > > > > > >