Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4067553pxb; Wed, 13 Oct 2021 20:05:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJqaWbVRZV97qcEHcBNv7aW4z/Hk11hUE9QDRWPu9e5aCf8gG8X4A7cvseh3IusmxE0fnf X-Received: by 2002:a17:907:774d:: with SMTP id kx13mr710062ejc.239.1634180746428; Wed, 13 Oct 2021 20:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634180746; cv=none; d=google.com; s=arc-20160816; b=jux9ky5ydiM+GL3lbvjwxOuK9GA8XutgTncddOfsROUsI5oLGUv5t6gogP+fVO62zu okZWNz9GS3IJCZ2YL/hlY9HDJMWhULtd5Uo+vTv5hnrovuoNZOYMXYsrIK4ZRHzXEQUH 84+y/6WC3DRCYq+qQdawj7NbqETKbLgsu2r5mdKyYyyGEMX4dh0OIMOwISqNRWtrDqrN YPz3amzCrrjcA1IwWM7GTwQi9sJ8+j+qAJ1H9ki1u7OcUpXn6gob8DONH9AM8Zrmtqzm spTRaPULumRtYPDHv0E6H310LcR9y04U0hOy+OiS2+UUyfaqnGVXquMdjQ56R/xaqXuM l+jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=f/CZ3h41DYsFMAqGi5C28jlvcQjjjxXwdgVx1UeMUqU=; b=XC1ba9DLFKyjncp6Vf4EvHXzVUvaBikDMYf/erGSYRips1V9TZaVBvfj5m8AEq2nxW u1ME0UKVNJ3ResJGPHDOU4VGlUn4/Fbng7hpkeqD0hjZ+F8ccYgwSlIvhlBZhKLbih+9 YHozdYCcQtht0fedGP6OtrkIgCbPig9TUua5pA0yHnYxwiYEl6x2/FJudzVaCzNVMd7C 6FUiGdMmlfsq/HagJoXMKbDyK16kf3JhrJcsF77gdBcoiboLTQmfFMKMTBrzKoOK1RP4 yMGlpYmqQ6j6vIpR0/Fk3Vk0z+hnNDzQmoMgYAOY6d9VTJ3/dAV32LT7Q5aj9sDMP1mn +W3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dOC+24nl; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si1982332ejx.208.2021.10.13.20.05.22; Wed, 13 Oct 2021 20:05:46 -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=@gmail.com header.s=20210112 header.b=dOC+24nl; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229927AbhJNDDZ (ORCPT + 99 others); Wed, 13 Oct 2021 23:03:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbhJNDDY (ORCPT ); Wed, 13 Oct 2021 23:03:24 -0400 Received: from mail-ua1-x92d.google.com (mail-ua1-x92d.google.com [IPv6:2607:f8b0:4864:20::92d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC8FFC061570; Wed, 13 Oct 2021 20:01:20 -0700 (PDT) Received: by mail-ua1-x92d.google.com with SMTP id e2so8571960uax.7; Wed, 13 Oct 2021 20:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f/CZ3h41DYsFMAqGi5C28jlvcQjjjxXwdgVx1UeMUqU=; b=dOC+24nlC1p6+PhEkce9QFi/JokIB7H4RtKCST+pjZJ155B3+Nbupy+nGfA4Z2Z8b+ 35NsrVFLusp8hep969Gol4XDCuRjKxiaH+//CfVeTlENH+JOFdEpBb8afIaEOScwKmo2 yjuk3kQKmmyYJsk5dljIDsrJrUr3EHKOdHODAgGv3Qdaembzc/qqjvBsR3XjGtk26zU+ piuPEt2Gy0A+/WBvEj2vs2142LkPPrbeSK9pcfmKxOnH0/l9A0tmmelBrGbRrjDuoSJm xcdFAK2vFPJjtx9fXRWTn+Liyq0mlsQEseIYMqhpMZH4/L09vGcLvyKU95j5vvSF4IyU 4/8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f/CZ3h41DYsFMAqGi5C28jlvcQjjjxXwdgVx1UeMUqU=; b=1jvdyNLbNfacAV2I0ztmL8NeDvOtRsSqUckZbh9p/W/smeGFsHBRJj/aVrAtkglqLn G5MSWMomYg4ZgwDxf6A+7pSLDFgmsAH6J+tEPRby6KP0hAyK+zTCzoINdyVJ02t/RR7P 8D10WEW+ItDB2M3Ka4rFRZroczkgHAuYVB+ps2IUKKRR6KnBwU6ZyjaN6MDoa9Nje2n8 jmNgx6RRbH5fSwOSREb8SufN7lcsITG5jhSUTDcGez/gx2usSetbqd0eij7ApllKrP78 tfxJ/rVBiLNPVnlwt2M+gYRYh2wWLu0mvhCR2b+V58BD7DPPptmkz/d91QMumMkiiaEt s8zg== X-Gm-Message-State: AOAM531NQVfGfmVd7jTCzh8QyK9GNpf/nKxjTDsI9CEXnpAx0/Gz+jIX Ptt9+GkfFxa6L9/I4K0zQ6rVeagYdTX3Z1C/TWY= X-Received: by 2002:a67:c19d:: with SMTP id h29mr3419511vsj.18.1634180479914; Wed, 13 Oct 2021 20:01:19 -0700 (PDT) MIME-Version: 1.0 References: <20211013063656.3084555-1-chenhuacai@loongson.cn> <20211013071117.3097969-1-chenhuacai@loongson.cn> <20211013071117.3097969-2-chenhuacai@loongson.cn> In-Reply-To: From: Huacai Chen Date: Thu, 14 Oct 2021 11:01:08 +0800 Message-ID: Subject: Re: [PATCH V5 15/22] LoongArch: Add elf and module support To: Luis Chamberlain Cc: Huacai Chen , Arnd Bergmann , Andy Lutomirski , Thomas Gleixner , Peter Zijlstra , Andrew Morton , David Airlie , Jonathan Corbet , Linus Torvalds , linux-arch , "open list:DOCUMENTATION" , LKML , Xuefeng Li , Yanteng Si , Jiaxun Yang , Jessica Yu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Luis, On Wed, Oct 13, 2021 at 8:56 PM Luis Chamberlain wrote: > > On Wed, Oct 13, 2021 at 03:11:10PM +0800, Huacai Chen wrote: > > diff --git a/arch/loongarch/include/asm/vermagic.h b/arch/loongarch/include/asm/vermagic.h > > new file mode 100644 > > index 000000000000..9882dfd4702a > > --- /dev/null > > +++ b/arch/loongarch/include/asm/vermagic.h > > @@ -0,0 +1,19 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +/* > > + * Copyright (C) 2020-2021 Loongson Technology Corporation Limited > > + */ > > +#ifndef _ASM_VERMAGIC_H > > +#define _ASM_VERMAGIC_H > > + > > +#define MODULE_PROC_FAMILY "LOONGARCH " > > I take it this not a mips arch? There are other longarchs under > arch/mips/include/asm/vermagic.h which is why I ask. Yes, LoongArch is not compatible with MIPS, old Loongson is MIPS and new Loongson isn't. > > > diff --git a/arch/loongarch/kernel/module.c b/arch/loongarch/kernel/module.c > > new file mode 100644 > > index 000000000000..af7c403b032b > > --- /dev/null > > +++ b/arch/loongarch/kernel/module.c > > @@ -0,0 +1,652 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * Author: Hanlu Li > > + * Huacai Chen > > + * > > + * Copyright (C) 2020-2021 Loongson Technology Corporation Limited > > + */ > > + > > +#undef DEBUG > > Please remove this undef DEBUG line. OK, thanks. > > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +static int rela_stack_push(s64 stack_value, s64 *rela_stack, size_t *rela_stack_top) > > +{ > > + if (*rela_stack_top >= RELA_STACK_DEPTH) > > + return -ENOEXEC; > > + > > + rela_stack[(*rela_stack_top)++] = stack_value; > > + pr_debug("%s stack_value = 0x%llx\n", __func__, stack_value); > > If you are going to use pr_debug() so much you may want to add > a define for #define pr_fmt(fmt) at the very top. OK, thanks. > > > +int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, > > + unsigned int symindex, unsigned int relsec, > > + struct module *me) > > +{ > > Nit: Please use struct module *mod, it is much more common in other places. > OK, thanks. > Other than that, this looks fine to me. > > Reviewed-by: Luis Chamberlain > > Luis