Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3267338pxj; Mon, 14 Jun 2021 19:25:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweE4mpo9wIgJXecHTVIncqeoA/A7YFyS2EuFb94dQ4UdZcyVsnFUSpdQF0X9zc9gWLTyoB X-Received: by 2002:aa7:c647:: with SMTP id z7mr20042412edr.224.1623723919319; Mon, 14 Jun 2021 19:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623723919; cv=none; d=google.com; s=arc-20160816; b=RmGtKvsqyhf/7hrKz98utW8KAmn6NiwtJoCjNxvsvLls3otUm2gyxCiVNEFz9FndRm VEFxYjk3gyjqtG4z8bSGvwzpA5o4JyTzvcEEOn1t7HaRjsY+jrPmCtEQNyO6cEIMj2zD 9vqcNx1sl+fRNX2uewYWQlMMUEGL/gEDdX2YmlBbYHMp5vo3pQ+PgcpfFJj4iuLKNmV9 Te7me54qVSBy+93+CMYSE/grWTsndmHtsRiVE11oWpQ1wzbpPM/CCJiahzv94jeCOFPS tK6tP3t24DdcgTMFJLT494cMcMEa9yGd8X280qWaRRaE/7FWLRV+uSnvO/VAHZJS/UAp 2qkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=2QUdyeOqrZNaJfJKl51mrnk6pLTgnCyeBtRw44x65ls=; b=AevOcD1jZpPHh+QbVu11Kd8a81o/zAxSR2fZOQITKtrECd3WrL65m0YAVMN6WaL/Zt TlqXyKWJVM5KWsXjxHMiLio0LZhfm+AvZQiHo0JwyDQDGGE24TVS6AdDJzwVk0qCh8Gp A4vKFUSjACbctgr9Chuw8Fnwn2w4jC2VuSuLNl6wPlFzh3e5ML3l9cDYzKyVYKtlK2l5 8X/OgC7LF8U4tRfW5R9uHHhYP0i8rUrhDum0dO95dUv8KHhagmR/kdno0A+zxmy4JTvm 8XUDf0k8tn6xFiyXyZxdf8pLiBrtP3IdSL6RRKDbDrTHn/L80mcYV7ckRtJ9C87fRE/2 qiBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=pJdbSmq1; 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 u21si13087246ejz.696.2021.06.14.19.24.56; Mon, 14 Jun 2021 19:25:19 -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=@ellerman.id.au header.s=201909 header.b=pJdbSmq1; 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 S231249AbhFOCUK (ORCPT + 99 others); Mon, 14 Jun 2021 22:20:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229743AbhFOCUK (ORCPT ); Mon, 14 Jun 2021 22:20:10 -0400 Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE091C061574 for ; Mon, 14 Jun 2021 19:18:04 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4G3s4529sVz9sWD; Tue, 15 Jun 2021 12:01:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1623722469; bh=Ioz32V7w9TF+SY5v/PGD0ofSTEUn3E3EmbxAg40Km+I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pJdbSmq1eTCdU+3xkvsZXfkGUrUNxnvqycQiy7TAYrHQqEXe2H1JfXir8hEFvW5PW s0pYoh+OM9KregcJBM84Ab5oRqBWdQUtDxH342pO5rEtShAZ53WHVbnLubImLISSPX azL43TxmUj8r/nu85TSx647r0I/9Ce52y3jc8UhR31Px0eNgiQ7mWSAqkN7gtDcLJv PBaNN5yuaL/LqJq4YmO4s8li+oB1CsNBKXk7uPr4Fe04QRea1XJ836Qioa4Ms98u3w ZNtkNYUXKYmcAvK67benMlLYZ/DddfE95gn6rYDEGO1KVzRp4o3VaA/kwLNXr9rTWW fzv0vjEjM6Low== From: Michael Ellerman To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , naveen.n.rao@linux.vnet.ibm.com, jniethe5@gmail.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2 08/12] powerpc: Don't use 'struct ppc_inst' to reference instruction location In-Reply-To: <7062722b087228e42cbd896e39bfdf526d6a340a.1621516826.git.christophe.leroy@csgroup.eu> References: <7062722b087228e42cbd896e39bfdf526d6a340a.1621516826.git.christophe.leroy@csgroup.eu> Date: Tue, 15 Jun 2021 12:01:08 +1000 Message-ID: <871r93vqcb.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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