From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00DE7C433B4 for ; Tue, 20 Apr 2021 01:32:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 66A1461164 for ; Tue, 20 Apr 2021 01:32:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66A1461164 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYfFK-0002vq-E0 for qemu-devel@archiver.kernel.org; Mon, 19 Apr 2021 21:32:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYfDi-00026u-FR; Mon, 19 Apr 2021 21:30:30 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:36867 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYfDf-0005sO-OB; Mon, 19 Apr 2021 21:30:30 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4FPR2G0KL7z9vDx; Tue, 20 Apr 2021 11:30:14 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1618882214; bh=kXyNe1W1PcFc4O1agQyYeHmvsJ4U7ZuOgIcWazZ1pBo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XLb7u+pT+AdlvUICLubW2TY2K7ASQ6JcmgbgTIJuFZMBN5WGkFcsf38nHCCDfK3yJ uhzl49aAvaQFiHmtB8n8L/B0cBfKjK/3x7yRxLXYeqrcNTUdAPXl/bnDHZPxh8LFAb qKQdDSnh6TY151HBuuhwxcpXyw9r99MmYK3hBrhk= Date: Tue, 20 Apr 2021 11:20:58 +1000 From: David Gibson To: Bruno Piazera Larsen Subject: Re: [PATCH 1/4] target/ppc: Code motion required to build disabling tcg Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lRuDA9+H5UDq8pJI" Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=203.11.71.1; envelope-from=dgibson@ozlabs.org; helo=ozlabs.org X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Fabiano Rosas , "qemu-devel@nongnu.org" , Andre Fernando da Silva , Lucas Mateus Martins Araujo e Castro , Fernando Eckhardt Valle , "qemu-ppc@nongnu.org" , "lagarcia@br.ibm.com" , Matheus Kowalczuk Ferst , Luis Fernando Fujita Pires Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --lRuDA9+H5UDq8pJI Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 19, 2021 at 02:40:35PM +0000, Bruno Piazera Larsen wrote: > > > > * move gen_write_xer and gen_read_xer into cpu_init.c, as they're > > > > used for some sprs, and whatever needs to be moved with it > > > > > > I'd leave them where they are currently. Instead what I think we shou= ld > > > do is to find a way to not need the uea/oea/hea|read/write callbacks > > > with KVM. > > > > > > Maybe extract a function from _spr_register that sets what is common = for > > > both tcg and kvm (num, name, initial_value, AFAICT). Then alter the > > > gen_spr* functions to first create all registers and then call both > > > configs to supplement: > > > > > > //tcg.c > > > static void tcg_gen_spr_generic(CPUPPCState *env) > > > { > > > // these only set the callbacks > > > spr_register(env, SPR_FOO, > > > SPR_NOACCESS, SPR_NOACCESS, > > > &spr_read_foo, &spr_write_foo); > > > spr_register(env, SPR_BAR, > > > SPR_NOACCESS, SPR_NOACCESS, > > > &spr_read_bar, &spr_write_bar); > > > } > > > > > > //kvm.c > > > static void kvm_gen_spr_generic(CPUPPCState *env) > > > { > > > // these only set one_reg_id > > > spr_register_kvm(env, SPR_FOO, KVM_REG_PPC_FOO); > > > spr_register_kvm(env, SPR_BAR, KVM_REG_PPC_BAR); > > > } > > > > I really dislike the idea above - it'd be way too easy for KVM and TCG > > to get out of sync. Instead make spr_register() itself a macro if > > necessary, so it just ignores the access functions in the !TCG case. >=20 > What I was doing was to only register the spr once, and use the > accel-specific functions to set the relevant attributes, so spr_common > wouldn't need to where (and if) spr_read_* exists or not. > Would this work? >=20 > Just ignoring the read and write functions means we still need > to compile them, or at least stub them, otherwise we'd get linker > problems. Not if you use a macro which will simply elide the references in the !TCG case. Actually I think even an inline wrapper will do it, I'm pretty sure the compiler is smart enough to optimize the references out in that case. > And ifdef'ing them out of the calls would be quite a > pain to understand the code later on. >=20 >=20 >=20 > Bruno Piazera Larsen >=20 > Instituto de Pesquisas ELDORADO >=20 > Departamento Computa=E7=E3o Embarcada >=20 > Analista de Software Trainee >=20 > Aviso Legal - Disclaimer >=20 > ________________________________ --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --lRuDA9+H5UDq8pJI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAmB+LHgACgkQbDjKyiDZ s5LahRAA2wHvAuiBuVJxiZP11DMXs0MkjRJwdjmlh/EQ82VuFvynUR+gtD7wobaf 2aXqMoviBTUhGXPLKi8xSG4DxDuYnOv2Kk2xOI40KBFvmFNapVg5/3ckF2Y4Ur1Q VJOEhmZLa2kWEVTB/vcpF31/CtvZ/KBYbTQML++drvprQcP5uPHECyRdF6JIchaN Jb78gsq86G6ijcZwVPs1qTZONXatn0cXNNHbebQdL3kdRV2vDy8r7WLDnzJqvTFv /MQmip+uAM++Hpyh98izThCp4oNZLaCV8PGjgMgRKEKtb4I16mL1ftmMW6IIzkFC yXrSku6SbjoSE3cEsVI7g92oDkAsm6RXpMiv7e+iQ1aj3BfBjIM7GRFQXgu0GHYP aIhtc7e4s+AAxevlJpDQwLXR67bp2ghWHqlwZ517i/SfvGzeumjlrWJ+Cz06Q94L wMubSgR7hbxiRmotyMzuAiZaghXaXdjzoa+wVoLv5s1klPlwrof94nQwbNmNZPNg LJLUbvdvCWcoK4cNYs1n2Or6fti3iNGWSqD6j9hvu3lbKkmUpjCKoJTVZXHVU6hx Ys/4bdQVuRoJ9exmGAXDSKNkX4LYqCoHLETcRK1nxgz4HS6QkiyvVCwG7tZ0GaW3 qi90sZSK0JrMLj0vNPapVi2i/l7cFn0VwM7lUg3+CcAPjFkNTQc= =BrkR -----END PGP SIGNATURE----- --lRuDA9+H5UDq8pJI--