qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: qemu-devel@nongnu.org, rth@twiddle.net, agraf@suse.de, thuth@redhat.com
Subject: Re: [Qemu-devel] [PATCH v1] s390x/cpumodel: wire up cpu type + id for TCG
Date: Fri, 2 Jun 2017 12:52:11 +0200	[thread overview]
Message-ID: <714c789a-a8e9-b1d4-07ca-b7f36b657984@redhat.com> (raw)
In-Reply-To: <20170601192011.crq6igwuln4hyjw5@aurel32.net>


>> +
>> +#ifndef CONFIG_USER_ONLY
>> +void HELPER(stidp)(CPUS390XState *env, uint64_t addr)
>> +{
>> +    S390CPU *cpu = s390_env_get_cpu(env);
>> +    uint64_t cpuid = s390_cpuid_from_cpu_model(cpu->model);
>> +
>> +    if (addr & 0x7) {
>> +        program_interrupt(env, PGM_SPECIFICATION, ILEN_LATER_INC);
>> +        return;
>> +    }
>> +
>> +    /* basic mode, write the cpu address into the first 4 bit of the ID */
>> +    cpuid |= ((uint64_t)env->cpu_num & 0xf) << 54;
>> +    cpu_stq_data(env, addr, cpuid);
>> +}
>> +#endif
> 
> I don't really see the point of using an helper instead of just updating
> the existing code. From what I understand the cpuid does not change at
> runtime, so the s390_cpuid_from_cpu_model function can also be called 
> from translate.c.
> 
> Aurelien
> 

>From what I can see, conditional exceptions are more complicated to
implement without helpers (involves generating compares, jumps and so
on). As this function is not expected to be executed on hot paths, I
think moving it into a helper is the right thing to do.

-- 

Thanks,

David

  reply	other threads:[~2017-06-02 10:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 10:14 [Qemu-devel] [PATCH v1] s390x/cpumodel: wire up cpu type + id for TCG David Hildenbrand
2017-06-01 19:20 ` Aurelien Jarno
2017-06-02 10:52   ` David Hildenbrand [this message]
2017-06-02 14:04     ` Aurelien Jarno
2017-06-02 14:27       ` David Hildenbrand

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=714c789a-a8e9-b1d4-07ca-b7f36b657984@redhat.com \
    --to=david@redhat.com \
    --cc=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@redhat.com \
    /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).