Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1p0kSm-0002lT-BL for mharc-grub-devel@gnu.org; Thu, 01 Dec 2022 09:22:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0kSk-0002lJ-BV for grub-devel@gnu.org; Thu, 01 Dec 2022 09:22:54 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0kSh-0005f1-Tc for grub-devel@gnu.org; Thu, 01 Dec 2022 09:22:54 -0500 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B1EIhWp006513; Thu, 1 Dec 2022 14:22:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=fMka2PORiLWH8sMnao/AVuT+5ks+7+Yoh74c/x4thBs=; b=L6teEQ4VMSrhO4sV/KR4qHKbLf9b+yi3+PteR23i3EkrJKGlR5AaBiqSEnh4DG7LqVkQ O7ufJnr12uAj5STZf0yJeqDQramRXefEK/B1iJm/jGrbLY2OBvBSZKuktGkGUjrwyTOx Nuv9DWGtZRzZO6mpSp6x8Xjkd62RahG7/WJ67vIKo67nxJudmxs2N4gmG+ragUR64uE/ l+FbPlthmjO3v9Us44ny97y92LSQqwYyxQXW/HX9Pe0cXSgv3sbt1q6AosTKeZC3OD0c R1xICNCfbyBRZ8MRVCJAMe0tzN9EL8nTdsu6H+n8dLCMFUi6U/tyLTQlMTTq8L+m8LIW 6g== Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m6wwyg2jk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Dec 2022 14:22:47 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2B1ELXsR024881; Thu, 1 Dec 2022 14:22:45 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([9.208.129.116]) by ppma01dal.us.ibm.com with ESMTP id 3m3aean9un-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Dec 2022 14:22:45 +0000 Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2B1EMiqI43254088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 1 Dec 2022 14:22:44 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3A13D5805D; Thu, 1 Dec 2022 14:22:44 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 800735805A; Thu, 1 Dec 2022 14:22:43 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Thu, 1 Dec 2022 14:22:43 +0000 (GMT) Message-ID: <2238198b-04de-942f-f814-ff007cc2fde6@linux.ibm.com> Date: Thu, 1 Dec 2022 09:22:42 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH 0/6] Dynamic allocation of memory regions and IBM vTPM v2 Content-Language: en-US To: Daniel Kiper Cc: The development of GNU GRUB , Glenn Washburn , Diego Domingos , dja@axtens.net, sudhakar@linux.ibm.com References: <20220811174104.1148447-1-diegodo@linux.vnet.ibm.com> <20221124175624.kicbqsuesqqjxvjd@tomti.i.net-space.pl> <71a82a45-7caa-3149-89a7-7fe11cd01540@linux.ibm.com> <663beab6-860e-1afb-5529-91c217c37c94@linux.ibm.com> <2ae2e7d7-b86b-4221-3328-3ce0fc4c0893@linux.ibm.com> <20221130231947.44624ef5@crass-HP-ZBook-15-G2> <90d31915-4714-9707-6051-31c18c3fe6d7@linux.ibm.com> <20221201140232.rggn7tryblu3yohd@tomti.i.net-space.pl> From: Stefan Berger In-Reply-To: <20221201140232.rggn7tryblu3yohd@tomti.i.net-space.pl> Content-Type: text/plain; charset=UTF-8; format=flowed X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: uMJMSN8TUyWCe7sSrzqzpSrn24q_bdUi X-Proofpoint-GUID: uMJMSN8TUyWCe7sSrzqzpSrn24q_bdUi Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-01_04,2022-12-01_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 priorityscore=1501 phishscore=0 suspectscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212010102 Received-SPF: pass client-ip=148.163.156.1; envelope-from=stefanb@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.257, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2022 14:22:54 -0000 On 12/1/22 09:02, Daniel Kiper wrote: > On Thu, Dec 01, 2022 at 08:43:56AM -0500, Stefan Berger wrote: >> On 12/1/22 00:19, Glenn Washburn wrote: >>> On Wed, 30 Nov 2022 17:42:40 -0500 >>> Stefan Berger wrote: >>>> On 11/30/22 16:24, Stefan Berger wrote: >>>>> On 11/30/22 14:47, Stefan Berger wrote: >>>>>> On 11/24/22 12:56, Daniel Kiper wrote: >>>>>>> Hi, >>>>>>> >>>>>>> Adding Sudhakar and Glenn... >>>>>>> >>>>>>> On Thu, Aug 11, 2022 at 02:40:58PM -0300, Diego Domingos wrote: >>>>>>>> Hello, >>>>>>>> >>>>>>>> This is an addition to the series sent from Daniel Axtens >>>>>>>> (https://lists.gnu.org/archive/html/grub-devel/2022-04/msg00064.html). >>>>>>>> >>>>>>>> Patch 'ieee1275: request memory with >>>>>>>> ibm,client-architecture-support' implements vectors 1-4 of >>>>>>>> client-architecture-support negotiation However, during some >>>>>>>> tests, we found this can be a problem if: >>>>>>>> >>>>>>>> - we have more than 64 CPUs >>>>>>>> - Hardware Management Console (HMC) is configured to minimum of >>>>>>>> CPUs >64 (for example, min of 200 CPUs) >>>>>>>> - Grub needs to request memory. >>>>>>>> >>>>>>>> If vector 5 is not implemented, Power Hypervisor will consider >>>>>>>> the default value for vector 5 and 64 will bet set as the >>>>>>>> maximum number of CPUs supported by the OS, causing the machine >>>>>>>> to fail to init. Today we support 256 CPUs (max) on Power, so we >>>>>>>> need to implement vector 5 and set the MAX CPUs bits to this >>>>>>>> value. >>>>>>>> >>>>>>>> The patches 11-15 aren't merged to the grub tree yet, so I'm >>>>>>>> sending those patches again together with my patch to implement >>>>>>>> vector 5 on top of them. >>>>>>>> >>>>>>>> The patches 11-15 contains the following: >>>>>>>> >>>>>>>> Daniel Axtens (4): >>>>>>>>    ieee1275: request memory with ibm,client-architecture-support >>>>>>>>    ieee1275: drop len -= 1 quirk in heap_init >>>>>>>>    ieee1275: support runtime memory claiming >>>>>>>>    [RFC] Add memtool module with memory allocation stress-test >>>>>>>> >>>>>>>> Stefan Berger (1): >>>>>>>>    ibmvtpm: Add support for trusted boot using a vTPM 2.0 >>>>>>> >>>>>>> I went through all patches and cannot see major problems with >>>>>>> them. Though there are a lot of minor things which have to be >>>>>>> fixed. Sadly due to number of them I cannot simply ignore that. >>>>>>> >>>>>>> Here is the list of the issues: >>>>>>>    - functions calls/sizeof(): e.g. "grub_printf()" should be >>>>>>> replaced with "grub_printf ()", add space before "(", in the >>>>>>> code; though I am OK with the former in comments and commit >>>>>>> messages, >>>>>>>    - casts: e.g. "*(grub_uint32_t *)data" should be replaced with >>>>>>> "*(grub_uint32_t *) data", add space between ")" and "data", >>>>>>>    - s/__attribute__((packed))/GRUB_PACKED/ >>>>>>>    - if you use grub_err_t type please test for GRUB_ERR_NONE >>>>>>> instead of !err or err; please do not use plain numbers, e.g. 0 >>>>>>> to substitute GRUB_ERR_NONE, >>>>>>>    - if you test pointers for NULL please test using NULL >>>>>>> constant instead of e.g. !ptr >>>>>>>    - if you use a value often please define constant for it; good >>>>>>> candidate for such change is at least 0x30000000 in the patch #3; >>>>>>> if constant definition is an overkill please comment what given >>>>>>> numbers/strings mean or at least where they come from, >>>>>>>    - please do not use "//" for comments, >>>>>>>    - I am OK with lines a bit longer than 80; so, please do not >>>>>>> wrap lines too early, >>>>>> >>>>>> This is a bit vague but I think I addressed them now. >>>>>> >>>>>>>    - year in the copyright should be 2022. >>>>>>> >>>>>>> The GRUB coding style is described here [1] and you can find good >>>>>>> example of coding style in the grub-core/kern/efi/sb.c file. >>>>>>> >>>>>>> Please take into account latest comments from Daniel A. and Glenn >>>>>>> too. >>>>>> >>>>>> I don't know how to support the memtool without --enable-mm-debug >>>>>> at the same time since the module seems to be missing then but the >>>>>> build system still expects it on 'make install'. Unless there's an >>>>>> existing example of how to do it I would not post with this patch. >>>>>> >>>>>> I can get it to create an empty module with this trick here but >>>>>> don't know whether this helps the cause. >>>>>> >>>>>> GRUB_MOD_FINI (memtools) >>>>>> { >>>>>> #ifdef MM_DEBUG >>>>>>    grub_unregister_command (cmd_lsmem); >>>>>>    grub_unregister_command (cmd_lsfreemem); >>>>>>    grub_unregister_command (cmd_sba); >>>>>> #else >>>>>>    (void) grub_unregister_command; >>>>>> #endif >>>>>> } >>>>>> >>>>>> >>>>> In 1/6 we have this here. Is this sufficiently gating the usage of >>>>> the code or do we need to use '#if defined(__powerpc__)' to only >>>>> compile code newly added powerpc-specific code  used due to this >>>>> flag being set? >>>>> >>>>> + >>>>> +      if (grub_strncmp (tmp, "IBM,", 4) == 0) >>>>> +       grub_ieee1275_set_flag >>>>> (GRUB_IEEE1275_FLAG_CAN_TRY_CAS_FOR_MORE_MEMORY); >>>> >>>> And yet another question: Is __i386__ actually using >>>> grub-core/kern/ieee1275/init.c ? I don't see it compiling this file >>>> but there's a #ifdef __i386__ in this file. >>> >>> Yes, there is a i386-ieee1275 target. It builds and the tests run >>> successfully, iirc. >> >> How is this target enabled? Just configuring on an i386 host doesn't >> seem to do it and I don't see an obvious configure option to build for >> it, either. > > ./configure --target=i386 --with-platform=ieee1275 ... I had to adjust the created symlist.h like this to make it compile at least: //#include <../include/grub/machine/pxe.h> //#include <../include/grub/machine/int.h> When trying to install this on my i386 VM I get this here: sudo grub-install /dev/vda --target=i386-ieee1275 Installing for i386-ieee1275 platform. grub-install: warning: cannot open directory `/usr/local/share/locale': No such file or directory. grub-install: warning: unknown device type vda1. grub-install: error: ofpathname: not found. Would this type of target produce a grub version that works on a VM that would otherwise work with i386-pc? And is this still a supported target? Stefan > > Daniel