Received: by 10.223.185.116 with SMTP id b49csp6356490wrg; Thu, 8 Mar 2018 06:12:46 -0800 (PST) X-Google-Smtp-Source: AG47ELvNeLtLEnG/yxgEP1fYH/Mwo8wNTWCoywKVdjqwRQv1/ukIf2BsKrCCFmszz51IYnUAQoTo X-Received: by 10.99.123.74 with SMTP id k10mr21362173pgn.217.1520518366118; Thu, 08 Mar 2018 06:12:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520518366; cv=none; d=google.com; s=arc-20160816; b=e0QywHoIsbpXyYuJTvEGUlDhAxa3oMB5n/JYJongpHKxFzEBCqBZ+O+FnBvagcUcT9 jjBfkwaPlFolRUxzY7SmcdUfsOJfpsEH23K2tfohFmSeGXvTV7+RCpr64OAxfp13JsSM Z7vsnHbtMaTGDQbOnYYghWd0X2LABjNwErFHIe9/Tn8YULpcQ9RYwalfhWTDp4VG7vxF xxlo77xXaZQ+48D5HYnCf7HDiC/VJn8DdhFcOnryFHmbGkWVluNS9QmL5byTxa50gKFm /cpc/aFlK/LEUCVtHGmtGQni5keTOfHGNExMPQIegGNww1/MPR/6CcfQuGLKrpSassZI Fl8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dkim-signature :arc-authentication-results; bh=cCGIpwcc3l3yzS4r0y0GjaTm5aSYTv/cTG4d1TGpr0o=; b=xw8bmc0nY6HcEFH5UkMZcXjqPyK473GR2z5riRtiSZBY/QoXrXGXDGFjDc+3uksLLk bEbr4bo/F6fJ3MD28B3UdQIgt3emYCX8RDAXST1buKQh0/fOtDdMe/lX+NEKJ7RimFaW W0IJsP12aE6u8w4ippBeE7lrc55KDcIsfF9taJimfzTGXWkgFhxSKVMbeNHMf5KO06O2 6UNClbERHi4yDv0qjaRPxnZ8z3EQByWHgmI8OhcjLSTqytqA3eKjwslNdbNMULwUtofZ Ffj3ODnRGCBsPy084Pw9vmWjuT+cBT1n5D1CR35WmvNX/2+KlucLgriS/Ue6oNOe229i VOWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JAP5ZmG8; 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 y4si13097740pgq.380.2018.03.08.06.12.31; Thu, 08 Mar 2018 06:12:46 -0800 (PST) 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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JAP5ZmG8; 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 S966117AbeCHOKz (ORCPT + 99 others); Thu, 8 Mar 2018 09:10:55 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:42864 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965827AbeCHOKi (ORCPT ); Thu, 8 Mar 2018 09:10:38 -0500 Received: by mail-pg0-f67.google.com with SMTP id y8so2245755pgr.9 for ; Thu, 08 Mar 2018 06:10:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=cCGIpwcc3l3yzS4r0y0GjaTm5aSYTv/cTG4d1TGpr0o=; b=JAP5ZmG8D2zDf0kAkz0Sf6InRVi94K4XEJ6C4UYaQhiIjBmINpAZRVreh3hJeWIhl3 FsIzHYnzwZFN/s++glk1S9U+2Xpk0OPPNCB6Oma+9YlDSLpVXTLE0kwsSFD4BYyzyzCi M7pV+xXjR5JrZa/kvB0BTu0SrhLHItF/yuqMeXu0HUNO/MdbUeVY5IJLGDPX/0xI7/5c ciua7OLqL5cfWZ23BGWf+Cz1JaONAvGJPJbMyGg3GJr9+jhsH6LIRXCSBi4EyFgWPBQ4 +fiffX7a+9a4zGU64yDelt6Vn8JfnaHipNEhZy/g5fyzz6kYs/lIPhEa8s4okDgV/bU8 R/2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=cCGIpwcc3l3yzS4r0y0GjaTm5aSYTv/cTG4d1TGpr0o=; b=LMTjCGYUhOLK7O2EtYn4+hcHy3FoNcR/TtHoOJAXqGqKVJPXa4UAxtSOc6WkCCMWEV fA8AxrXAFk8De7fvSmsIAIhULcz9Idkr/8A/LtBmsTJqUmELCP3qirfNFkXSjNud06ez cW63SEI+obZGHTPg1zbeACDzs4vy+CK/oIVWxCVZrVozx4uo0JeI1bQdAuL68bTLCUUJ XdS69zydjTtTnCXh3EmBwG08Bm6mAkhAoYhym/GxjVx1RL5qbgQBMhAWJuWOoGpndEXI 8FBbiOFrFBB41iA5f6cApLylncBKnqBrYqxyE6oRM4p28Qqi8Y3p9fKhq7q5GsdGmQVM Cv4w== X-Gm-Message-State: APf1xPAWkT8j+TCx4Yx1mYxQ+mhpcQLdfy/RJwesvF9Ju5hkIAUp6jvC W24sni1UVFj973zEBCV5IQ== X-Received: by 10.98.161.10 with SMTP id b10mr26481612pff.240.1520518237545; Thu, 08 Mar 2018 06:10:37 -0800 (PST) Received: from serve.minyard.net (serve.minyard.net. [2001:470:b8f6:1b::1]) by smtp.gmail.com with ESMTPSA id g5sm37583042pfh.6.2018.03.08.06.10.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Mar 2018 06:10:36 -0800 (PST) Received: from [192.168.27.3] (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPSA id ACE93688; Thu, 8 Mar 2018 08:10:34 -0600 (CST) Reply-To: minyard@acm.org Subject: Re: [PATCH] ipmi:ssif: Fix double probe from tryacpi and trydmi To: Jiandi An , arnd@arndb.de, gregkh@linuxfoundation.org Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <1520401742-29371-1-git-send-email-anjiandi@codeaurora.org> <1bc40690-c46f-e7fd-1beb-37e362cd8146@codeaurora.org> From: Corey Minyard Message-ID: <7814a839-a718-7437-3f69-8b4f090ccbcf@acm.org> Date: Thu, 8 Mar 2018 08:10:33 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1bc40690-c46f-e7fd-1beb-37e362cd8146@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/07/2018 05:59 PM, Jiandi An wrote: > > > On 03/07/2018 07:34 AM, Corey Minyard wrote: >> On 03/06/2018 11:49 PM, Jiandi An wrote: >>> IPMI SSIF driver's parameter tryacpi and trydmi both >>> are set to true.  The addition of IPMI DMI driver to >>> create platform device for each IPMI device causes >>> SSIF probe to be done twice on the same SMB I2C address >>> for BMC.  Fix is to not call trydmi if tryacpi is able >>> to find I2C address for BMC from SPMI ACPI table and >>> probe successfully. >> >> Why are you trying to do this?  Is something bad happening? >> >> SPMI is not the preferred mechanism for detecting a device, >> the preferred mechanism should be the acpi match table or >> OF, followed by DMI, followed by SPMI.  In fact, it might be >> best to just remove SPMI. >> >> -corey > > > On our ARM64 platform, SSIF is the IPMI interface for host to > BMC communication and it is described in ACPI SPMI table including > the I2C address.  The driver would get the SSIF device from > IPI0001 ssif_acpi_match[] and probe.  It worked fine with no issues. > > Then it was reported dmidecode does not show the correct SSIF > device information including correct I2C address.  So SSIF device > description is also added in SMBIOS table.  It worked fine with no > issues until this patch. > > 0944d88 ipmi: Convert DMI handling over to a platform device > > We would see error message indicating trydmi via > platform_driver_register fails with -EEXIST during boot. > > [    9.385758] ipmi_ssif: probe of dmi-ipmi-ssif.0 failed with error -17 > > This is because tryacpi ran first and successfully completed > new_ssif_client() (which adds address to ssif_info) and eventually > ssif_probe() > > ssif_tryacpi >     spmi_find_bmc() >         try_init_spmi() >             new_ssif_client() > > Since both tryacpi and trydmi are set to true as module parameter > with no permission and not exposed to /sys/module/ipmi_ssif/parameters, > it triggers the following path down to dmi_ipmi_probe() and > new_ssif_client() which fails ssif_info_find() finds the address > added to ssif_info already in the ssif_tryacpi path. > > ssif_trydmi >     platform_driver_register(&ipmi_driver) >         __platform_driver_register() >             driver_register() >                 bus_add_driver() >                     driver_attach() >                         bus_for_each_dev() >                             __driver_attach() >                                 driver_probe_device() >                                     ssif_platform_probe() >                                         dmi_ipmi_probe() >                                             new_ssif_client() > > Are you suggesting to not do tryacpi at all and just rely on > trydmi? Basically, yes.  SPMI is really designed for early detection of interfaces before ACPI proper comes up.  You should have the IPMI device in your ACPI tree. My inclination is to remove SPMI support from the IPMI driver. -corey > > I was looking at the following patch to understand more about > the added ipmi_dmi driver. > > 9f88145 ipmi: Create a platform device for a DMI-specified IPMI interface > > It's creating a platform device for each IPMI device in the DMI > table including SSIF device, for auto-loading IPMI devices from > SMBIOS tables. > > Are you suggesting removing SSIF device description from ACPI > SPMI table and remove ssif_tryacpi logic all together? > > But the commit description mentions ... > > "This also adds the ability to extract the slave address from > the SMBIOS tables, so that when the driver uses ACPI-specified > interfaces, it can still extract the slave address from SMBIOS." > > This made me think SSIF driver can still use ACPI-specified > interface.  It made me think it implies SSIF device can be > described in ACPI SPMI table and SMBIOS table.  Both spec > did not say they cannot. > > What's your recommended way of fixing this double probing? > > Thanks > > >> >>> Signed-off-by: Jiandi An >>> --- >>>   drivers/char/ipmi/ipmi_ssif.c | 35 >>> ++++++++++++++++++++++++----------- >>>   1 file changed, 24 insertions(+), 11 deletions(-) >>> >>> diff --git a/drivers/char/ipmi/ipmi_ssif.c >>> b/drivers/char/ipmi/ipmi_ssif.c >>> index 9d3b0fa..5c57363 100644 >>> --- a/drivers/char/ipmi/ipmi_ssif.c >>> +++ b/drivers/char/ipmi/ipmi_ssif.c >>> @@ -1981,29 +1981,41 @@ static int try_init_spmi(struct SPMITable >>> *spmi) >>>       return new_ssif_client(myaddr, NULL, 0, 0, SI_SPMI, NULL); >>>   } >>> -static void spmi_find_bmc(void) >>> +static int spmi_find_bmc(void) >>>   { >>>       acpi_status      status; >>>       struct SPMITable *spmi; >>>       int              i; >>> +    int              rc = 0; >>>       if (acpi_disabled) >>> -        return; >>> +        return -EPERM; >>>       if (acpi_failure) >>> -        return; >>> +        return -ENODEV; >>>       for (i = 0; ; i++) { >>>           status = acpi_get_table(ACPI_SIG_SPMI, i+1, >>>                       (struct acpi_table_header **)&spmi); >>> -        if (status != AE_OK) >>> -            return; >>> +        if (status != AE_OK) { >>> +            if (i == 0) >>> +                return -ENODEV; >>> +            else >>> +                return 0; >>> +        } >>> -        try_init_spmi(spmi); >>> +        rc = try_init_spmi(spmi); >>> +        if (rc) >>> +            return rc; >>>       } >>> + >>> +    return 0; >>>   } >>>   #else >>> -static void spmi_find_bmc(void) { } >>> +static int spmi_find_bmc(void) >>> +{ >>> +    return -ENODEV; >>> +} >>>   #endif >>>   #ifdef CONFIG_DMI >>> @@ -2104,12 +2116,13 @@ static int init_ipmi_ssif(void) >>>                      addr[i]); >>>       } >>> -    if (ssif_tryacpi) >>> +    if (ssif_tryacpi) { >>>           ssif_i2c_driver.driver.acpi_match_table    = >>>               ACPI_PTR(ssif_acpi_match); >>> - >>> -    if (ssif_tryacpi) >>> -        spmi_find_bmc(); >>> +        rv = spmi_find_bmc(); >>> +        if (!rv) >>> +            ssif_trydmi = false; >>> +    } >>>       if (ssif_trydmi) { >>>           rv = platform_driver_register(&ipmi_driver); >> >> >