From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C27FD2F23 for ; Sun, 4 Sep 2022 13:24:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F3F3C43141 for ; Sun, 4 Sep 2022 13:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662297893; bh=rl6fLZU0cQ0lmq75jhbnr25T1XXEIy5vIoogxAgbYxk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=SmYl2hECZR3wKwP+FMP1Gd8wTuF9lZuvDfmmxHZg94srIxB3nUdZUAKqkh7F+0bTa CKO2jUfuZg8Y0U5tNgIK6sZ0H9rDqwAe2kZVpJygXouICSger77vb4WHfYTNcJng83 7ewP7a5EHhWyoyf985PhLtLWyec5WSYKsR9K8BY5RuOI42dw1qj3CTLLCQpj/ooNiN ZARzUJSFT8eLRxfHn8XqiGkAFtXpF5cnMfCZQGvCqctNVAM5sevqlPi3dvNlwZLpIf j+wzJG+lP7APtAYKInLayW+1mxccmxwJNJHaOqSyeVJmJP5EAPLUX68tAnpMhS8jsx qaWk6BZxazCnQ== Received: by mail-ua1-f53.google.com with SMTP id a18so2458496uak.12 for ; Sun, 04 Sep 2022 06:24:53 -0700 (PDT) X-Gm-Message-State: ACgBeo2ApLY5IIunltLDeUmUyhCRISHIro26SVRVEVvkrhGt5jnGtJYe Z0ymsBhlnbUeHfpp7xU4/bgPcRp3F8CsciMPZ0c= X-Google-Smtp-Source: AA6agR5Y4uVz9cAZw9EOYYNKxQt74TW6VgX0gb/I4EmRjuSpKKxu15vMq4u5YFoTjUSdQWo9wYv1viWPPTHI6+gP+sk= X-Received: by 2002:a05:6130:c13:b0:39f:58bb:d51c with SMTP id cg19-20020a0561300c1300b0039f58bbd51cmr13564275uab.104.1662297892187; Sun, 04 Sep 2022 06:24:52 -0700 (PDT) Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20220819102037.2697798-1-chenhuacai@loongson.cn> <9b6f0aeaebbd36882b5b40d655f9ccd20c7be496.camel@xry111.site> In-Reply-To: From: Huacai Chen Date: Sun, 4 Sep 2022 21:24:39 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V3] LoongArch: Add efistub booting support To: Ard Biesheuvel Cc: Xi Ruoyao , Huacai Chen , Arnd Bergmann , loongarch@lists.linux.dev, linux-arch , Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-efi , LKML Content-Type: text/plain; charset="UTF-8" Hi, Ard, On Thu, Sep 1, 2022 at 6:40 PM Huacai Chen wrote: > > Hi, Ard, > > On Sat, Aug 27, 2022 at 3:14 PM Ard Biesheuvel wrote: > > > > On Sat, 27 Aug 2022 at 06:41, Xi Ruoyao wrote: > > > > > > Tested V3 with the magic number check manually removed in my GRUB build. > > > The system boots successfully. I've not tested Arnd's zBoot patch yet. > > > > I am Ard not Arnd :-) > > > > Please use this branch when testing the EFI decompressor: > > https://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git/log/?h=efi-decompressor-v4 > The root cause of LoongArch zboot boot failure has been found, it is a > binutils bug, latest toolchain with the below patch can solve the > problem. > > diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c > index 5b44901b9e0..fafdc7c7458 100644 > --- a/bfd/elfnn-loongarch.c > +++ b/bfd/elfnn-loongarch.c > @@ -2341,9 +2341,10 @@ loongarch_elf_relocate_section (bfd > *output_bfd, struct bfd_link_info *info, > case R_LARCH_SOP_PUSH_PLT_PCREL: > unresolved_reloc = false; > > - if (resolved_to_const) > + if (!is_undefweak && resolved_to_const) > { > relocation += rel->r_addend; > + relocation -= pc; > break; > } > else if (is_undefweak) > > > Huacai Now the patch is submitted here: https://sourceware.org/pipermail/binutils/2022-September/122713.html And I have some other questions about kexec: kexec should jump to the elf entry or the pe entry? I think is the elf entry, because if we jump to the pe entry, then SVAM will be executed twice (but it should be executed only once). However, how can we jump to the elf entry if we use zboot? Maybe it is kexec-tool's responsibility to decompress the zboot kernel image? Huacai