Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp262756ybt; Thu, 25 Jun 2020 21:46:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVIXKqoufoRHoFEzCoPB1E732llm4gE7vlhDc9fTsR7TF239DCvFN79PoeW/WUQmrBNI6L X-Received: by 2002:aa7:df08:: with SMTP id c8mr1508859edy.372.1593146797514; Thu, 25 Jun 2020 21:46:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593146797; cv=none; d=google.com; s=arc-20160816; b=zxiD8XOR1Cb3Iw8G0Gcmx4MifE9pfVdNDiJMU3tE6jrkPoz7ZWK7ZkNgB/uwUmRLye NeMZYA7Z3P/Opse0L32wicSq3szMO1k7jVBkUzFe3ONEWcjt0QZfkxo13/jX0ps2EenA j0SzErObfxAd2Fi/sOexvnmsWawX9LDg7y8zUJ68j9bm2d+7BdNsn31tS3es7xfZ55By s6H/3qCRfPFkdIYBC6w+/KyBw+JzhxbqKFJSUUvzwXfsw98y1H/1sDPfk67/N+NBQBsv mY2UefwCHk5xXXKNR7bfbD7+0iFIq4U708CbS5/Uxc4Ch1+3bUJoR0GJtialdiHRi8q6 SDVA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=BKiv6PSUPUShTNVB35aApw+Lj36cJjZ/Ak+vo7YeZBs=; b=gqaY78ti1qToWXNhFRHPkFU2qc7MqofUKeomhR6lYSCDdOgTuM1+X5aXgO57AiClYj 27yKumkD4vTl9xPp7d9AAhaD3n2IdOCP1c5L0hC8rbwf7qtEH6b7kWjQau2kbr+YAZJ7 I46L06oGQXORcrqsuW2bAs+JCLX0a+gXPmFMsLGcmeNxnWSIZR15Plml+m0aMPkyIHcf xZgzzAfAbAa3DdTP9TkwgDukj/lfG6ct2TkuD3PrZnUzIVtmVcdWjiFOzHv/yLg8Cqn0 XzCtyehPk6vqugbpiQz1Mt7iBYUgsKa5VAoKqqbb+vKpWhewQQQ1uWHuQTGPbSgmQqFT mcow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=D9LBXStY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz26si4245471ejb.651.2020.06.25.21.46.14; Thu, 25 Jun 2020 21:46:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=D9LBXStY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728153AbgFZCnR (ORCPT + 99 others); Thu, 25 Jun 2020 22:43:17 -0400 Received: from mout.gmx.net ([212.227.17.20]:42843 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728132AbgFZCnQ (ORCPT ); Thu, 25 Jun 2020 22:43:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1593139375; bh=DYtHPfwpCJJKc0GqD63QONboqwpuMFw48ADI1vGBkfE=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=D9LBXStYT0ZyOfJPe078AUotHpvpwhf8u7T6/090nYLo4zv/t/yvuIaeB41sDEtHM 0X+58800Hz9TC1rg8vLQaLnznYmYYvELcnQEiXPqHOdIZ7MG6pfJQIVUbgUDRC7343 a8esRG8AVQ4orrqYxfty0FmLC0OBva/o8Ps0QObY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.51] ([88.152.145.75]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N7zBb-1ikz0u2xTH-0153gH; Fri, 26 Jun 2020 04:42:55 +0200 Subject: Re: [RFC PATCH 01/11] efi: Fix gcc error around __umoddi3 for 32 bit builds To: Atish Patra , linux-kernel@vger.kernel.org Cc: Ard Biesheuvel , linux-efi@vger.kernel.org, linux-riscv@lists.infradead.org, Masahiro Yamada , Palmer Dabbelt , linux-arm-kernel@lists.infradead.org References: <20200625234516.31406-1-atish.patra@wdc.com> <20200625234516.31406-2-atish.patra@wdc.com> From: Heinrich Schuchardt Autocrypt: addr=xypron.glpk@gmx.de; prefer-encrypt=mutual; keydata= mQINBE2g3goBEACaikqtClH8OarLlauqv9d9CPndgghjEmi3vvPZJi4jvgrhmIUKwl7q79wG IATxJ1UOXIGgriwoBwoHdooOK33QNy4hkjiNFNrtcaNT7uig+BG0g40AxSwVZ/OLmSFyEioO BmRqz1Zdo+AQ5RzHpu49ULlppgdSUYMYote8VPsRcE4Z8My/LLKmd7lvCn1kvcTGcOS1hyUC 4tMvfuloIehHX3tbcbw5UcQkg4IDh4l8XUc7lt2mdiyJwJoouyqezO3TJpkmkayS3L7o7dB5 AkUwntyY82tE6BU4quRVF6WJ8GH5gNn4y5m3TMDl135w27IIDd9Hv4Y5ycK5sEL3N+mjaWlk 2Sf6j1AOy3KNMHusXLgivPO8YKcL9GqtKRENpy7n+qWrvyHA9xV2QQiUDF13z85Sgy4Xi307 ex0GGrIo54EJXZBvwIDkufRyN9y0Ql7AdPyefOTDsGq5U4XTxh6xfsEXLESMDKQMiVMI74Ec cPYL8blzdkQc1MZJccU+zAr6yERkUwo1or14GC2WPGJh0y/Ym9L0FhXVkq9e1gnXjpF3QIJh wqVkPm4Two93mAL+929ypFr48OIsN7j1NaNAy6TkteIoNUi09winG0tqU5+U944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TR/33Zj7ez2uZkOEuTs/pPN oKMATC28qfg0qM59YjDrrkdXi/+iDe7qCX93XxdIxpA5YM/ZiqgwziJX8ZOKV7UDV+Ph5KwF lTPJMPdQZYXDOt5DjG5l5j0cQWqE05QtYR/V6g8un6V2PqOs9WzaT/RB12YFcaeWlusa8Iqs Eg== Message-ID: <5e2ce2ae-5458-8579-576a-76721f7d3b08@gmx.de> Date: Fri, 26 Jun 2020 04:42:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200625234516.31406-2-atish.patra@wdc.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:DNir3hMAMYmQ87pJwppxYJqIekpH3I3jRR832mYeUNJrc23wAOp HbPxmf10cNMzuii472N+t3Kj5r64eOm1lManQ01GefmPRkEx7/gDJlewZnR5XaDAczcFIVz pm2bNrbsZi9EavGXOCyDSgh5bazavfd3XZzPTIl+JGPvZYuS6sV2SmHuQlnjXp7dXXAlgZ7 xpCbkt+5XAP2NRv/Zvb5A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Xq8K61p4ypI=:fU2r66EwJMt+drFGGv2Ny/ IocZxyE6K6ZixZ0rXD2jNMSWjOaS6hNqvRaeQpXiCBiWUA6ZxoTdhRBzJq/gO8xaOefbNDXjS 7evuYkpsRxnc5iJe31Qvr256OHjR85Lg0/dnar70YVNHt6GJl7YeB6Sui8mTlvzy9Y7ydb5l2 g3PCW5HcKaNKgJdYo7MTxefe7NCiZjWadhO06t86x/XzSSLsU5gD67GzC5MDzX+hF1PMFbucP /B+iSJA2ylOMcOJ17KlQuSf0JJMYD1QpsmeGrq3rn8vruKqkh8CDPaYP6yBgAwDBnFpXOkrDw LK1TYKkLgsHV9ZKKMN8wxJgErkYGBB8EwPMe8diWGigebHsy1+VkCBatnA9ROs2r0cQZnA4sX uxygkKJROdXLW0nGaJuQywT6qIVlaHuirlFUI7sGAddCpVBV9Rk+VlASaMpRKbR6208hG/VTU NIdmSn9paIcZbJuTzfv+drOZ/jmysT6VzBxvEEloVcpDz5uFDAMvT4s43Yo091LuGS1AQu8oh sEK51ZQCdZQ2JSljiXPXsHwTl9O58QLze/yTILrhOp4GbXLNxyUlOkRe5Zyq6xdr25RhiML5J lxXXNZjlYaikX73NHIaDA3dupY7kakXf62qfzDlLlW17VQ/hZxu4QHhz0pgjQvLaRoFSJ/C+b mf6sGNRjXuZGip71whdUIsdarm7sohO2z2VBZaF3OJwJmEAFNl3rfH9r+BxqEuL7WF4auSOo/ OvI6LUXXqUMFwoHowoLodsqpOT03EWgIZaeYS7ff/V97wI/w5I8R+SNjoSkK2X2UNHyzMT7Sr vl6qJLuF7wHXJMQEf1BxCmglTY344dxSG3n3ukjS7Jyz23SLdPioD+0rq2GAoXkij2HG+Q4fe +y9MfnO5oI2V7L1zhlIx41WQtfAbRo+p2mKSHHQEWWKEovokPVuYFeoxR2jIaxpnX0L4/WNtH hjOiwirrdy+v6irBzPhxy3ICQbgypxEoNvBY8KeNtAG8jZYOdePMJBr1jINcdSBJTOeEDV4FB iMiOe+mChG3fzIPp0Qf/bHyRleQgKl6e6ZDZdF2uZvrgrwl/YKJxS6FqHR/2LkHT7wZxaBQLU I4D5PfIiafYWcsn9UIKKsUqUjs27tIw51IVE3tak/ebB3Z8opl64OTvGbNxTFri2WL+C8lYxw 0T6Ht2YljGNLkPxKktXuUhfV4vZDZa4j8idoWlJcAMrHEC7lgwW+8PAp7BfEOI9XwHxIkJ4b+ p1NBpPev7YIBV4/KK Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/26/20 1:45 AM, Atish Patra wrote: > 32bit gcc doesn't support modulo operation on 64 bit data. It results in > a __umoddi3 error while building EFI for 32 bit. > > Use bitwise operations instead of modulo operations to fix the issue. > > Signed-off-by: Atish Patra > --- > drivers/firmware/efi/libstub/alignedmem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/firmware/efi/libstub/alignedmem.c b/drivers/firmwar= e/efi/libstub/alignedmem.c > index cc89c4d6196f..1de9878ddd3a 100644 > --- a/drivers/firmware/efi/libstub/alignedmem.c > +++ b/drivers/firmware/efi/libstub/alignedmem.c > @@ -44,7 +44,7 @@ efi_status_t efi_allocate_pages_aligned(unsigned long = size, unsigned long *addr, > *addr =3D ALIGN((unsigned long)alloc_addr, align); > > if (slack > 0) { > - int l =3D (alloc_addr % align) / EFI_PAGE_SIZE; > + int l =3D (alloc_addr & (align - 1)) / EFI_PAGE_SIZE; Here you rely on the compiler to silently convert the division by EFI_PAGE_SIZE into a right shift. Wouldn't it be cleaner to use EFI_PAGE_SHIFT to explicitly avoid a dependency on __udivdi3()? slack =3D (align >> EFI_PAGE_SHIFT) - 1; ... int l =3D (alloc_addr & (align - 1)) >> EFI_PAGE_SHIFT; Best regards Heinrich > > if (l) { > efi_bs_call(free_pages, alloc_addr, slack - l + 1); >