All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruno Piazera Larsen <bruno.larsen@eldorado.org.br>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: farosas@linux.ibm.com, richard.henderson@linaro.org,
	qemu-devel@nongnu.org, lucas.araujo@eldorado.org.br,
	fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org,
	matheus.ferst@eldorado.org.br, luis.pires@eldorado.org.br
Subject: Re: [PATCH v2 7/7] target/ppc: wrapped some TCG only logic with ifdefs
Date: Wed, 19 May 2021 11:29:15 -0300	[thread overview]
Message-ID: <92c78813-ffb3-413f-e794-c287a72d4a1d@eldorado.org.br> (raw)
In-Reply-To: <YKRxu6mcVAfQJUwo@yekko>

[-- Attachment #1: Type: text/plain, Size: 3793 bytes --]


On 18/05/2021 23:02, David Gibson wrote:
> On Tue, May 18, 2021 at 12:05:15PM -0300, Bruno Larsen (billionai) wrote:
>> Wrapped some function calls in cpu_init.c, gdbstub.c, mmu-hash64.c and
>> excp_helper.c that were TCG only with ifdef CONFIG_TCG, to support
>> building without TCG.
>>
>> for excp_helper we also moved the function do_rfi higher in the file to
>> reduce the ifdef count.
> The description's no longer really accurate since some of the fixups
> are no longer ifdef based.
Sure, will do
> <snip>
>>                            0x00000000);
>>           }
>>       }
>> @@ -8605,11 +8603,13 @@ static void ppc_cpu_realize(DeviceState *dev, Error **errp)
>>           }
>>       }
>>   
>> +#ifdef CONFIG_TCG
>>       create_ppc_opcodes(cpu, &local_err);
>>       if (local_err != NULL) {
>>           error_propagate(errp, local_err);
>>           goto unrealize;
>>       }
>> +#endif
> In this instance, I think it would be cleaner to create a no-op stub
> for create_ppc_opcodes() and destroy_ppc_opcodes() rather than using
> ifdefs.
Ok. will add the stubs in tcg-stubs.c
>
>>       init_ppc_proc(cpu);
>>   
>>       ppc_gdb_init(cs, pcc);
>> @@ -8798,7 +8798,9 @@ static void ppc_cpu_unrealize(DeviceState *dev)
>>   
>>       cpu_remove_sync(CPU(cpu));
>>   
>> +#ifdef CONFIG_TCG
>>       destroy_ppc_opcodes(cpu);
>> +#endif
>>   }
>>   
>>   static gint ppc_cpu_compare_class_pvr(gconstpointer a, gconstpointer b)
>> @@ -9296,7 +9298,9 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
>>       cc->class_by_name = ppc_cpu_class_by_name;
>>       cc->has_work = ppc_cpu_has_work;
>>       cc->dump_state = ppc_cpu_dump_state;
>> +#ifdef CONFIG_TCG
>>       cc->dump_statistics = ppc_cpu_dump_statistics;
>> +#endif
>>       cc->set_pc = ppc_cpu_set_pc;
>>       cc->gdb_read_register = ppc_cpu_gdb_read_register;
>>       cc->gdb_write_register = ppc_cpu_gdb_write_register;
>> diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
>> index 80bb6e70e9..a14b529722 100644
>> --- a/target/ppc/excp_helper.c
>> +++ b/target/ppc/excp_helper.c
>> @@ -19,9 +19,13 @@
>>   #include "qemu/osdep.h"
>>   #include "qemu/main-loop.h"
>>   #include "cpu.h"
>> +#ifdef CONFIG_TCG
>>   #include "exec/helper-proto.h"
>> +#endif
> I don't like the look of ifdefs amongst the includes.  Generally the
> headers themselves should be made safe (if unnecessary) to include for
> !TCG builds.

The problems that happen with exec/helper-proto.h and exec/cpu_ldst.h is 
that they include headers themselves, trace/generated-helpers.h and 
tcg-target.h respectively, which are in folders that are not included as 
-iquote in the gcc CLI call.

So the problem is that it is trying to include headers that gcc doesn't 
see as part of the project anymore. The best option (I think) would be 
to fix the gcc command generation so headers are safe to include, but 
since I was very confused with all the scripts related to generating 
everything, I ended up going with not including the files. Should I 
change the configure script, so that we can include headers from 
tcg/ppc? I can also just separate headers that can be ifdef'd away from 
the rest with a blank line, so it's more visible later

>
>>   #include "exec/exec-all.h"
>> +#ifdef CONFIG_TCG
>>   #include "exec/cpu_ldst.h"
>> +#endif
>>   #include "internal.h"
>>   #include "helper_regs.h"
> The remaining ifdef changes look fine.  Some it would be nice to clean
> up better in future, but there's no rush.
>
-- 
Bruno Piazera Larsen
Instituto de Pesquisas ELDORADO 
<https://www.eldorado.org.br/?utm_campaign=assinatura_de_e-mail&utm_medium=email&utm_source=RD+Station>
Departamento Computação Embarcada
Analista de Software Trainee
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>

[-- Attachment #2: Type: text/html, Size: 5153 bytes --]

  reply	other threads:[~2021-05-19 14:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 15:05 [PATCH v2 0/7] target/ppc: Misc motion to support disabling TCG Bruno Larsen (billionai)
2021-05-18 15:05 ` [PATCH v2 1/7] target/ppc: fix ppc_store_sdr1 for user-only compilation Bruno Larsen (billionai)
2021-05-19  1:54   ` David Gibson
2021-05-18 15:05 ` [PATCH v2 2/7] target/ppc: moved ppc_store_lpcr and ppc_store_msr to cpu.c Bruno Larsen (billionai)
2021-05-18 15:05 ` [PATCH v2 3/7] target/ppc: reduce usage of fpscr_set_rounding_mode Bruno Larsen (billionai)
2021-05-19 15:56   ` Richard Henderson
2021-05-18 15:05 ` [PATCH v2 4/7] target/ppc: overhauled and moved logic of storing fpscr Bruno Larsen (billionai)
2021-05-19 16:05   ` Richard Henderson
2021-05-18 15:05 ` [PATCH v2 5/7] target/ppc: removed unnecessary inclusion of helper-proto.h Bruno Larsen (billionai)
2021-05-19 16:06   ` Richard Henderson
2021-05-18 15:05 ` [PATCH v2 6/7] target/ppc: moved ppc_cpu_do_interrupt to cpu.c Bruno Larsen (billionai)
2021-05-18 15:05 ` [PATCH v2 7/7] target/ppc: wrapped some TCG only logic with ifdefs Bruno Larsen (billionai)
2021-05-19  2:02   ` David Gibson
2021-05-19 14:29     ` Bruno Piazera Larsen [this message]
2021-05-19 16:09   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=92c78813-ffb3-413f-e794-c287a72d4a1d@eldorado.org.br \
    --to=bruno.larsen@eldorado.org.br \
    --cc=david@gibson.dropbear.id.au \
    --cc=farosas@linux.ibm.com \
    --cc=fernando.valle@eldorado.org.br \
    --cc=lucas.araujo@eldorado.org.br \
    --cc=luis.pires@eldorado.org.br \
    --cc=matheus.ferst@eldorado.org.br \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.