Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ek6UU-0002aK-Gk for mharc-grub-devel@gnu.org; Fri, 09 Feb 2018 06:05:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ek6UO-0002S8-Su for grub-devel@gnu.org; Fri, 09 Feb 2018 06:05:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ek6UL-0003Wo-NY for grub-devel@gnu.org; Fri, 09 Feb 2018 06:05:08 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:46092) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ek6UL-0003WR-6C for grub-devel@gnu.org; Fri, 09 Feb 2018 06:05:05 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w19B38mj146266; Fri, 9 Feb 2018 11:05:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=DC6DXfPCoB56P3P/KOLZZC3AwZyv+p8hnCSK9JHMLYI=; b=tGFJOy+G7qnnXbxIH4tKfZYDzjQSYFl4CXeaInaWp6dVFYssHQokg0HkhfUJ2iTuafF5 o5X5Jhh/IfRzRF8c+1g9WiaVTTzzHN6qk8C5XJAHlSX7JSCnX2LSrV1Yj0H4aFvLD5bu 162zE009SbB4YLu+fDXwFgpv6hbtODsdRK1Rdsdol0LB3U/t0ItdNFfxUeP8vq94IFkn diaPvJTTcmPN4yTIK+DMJjQhUmgeSrkATy2cl/4lqzUUOkbQD21dnLdkMdhdwNd8c6vC LIMrgXSBss6927h8VA4j9Av9p8LCMB9GMpCkVNKMv2fWRNz+cSu/Ym4zFRPzDAt911mk +w== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2g19jmr9a0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Feb 2018 11:05:01 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w19B51Wc017603 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 9 Feb 2018 11:05:01 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w19B50lB005682; Fri, 9 Feb 2018 11:05:00 GMT Received: from olila.local.net-space.pl (/10.175.188.121) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 09 Feb 2018 03:04:59 -0800 Date: Fri, 9 Feb 2018 12:04:56 +0100 From: Daniel Kiper To: Eric Snowberg Cc: The development of GNU GRUB , John Paul Adrian Glaubitz Subject: Re: [PATCH V2] sparc64: fix OF path names for sun4v systems Message-ID: <20180209110456.GC31868@olila.local.net-space.pl> References: <1517374188-175569-1-git-send-email-eric.snowberg@oracle.com> <20180207115313.GB31868@olila.local.net-space.pl> <8E3B6E60-0D25-45AB-8CDC-0EB149FCB95D@oracle.com> <20180208151134.GW31868@olila.local.net-space.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8799 signatures=668665 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802090142 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.85 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Feb 2018 11:05:13 -0000 On Thu, Feb 08, 2018 at 08:37:27AM -0700, Eric Snowberg wrote: > > On Feb 8, 2018, at 8:11 AM, Daniel Kiper wrote: > > On Wed, Feb 07, 2018 at 10:39:00AM -0700, Eric Snowberg wrote: > >>> On Feb 7, 2018, at 4:53 AM, Daniel Kiper wrote: > >>> On Tue, Jan 30, 2018 at 08:49:48PM -0800, Eric Snowberg wrote: > >>>> Fix the Open Firmware (OF) path property for sun4v SPARC systems. > >>>> These platforms do not have a /sas/ within their path. Over time > >>>> different OF addressing schemes have been supported. There > >>>> is no generic addressing scheme that works across every HBA. > >>>> > >>>> Signed-off-by: Eric Snowberg > >>> > >>> In general Reviewed-by: Daniel Kiper ... > >>> > >>> Just a few comments below... > >>> > >>>> --- > >>>> V2: > >>>> - Requested coding style changes > >>>> --- > >>>> grub-core/osdep/linux/ofpath.c | 148 +++++++++++++++++++++++++++++++++++++++- > >>>> 1 files changed, 145 insertions(+), 3 deletions(-) > >>>> > >>>> diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c > >>>> index dce4e59..5369508 100644 > >>>> --- a/grub-core/osdep/linux/ofpath.c > >>>> +++ b/grub-core/osdep/linux/ofpath.c > >>>> @@ -38,6 +38,46 @@ > >>>> #include > >>>> #include > >>>> > >>>> +#ifdef __sparc__ > >>> > >>> I have discussed this with Vladimir. It looks that this will not > >>> work if you try to cross-install SPARC GRUB2 binary using e.g. > >>> x86 grub-install. By default it should work. However, we will also > >>> have other issues here, like lack of access to OF firmware/paths, > >>> which make such configs unusable anyway. So, I would leave this patch > >>> as is for time being. If somebody cares then he/she should fix it. > >>> > >>> Anyway, I will add something like that into the commit message before committing. > >> > >> That is fine with me. > > > > Great! Thanks! > > > >>>> +typedef enum > >>>> + { > >>>> + GRUB_OFPATH_SPARC_WWN_ADDR = 1, > >>>> + GRUB_OFPATH_SPARC_TGT_LUN, > >>>> + } ofpath_sparc_addressing; > >>>> + > >>>> +struct ofpath_sparc_hba > >>>> +{ > >>>> + grub_uint32_t device_id; > >>>> + ofpath_sparc_addressing addressing; > >>>> +}; > >>>> + > >>>> +static struct ofpath_sparc_hba sparc_lsi_hba[] = { > >>>> + /* Rhea, Jasper 320, LSI53C1020/1030. */ > >>>> + {0x30, GRUB_OFPATH_SPARC_TGT_LUN}, > >>>> + /* SAS-1068E. */ > >>>> + {0x50, GRUB_OFPATH_SPARC_TGT_LUN}, > >>>> + /* SAS-1064E. */ > >>>> + {0x56, GRUB_OFPATH_SPARC_TGT_LUN}, > >>>> + /* Pandora SAS-1068E. */ > >>>> + {0x58, GRUB_OFPATH_SPARC_TGT_LUN}, > >>>> + /* Aspen, Invader, LSI SAS-3108. */ > >>>> + {0x5d, GRUB_OFPATH_SPARC_TGT_LUN}, > >>>> + /* Niwot, SAS 2108. */ > >>>> + {0x79, GRUB_OFPATH_SPARC_TGT_LUN}, > >>>> + /* Erie, Falcon, LSI SAS 2008. */ > >>>> + {0x72, GRUB_OFPATH_SPARC_WWN_ADDR}, > >>>> + /* LSI WarpDrive 6203. */ > >>>> + {0x7e, GRUB_OFPATH_SPARC_WWN_ADDR}, > >>>> + /* LSI SAS 2308. */ > >>>> + {0x87, GRUB_OFPATH_SPARC_WWN_ADDR}, > >>>> + /* LSI SAS 3008. */ > >>>> + {0x97, GRUB_OFPATH_SPARC_WWN_ADDR}, > >>>> + {0, 0} > >>>> +}; > >>>> + > >>>> +static const int LSI_VENDOR_ID = 0x1000; > >>>> +#endif > >>>> + > >>>> #ifdef OFPATH_STANDALONE > >>>> #define xmalloc malloc > >>>> void > >>>> @@ -338,6 +378,67 @@ vendor_is_ATA(const char *path) > >>>> return (memcmp(bufcont, "ATA", 3) == 0); > >>>> } > >>>> > >>>> +#ifdef __sparc__ > >>>> +static void > >>>> +check_hba_identifiers (const char *sysfs_path, int *vendor, int *device_id) > >>>> +{ > >>>> + char *ed = strstr (sysfs_path, "host"); > >>>> + size_t path_size; > >>>> + char *p, *path; > >>>> + char buf[8]; > >>>> + int fd; > >>>> + > >>>> + if (!ed) > >>>> + return; > >>>> + > >>>> + p = xstrdup (sysfs_path); > >>>> + ed = strstr (p, "host"); > >>>> + > >>>> + if (!ed) > >>>> + goto out; > >>> > >>> In normal circumstances this will never ever fail. > >>> If you are OK I will drop this "if" before committing. > >> > >> I put that in for the case if the xstrdup above can not allocate memory. > >> Then p will be null, the strstr will fail and then we should jump to out. > > > > If this would be the case then you should check p for NULL before > > strstr() call. AIUI its behavior is not well defined if one of > > arguments is NULL. Anyway, xstrdup() does not return if it fails. > > So, we do not have such problem here. > > Ok, do you want to remove it? Or should I send out an updated patch? I will remove it before commit. Daniel