From patchwork Wed Jun 13 06:40:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 928698 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 415HG013J9z9s2g for ; Wed, 13 Jun 2018 16:41:12 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AuvD5Pey"; 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 415HFz6RFNzF0dm for ; Wed, 13 Jun 2018 16:41:11 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au 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="AuvD5Pey"; 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:c01::243; helo=mail-pl0-x243.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AuvD5Pey"; dkim-atps=neutral Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::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 415HFw0gmjzDrpC for ; Wed, 13 Jun 2018 16:41:07 +1000 (AEST) Received: by mail-pl0-x243.google.com with SMTP id c23-v6so924417plz.12 for ; Tue, 12 Jun 2018 23:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=Cxg1VR2RSR1oOuap66QTayHzvHQEDmmsylzvowpwJt4=; b=AuvD5Peyhz9f7kCONEhcANyJA/NrdBMfDqIY1ivq2wBkOAkcoppjpk9JckgcdkK+L9 TKwEJAHp/96k2PabLyWwZw/rG4YOtBRIbypPaHIPVgDLKXquj8EG+cBTbbPaKJ6kb43o Ijh2y2ZVYOo1OnXGTHpl7+V23Pbp5st91k9aZ2y2uJeFsO0rcELZR/wNIPkEes5JL5gL pNzkViTY0Z4GmeAMdoGQx0CAJuEZk2pfSfp7Z/cXdXIQ+un91G0X7QSUwUYfdtiByNOY PHPDSBGGo6wdgxgoVfpijy5WCioPvU47DvYlPWK6TLDiu4XWPX6VzXbrdnV+xnnw4GCT /OeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=Cxg1VR2RSR1oOuap66QTayHzvHQEDmmsylzvowpwJt4=; b=Fq6wD9Vd2J9qPs39vDLtswDppXo5AiGQqPmeMU4l2YmKQDeazpQykDVnhwH2t5l8xj 3dF8gKnOuvufQu4hMO88C4MB+46Kk5D/QxgBcyVzQXftjvU90hSFYl9A1mkDLf7uT77d OQTbDfuld6G8jdkJWkpXLA4afg6c2fj7u8fQtkhoifZVc26z8N/rN7d1ia+Llh/Dpzdj 0xTM48oK4ummuphpSWd3D7CJFM8JwIG23WAEbAnEZ07eTOTZ+nUqG1gPaCoJ4nbKidfH ylTbU1nKNWEq154FxhLS8Pxb3liCs3CywvEiQbDuk1/EUZ/XzDH8gw+zI+AZMpWEvbOH dSFQ== X-Gm-Message-State: APt69E1tKkinF4B6x6d/CC5Yz3Qbl/OHLwW1F+JqAfKHarKgTeK2vnN0 gadT5cIy8yoMj+DJAZ9PHq5wxND3 X-Google-Smtp-Source: ADUXVKIkMPlSLAW23BXqqS1JBMoJ7/RYTCIsykYlQCDxu6KZrwmphZdpPKGTV80N0fY9q8JoloE0IA== X-Received: by 2002:a17:902:112b:: with SMTP id d40-v6mr3831362pla.123.1528872065882; Tue, 12 Jun 2018 23:41:05 -0700 (PDT) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id x17-v6sm2088570pgv.15.2018.06.12.23.41.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 23:41:05 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Wed, 13 Jun 2018 16:11:01 +0930 From: Joel Stanley To: pdbg@lists.ozlabs.org Date: Wed, 13 Jun 2018 16:10:53 +0930 Message-Id: <20180613064054.20625-2-joel@jms.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613064054.20625-1-joel@jms.id.au> References: <20180613064054.20625-1-joel@jms.id.au> Subject: [Pdbg] [PATCH 1/2] Make i2c backend possible on all ARM machines 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" It's not only devices that have the AMI i2c path that can use pdbg over i2c. I chose not to plumb in the access check, as this can be done when attempting to open the device (otherwise we're duplicating that check). Signed-off-by: Joel Stanley --- src/options_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/options_arm.c b/src/options_arm.c index 2936058ae684..72985d3e2f87 100644 --- a/src/options_arm.c +++ b/src/options_arm.c @@ -48,7 +48,7 @@ void print_backends(FILE *stream) bool backend_is_possible(enum backend backend) { - if (backend == I2C && access(AMI_BMC, F_OK) == 0) + if (backend == I2C) return true; if (backend == KERNEL && access(OPENFSI_BMC, F_OK) == 0) return true; From patchwork Wed Jun 13 06:40:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 928699 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 415HG53lphz9s2g for ; Wed, 13 Jun 2018 16:41:17 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uISCEdSZ"; 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 415HG43TllzF0Vt for ; Wed, 13 Jun 2018 16:41:16 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au 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="uISCEdSZ"; 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=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uISCEdSZ"; 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 415HG05kZJzF0Vt for ; Wed, 13 Jun 2018 16:41:12 +1000 (AEST) Received: by mail-pf0-x242.google.com with SMTP id a63-v6so866146pfl.1 for ; Tue, 12 Jun 2018 23:41:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=A7n4vk0HYli1l1Ec9fkSRjpkmikGUpPy8pBMiFfnosQ=; b=uISCEdSZlJxU0onymRv6fYdiUDVn3HZt68+WVaFMqLpEtlueyNweRZqL0ij+/onySo MPvvpuzNyBSdrepm166gvpjiKwQCTiX4qULFsCz3tdM3qMh0hy6+lp6OPkL+x1gFqKIO yLmRlrDq3jsAlC3g5ipTveoEPPoVei2yTzyJnH3pxoHYtlVsitzG8aGdq9stu0tNSfDi aRv477caJhdE4rKqVgyzEe4Ln5WGb0/nSjADCpauGjkhvOtZxNdW4JE/DhflPohY3ioP X2EflnF2J9IP2GBc/1U1+ZqyNujI6cauiHHRxyzt25d3NGK9hK37lxvpkxaK0MYK7SkC pamw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=A7n4vk0HYli1l1Ec9fkSRjpkmikGUpPy8pBMiFfnosQ=; b=NykTQi6ibtQx5Adw2GBqnzncGYfuys9cfQClPBcPCs3dgIvU1Q5JV42E2FmLNCiBgS SzmSUETfrSnYP4+/lbhWhzHD8gyUyCMXXT3tPdQIy3wT/a5eOzfVY7JgmnTaiKaOGSCU AW2SE1SMcDaha9Mqnr3fb0CWhm9XmHXdIpIF23oOC5j7akCdscoRNu+1KmhgI0gdAIhr OI01sGzmZ0m9r4kO8HB1d6iVeLw1CQYGJqQbKqzboqXOQwRw8TIm52qqhY37lj9Ot/kr 9DoakOh9XpRnNOFNydWITcwy7fgZGFjSZAFEm0SoTvmktG3wOAw+C0pkp+1OKngV8g5K DzFg== X-Gm-Message-State: APt69E2NI5mEhxpT7qf2pRPiAUA1aNEBr4lkozW5bHgPdnx62lzgzJtu t88fjndS5ehJFjq2VkbEGRAuIwrR X-Google-Smtp-Source: ADUXVKKgxfyZT8o7aEsUlCTEgKrJliIDw//9VYur1/4UPFDF3+ZkzYDrnngLX7629jH4FqPHHfiHpQ== X-Received: by 2002:a62:3dca:: with SMTP id x71-v6mr3633482pfj.134.1528872070550; Tue, 12 Jun 2018 23:41:10 -0700 (PDT) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id l15-v6sm1685020pfg.88.2018.06.12.23.41.08 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 23:41:09 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Wed, 13 Jun 2018 16:11:06 +0930 From: Joel Stanley To: pdbg@lists.ozlabs.org Date: Wed, 13 Jun 2018 16:10:54 +0930 Message-Id: <20180613064054.20625-3-joel@jms.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613064054.20625-1-joel@jms.id.au> References: <20180613064054.20625-1-joel@jms.id.au> Subject: [Pdbg] [PATCH 2/2] i2c: Add FORCE option 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" On P8 machines with OpenBMC, the i2c address is claimed by the OCC hwmon driver. We can ignore it and talk to the device anyway by passing I2C_SLAVE_FORCE instead of I2C_SLAVE to the open ioctl. This might not be the best idea, but it works fine for eg. getscom. Signed-off-by: Joel Stanley --- We could put this behind a --force option. Also, when the user does not pass --force, we could advise them to unbind the hwmon driver. I don't know what OpenBMC userspace does when you unbind it - it may decide to shut down the machine. Signed-off-by: Joel Stanley --- libpdbg/i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpdbg/i2c.c b/libpdbg/i2c.c index b1580e176023..aa0a73ef8c19 100644 --- a/libpdbg/i2c.c +++ b/libpdbg/i2c.c @@ -34,7 +34,7 @@ struct i2c_data { static int i2c_set_addr(int fd, int addr) { - if (ioctl(fd, I2C_SLAVE, addr) < 0) { + if (ioctl(fd, I2C_SLAVE_FORCE, addr) < 0) { PR_ERROR("Unable to set i2c slave address\n"); return -1; }