qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Claudio Fontana <claudio.fontana@huawei.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Jani Kokkonen <Jani.Kokkonen@huawei.com>,
	qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 2/4] tcg/aarch64: implement new TCG target for aarch64
Date: Mon, 27 May 2013 11:10:25 +0200	[thread overview]
Message-ID: <51A32301.8030304@huawei.com> (raw)
In-Reply-To: <519F2A06.8090200@huawei.com>

(removing Paolo from CC as agreed with him)

On 24.05.2013 10:51, Claudio Fontana wrote:
> On 23.05.2013 18:39, Peter Maydell wrote:
>> On 23 May 2013 09:18, Claudio Fontana <claudio.fontana@huawei.com> wrote:
>>>
>>> add preliminary support for TCG target aarch64.
>>
>> Richard's handling the technical bits of the review, so
>> just some minor style nits here.
>>
>> I tested this on the foundation model and was able to boot
>> a 32-bit-ARM kernel.
>>
>>> +static inline void reloc_pc19(void *code_ptr, tcg_target_long target)
>>> +{
>>> +    tcg_target_long offset; uint32_t insn;
>>> +    offset = (target - (tcg_target_long)code_ptr) / 4;
>>> +    offset &= 0x07ffff;
>>> +    /* read instruction, mask away previous PC_REL19 parameter contents,
>>> +       set the proper offset, then write back the instruction. */
>>> +    insn = *(uint32_t *)code_ptr;
>>> +    insn = (insn & 0xff00001f) | offset << 5; /* lower 5 bits = condition */
>>
>> You can say
>>     insn = deposit32(insn, 5, 19, offset);
>> here rather than doing
>>     offset &= 0x07ffff;
>>     insn = (insn & 0xff00001f) | offset << 5;
>>
>> (might as well also use deposit32 for consistency in the pc26 function.)
> 
> Ok, I'll make use of it.
> 
>>> +static inline enum aarch64_ldst_op_data
>>> +aarch64_ldst_get_data(TCGOpcode tcg_op)
>>> +{
>>> +    switch (tcg_op) {
>>> +    case INDEX_op_ld8u_i32: case INDEX_op_ld8s_i32:
>>> +    case INDEX_op_ld8u_i64: case INDEX_op_ld8s_i64:
>>> +    case INDEX_op_st8_i32: case INDEX_op_st8_i64:
>>
>> One case per line, please (here and elsewhere).
> 
> Will comply.
> 
>>> +static inline void tcg_out_call(TCGContext *s, tcg_target_long target)
>>> +{
>>> +    tcg_target_long offset;
>>> +
>>> +    offset = (target - (tcg_target_long)s->code_ptr) / 4;
>>> +
>>> +    if (offset <= -0x02000000 || offset >= 0x02000000) { /* out of 26bit rng */
>>> +        tcg_out_movi64(s, TCG_REG_TMP, target);
>>> +        tcg_out_callr(s, TCG_REG_TMP);
>>> +
>>
>> Stray blank line.
> 
> I should remove this \n I assume. Ok.
> 
>>> +    case INDEX_op_mov_i64: ext = 1;
>>
>> Please don't put code on the same line as a case statement.
>> Also fall-through cases should have an explicit /* fall through */
>> comment (except in the case where there is no code at all
>> between one case statement and the next).

Would it be acceptable to put a comment at the beginning of the function
describing ext use, to avoiding a series of /* fall through */ comments?

Like this:

/* ext will be set in the switch below, which will fall through
   to the common code. It triggers the use of extended registers
   where appropriate. */

and then going:

case INDEX_op_something_64:
    ext = 1;
case INDEX_op_something_32:
    the_actual_meat(s, ext, ...);
    break;

> 
> Will change for the next version.
> 
>> thanks
>> -- PMM
>>

Claudio

  reply	other threads:[~2013-05-27  9:11 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14 15:57 [Qemu-devel] QEMU aarch64 TCG target Claudio Fontana
2013-03-14 16:16 ` Peter Maydell
2013-05-06 12:56   ` [Qemu-devel] QEMU aarch64 TCG target - testing question about x86-64 Claudio Fontana
2013-05-06 13:27     ` Paolo Bonzini
2013-05-13 13:22       ` [Qemu-devel] [PATCH 0/3] ARM aarch64 TCG target Claudio Fontana
2013-05-13 13:28         ` [Qemu-devel] [PATCH 1/3] configure: permit compilation on arm aarch64 Claudio Fontana
2013-05-13 18:29           ` Peter Maydell
2013-05-14  8:19             ` Claudio Fontana
2013-05-13 13:31         ` [Qemu-devel] [PATCH 2/3] include/elf.h: add aarch64 ELF machine and relocs Claudio Fontana
2013-05-13 18:34           ` Peter Maydell
2013-05-14  8:24             ` Claudio Fontana
2013-05-13 13:33         ` [Qemu-devel] [PATCH 3/3] tcg/aarch64: implement new TCG target for aarch64 Claudio Fontana
2013-05-13 18:28           ` Peter Maydell
2013-05-14 12:01             ` Claudio Fontana
2013-05-14 12:25               ` Peter Maydell
2013-05-14 15:19                 ` Richard Henderson
2013-05-16 14:39                   ` Claudio Fontana
2013-05-14 12:41               ` Laurent Desnogues
2013-05-13 19:49           ` Richard Henderson
2013-05-14 14:05             ` Claudio Fontana
2013-05-14 15:16               ` Richard Henderson
2013-05-14 16:26                 ` Richard Henderson
2013-05-06 13:42     ` [Qemu-devel] QEMU aarch64 TCG target - testing question about x86-64 Peter Maydell
2013-05-23  8:09 ` [Qemu-devel] [PATCH 0/4] ARM aarch64 TCG target VERSION 2 Claudio Fontana
2013-05-23  8:14   ` [Qemu-devel] [PATCH 1/4] include/elf.h: add aarch64 ELF machine and relocs Claudio Fontana
2013-05-23 13:18     ` Peter Maydell
2013-05-28  8:09     ` Laurent Desnogues
2013-05-23  8:18   ` [Qemu-devel] [PATCH 2/4] tcg/aarch64: implement new TCG target for aarch64 Claudio Fontana
2013-05-23 16:29     ` Richard Henderson
2013-05-24  8:53       ` Claudio Fontana
2013-05-24 17:02         ` Richard Henderson
2013-05-24 17:08           ` Peter Maydell
2013-05-24 17:17             ` Richard Henderson
2013-05-24 17:28               ` Peter Maydell
2013-05-24 17:54                 ` Richard Henderson
2013-05-27 11:43           ` Claudio Fontana
2013-05-27 18:47             ` Richard Henderson
2013-05-27 21:14               ` [Qemu-devel] [PATCH 3/3] " Laurent Desnogues
2013-05-28 13:01                 ` Claudio Fontana
2013-05-28 13:09                   ` Laurent Desnogues
2013-05-28  7:17               ` [Qemu-devel] [PATCH 2/4] " Claudio Fontana
2013-05-28 14:52                 ` Richard Henderson
2013-05-23 16:39     ` Peter Maydell
2013-05-24  8:51       ` Claudio Fontana
2013-05-27  9:10         ` Claudio Fontana [this message]
2013-05-27 10:40           ` Peter Maydell
2013-05-27 17:05           ` Richard Henderson
2013-05-27  9:47     ` Laurent Desnogues
2013-05-27 10:13       ` Claudio Fontana
2013-05-27 10:28         ` Laurent Desnogues
2013-05-28 13:14     ` Laurent Desnogues
2013-05-28 14:37       ` Claudio Fontana
2013-05-23  8:19   ` [Qemu-devel] [PATCH 3/4] configure: permit compilation on arm aarch64 Claudio Fontana
2013-05-23 13:24     ` Peter Maydell
2013-05-23  8:22   ` [Qemu-devel] [PATCH 4/4] tcg/aarch64: more ops in preparation of tlb lookup Claudio Fontana
2013-05-23 12:37   ` [Qemu-devel] [PATCH 0/4] ARM aarch64 TCG target VERSION 2 Andreas Färber
2013-05-23 12:50     ` Peter Maydell
2013-05-23 12:53       ` Andreas Färber
2013-05-23 13:03         ` Peter Maydell
2013-05-23 13:27           ` Claudio Fontana

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=51A32301.8030304@huawei.com \
    --to=claudio.fontana@huawei.com \
    --cc=Jani.Kokkonen@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).