Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3312789pxj; Mon, 14 Jun 2021 20:49:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7yKH6QNpNh5Zj6pWCjUZypuym4NFxIADzRabVHhFWxL2x5RmpvOwIQap8okPCF4tsvhc+ X-Received: by 2002:a92:c503:: with SMTP id r3mr615298ilg.4.1623728942920; Mon, 14 Jun 2021 20:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623728942; cv=none; d=google.com; s=arc-20160816; b=cB01SSjVgkFOgSDCis5lOhSSSakMq56J5ia/h1QcxpeBIalOClT6f4sNx4XbK/0e1P n1bigF/RiLUdsBDqbayevplFztBxWZEp57Yk+8pDnmn5xkwp99rQpLVCcGFqYa+aqI5a 5U39eSzg/t4na6X02fy8hl4M/HkVyJCtVuAqSiOpkb+apjt98E6NX5bnp2yevfDJ8Mhy PJkPyDjmvNPbzl25tm1byb4H7BZCv9//mxgf6+iyhICoo+2/aOyoHBS4DtCdVOr1lQNV nJSbDwPPxb14RzDFEg1lMPWlvLORAfa4v03XNqZejQ+44NzSxMX6Z4cDm4nyTmMwNCGk ug6A== 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=honLpRS5BN/c2OkeqRE0xa+BxqCXma5P6oZc4YqSaPE=; b=e5N6Lwhp/nZ+kvqKokVWqIdXMVAA+WT2uxK3E2zlcMnyHOSVFGXPiB3hobGVizP2Z4 B+KaYM+TRHuS5XqpG2hIu5Wmbul4mO9d/gMe/dDvJNrSIFNvf1Yny5CwBgUQHVW2ntch eroB5QfgD3vc9iGlgc/K0IPzMHywNSIP/AtuTZkTt+tk6OsnbYqCcrV/g2Plxn+1c/q6 w6rzo0S9BeXBhT5JeNPX0c60slQJfqB1oMhqmVx3GVwOOZ146ZYFznqH4RPizstZl7vW nyjGVwVamQPNfgxjvs4/ENbbcTrOTOwPhPDKejtq5AB0KouRQlkt5BbKXucfiuDBMiIR HkdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mg+8v23p; 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 e3si18360487iom.57.2021.06.14.20.48.44; Mon, 14 Jun 2021 20:49:02 -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=20161025 header.b=Mg+8v23p; 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 S230411AbhFODuA (ORCPT + 99 others); Mon, 14 Jun 2021 23:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229659AbhFODt6 (ORCPT ); Mon, 14 Jun 2021 23:49:58 -0400 Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED206C061574 for ; Mon, 14 Jun 2021 20:47:53 -0700 (PDT) Received: by mail-yb1-xb30.google.com with SMTP id b9so18484151ybg.10 for ; Mon, 14 Jun 2021 20:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=honLpRS5BN/c2OkeqRE0xa+BxqCXma5P6oZc4YqSaPE=; b=Mg+8v23pivt6Zp5p5+GDfXoaCDNdSAUyb5ugGA1H4TvgXOxNuc3e+P73Ee2LrcGqdr Q9cKeOEF020LWaK3asdbZwnCBnswvyl7yJqQw5+ewetqrkt0XodouzDJ0Zi7RlYLeg7z 82S9yycBLPt5+WPIiWkXXEdxWaWns8XQoEzBxpdgqREQeYFsVISK2s5zrJ9MNBrcO3Uk 22qUxIfTZBp55zMJfWyLPHiQqixxk873ENISYpesziAAWVrvcZuoWmr44+G4rE4hcFRL PORcweIU8HS0Hp8aVdRi2uVVscqlBX3Sj6FRiGGWZ5A73TRoUMx0jQgKZCRpJE1w2fV4 l5VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=honLpRS5BN/c2OkeqRE0xa+BxqCXma5P6oZc4YqSaPE=; b=Q/BfwU0porbM7B8NDhcohWeFEGv9MhC6DgR5zjm+Z0WoJW7oByOOjdubXQXlEz+0NQ bV4FKG0y7ilvD51p7F5YqPJsjM0C2Dj93EJfznomTwoPvZqns3bS0JMdCAQYSlUVQ+Xw uhEQdKvVAH4PWY6CTqPQ5wS5v9pQZAP37shGh/tMXiO5NON5eCng0MVLgEMw09fov5Gj Eo6OEWMY8DinRkPAIkxA7icoK+fQCrITPQ7KONYPo3xSINJDPbma3sYqrqj6UBMD1E6A 4XqTSRKbEv/H+oxfJtLa04VQiYZeuDSH/hciCivZjao/O2J40+SVyUYUV+dUstBPuZpd t2EA== X-Gm-Message-State: AOAM532HRWLKihVYJhdPPT1RcrhnEeLn1hIdwfjgpgG/34Du2NhbMUEK laNnHUp5/FvPPoq9marE3gfXAXeOSm6xHj2D/iE= X-Received: by 2002:a25:694d:: with SMTP id e74mr4751923ybc.377.1623728872887; Mon, 14 Jun 2021 20:47:52 -0700 (PDT) MIME-Version: 1.0 References: <7062722b087228e42cbd896e39bfdf526d6a340a.1621516826.git.christophe.leroy@csgroup.eu> <871r93vqcb.fsf@mpe.ellerman.id.au> In-Reply-To: <871r93vqcb.fsf@mpe.ellerman.id.au> From: Jordan Niethe Date: Tue, 15 Jun 2021 13:47:41 +1000 Message-ID: Subject: Re: [PATCH v2 08/12] powerpc: Don't use 'struct ppc_inst' to reference instruction location To: Michael Ellerman Cc: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , "Naveen N. Rao" , linux-kernel@vger.kernel.org, linuxppc-dev Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 15, 2021 at 12:01 PM Michael Ellerman wrote: > > Christophe Leroy writes: > > diff --git a/arch/powerpc/include/asm/inst.h b/arch/powerpc/include/asm/inst.h > > index 5a0740ebf132..32d318c3b180 100644 > > --- a/arch/powerpc/include/asm/inst.h > > +++ b/arch/powerpc/include/asm/inst.h > > @@ -139,7 +139,7 @@ static inline int ppc_inst_len(struct ppc_inst x) > > * Return the address of the next instruction, if the instruction @value was > > * located at @location. > > */ > > -static inline struct ppc_inst *ppc_inst_next(void *location, struct ppc_inst *value) > > +static inline unsigned int *ppc_inst_next(unsigned int *location, unsigned int *value) > > { > > struct ppc_inst tmp; > > > > It's not visible in the diff, but the rest of the function is: > > tmp = ppc_inst_read(value); > > return location + ppc_inst_len(tmp); > } > > And so changing the type of location from void * to int * changes the > result of that addition, ie. previously it was in units of bytes, now > it's units of 4 bytes. > > To fix it I've kept location as unsigned int *, and added a cast where > we do the addition. That way users of the function just see unsigned int *, > the cast to void * is an implementation detail. > > We only have a handful of uses of ppc_inst_len(), so maybe that should > change name and return a result in units of int *. But that can be a > separate change. > > > diff --git a/arch/powerpc/platforms/86xx/mpc86xx_smp.c b/arch/powerpc/platforms/86xx/mpc86xx_smp.c > > index 87f524e4b09c..302f2a1e0361 100644 > > --- a/arch/powerpc/platforms/86xx/mpc86xx_smp.c > > +++ b/arch/powerpc/platforms/86xx/mpc86xx_smp.c > > @@ -83,7 +83,7 @@ smp_86xx_kick_cpu(int nr) > > mdelay(1); > > > > /* Restore the exception vector */ > > - patch_instruction((struct ppc_inst *)vector, ppc_inst(save_vector)); > > + patch_instruction(vector, ppc_inst(save_vector)); > > > > local_irq_restore(flags); > > > > There was another usage in here: > > /* Setup fake reset vector to call __secondary_start_mpc86xx. */ > target = (unsigned long) __secondary_start_mpc86xx; > - patch_branch((struct ppc_inst *)vector, target, BRANCH_SET_LINK); > + patch_branch(vector, target, BRANCH_SET_LINK); > > /* Kick that CPU */ > smp_86xx_release_core(nr); > > I fixed it up. > > cheers fwiw Reviewed by: Jordan Niethe