All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@ezchip.com>
To: Chen Gang <xili_gchen_5257@hotmail.com>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	"walt@tilera.com" <walt@tilera.com>,
	"Riku Voipio" <riku.voipio@iki.fi>,
	"Andreas Färber" <afaerber@suse.de>,
	"rth@twiddle.net" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 02/10 v11] linux-user: Support tilegx architecture in linux-user
Date: Wed, 3 Jun 2015 11:10:15 -0400	[thread overview]
Message-ID: <556F18D7.7010905@ezchip.com> (raw)
In-Reply-To: <BLU436-SMTP227B5758D4862D21D87691DB9B40@phx.gbl>

On 06/03/2015 08:47 AM, Chen Gang wrote:
> On 06/03/2015 08:34 PM, Peter Maydell wrote:
>> On 3 June 2015 at 13:30, Chen Gang <xili_gchen_5257@hotmail.com> wrote:
>>> On 06/03/2015 01:40 AM, Peter Maydell wrote:
>>>> On 30 May 2015 at 22:10, Chen Gang <xili_gchen_5257@hotmail.com> wrote:
>>>>> +#ifdef TARGET_TILEGX
>>>>> +
>>>>> +static uint64_t get_regval(CPUTLGState *env, uint8_t reg)
>>>>> +{
>>>>> +    if (likely(reg < TILEGX_R_COUNT)) {
>>>>> +        return env->regs[reg];
>>>>> +    } else if (reg != TILEGX_R_ZERO) {
>>>>> +        fprintf(stderr, "invalid register r%d for reading.\n", reg);
>>>>> +        g_assert_not_reached();
>>>> You don't appear to be guaranteeing that the register value
>>>> is < TILEGX_R_COUNT anywhere: get_SrcA_X1() and friends
>>>> mask with 0x3f, but that only means you're guaranteed the
>>>> value is between 0 and 63, wherease TILEGX_R_COUNT is 56.
>>>> What does real hardware do if the encoded register value
>>>> is 56..63 ?
>>>>
>>> At present, it will g_assert_not_reached() too.
>> No, it is not possible for hardware to assert!
>>
>>> 56..62 are hidden to
>>> outside. So I did not implement them, either. Need we still implement
>>> them?
>> You must do something. You can't allow guest code (even
>> broken guest code) to make QEMU assert. You need to find
>> out what the hardware does here, and do that.
>>
> OK, what you said sounds reasonable to me. I will check what to do next
> for the 56..62 registers (at present, I guess, we need generate a
> hardware exception, and its default handler will do nothing).

The registers in question are mapped directly to the on-chip
networks.

56 - sn (static network)
57 - idn0 (internal dynamic network, demux 0)
58 - idn1 (internal dynamic network, demux 1)
59 - udn0 (user dynamic network, demux 0)
60 - udn1 (user dynamic network, demux 1)
61 - udn2 (user dynamic network, demux 2)
62 - udn3 (user dynamic network, demux 3)

The "sn" is obsoleted in tilegx so acts just like "zero".

Accessing idn0 or idn1 will generate an IDN_ACCESS exception,
and accessing udn0..udn3 will generate a UDN_ACCESS exception;
either of those becomes a SIGILL to a userspace application
with code ILL_PRVREG.

The tilegx hypervisor uses idn0/idn1 internally, and userspace
applications can use udn0..udn3 after setting up a suitable
hardwall with the kernel (see arch/tile/kernel/hardwall.c), but
you almost certainly don't want to care about any of that.

-- 
Chris Metcalf, EZChip Semiconductor
http://www.ezchip.com

  reply	other threads:[~2015-06-03 15:26 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-30 21:07 [Qemu-devel] [PATCH 00/10 v11] tilegx: Firstly add tilegx target for linux-user Chen Gang
2015-05-30 21:10 ` [Qemu-devel] [PATCH 01/10 v11] linux-user: tilegx: Firstly add architecture related features Chen Gang
2015-06-02 17:06   ` Peter Maydell
2015-06-03 13:06     ` Chen Gang
2015-06-03 14:28       ` Peter Maydell
2015-05-30 21:10 ` [Qemu-devel] [PATCH 02/10 v11] linux-user: Support tilegx architecture in linux-user Chen Gang
2015-06-02 17:40   ` Peter Maydell
2015-06-03 12:30     ` Chen Gang
2015-06-03 12:34       ` Peter Maydell
2015-06-03 12:47         ` Chen Gang
2015-06-03 15:10           ` Chris Metcalf [this message]
2015-06-03 15:19             ` Peter Maydell
2015-06-03 15:20               ` Chris Metcalf
2015-06-04 12:25                 ` Chen Gang
2015-06-04 12:29                   ` Peter Maydell
2015-06-04 12:39                     ` Chen Gang
2015-06-03 15:47         ` Richard Henderson
2015-06-04 12:32           ` Chen Gang
2015-07-07  0:19             ` Chris Metcalf
2015-07-07 20:47               ` Chen Gang
2015-07-07 20:50               ` Chen Gang
2015-07-08 19:24             ` Chris Metcalf
     [not found]               ` <559DC775.9080204@hotmail.com>
2015-07-09  1:09                 ` gchen gchen
2015-05-30 21:12 ` [Qemu-devel] [PATCH 03/10 v11] linux-user/syscall.c: conditionalize syscalls which are not defined in tilegx Chen Gang
2015-06-02 17:41   ` Peter Maydell
2015-05-30 21:13 ` [Qemu-devel] [PATCH 04/10 v11] target-tilegx: Add opcode basic implementation from Tilera Corporation Chen Gang
2015-06-02 17:42   ` Peter Maydell
2015-05-30 21:14 ` [Qemu-devel] [PATCH 05/10 v11] arget-tilegx/opcode_tilegx.h: Modify it to fit qemu using Chen Gang
2015-06-02 17:43   ` Peter Maydell
2015-06-02 23:39     ` Andreas Färber
2015-06-03 11:59       ` Chen Gang
2015-05-30 21:15 ` [Qemu-devel] [PATCH 06/10 v11] target-tilegx: Add special register information from Tilera Corporation Chen Gang
2015-06-02 17:44   ` Peter Maydell
2015-06-02 20:52     ` Chen Gang
2015-06-02 20:53     ` Chen Gang
2015-05-30 21:15 ` [Qemu-devel] [PATCH 07/10 v11] target-tilegx: Add cpu basic features for linux-user Chen Gang
2015-06-02 17:51   ` Peter Maydell
2015-06-02 20:47     ` Chen Gang
2015-05-30 21:17 ` [Qemu-devel] [PATCH 08/10 v11] target-tilegx: Add several helpers for instructions translation Chen Gang
2015-06-01 16:02   ` Richard Henderson
2015-06-01 18:47     ` Chen Gang
2015-05-30 21:18 ` [Qemu-devel] [PATCH 09/10 v11] target-tilegx: Generate tcg instructions to finish "Hello world" Chen Gang
2015-06-01 18:40   ` Richard Henderson
2015-06-01 20:54     ` Chen Gang
2015-06-02 16:32       ` Richard Henderson
2015-06-02 21:30         ` Chen Gang
2015-06-07 22:20       ` Chen Gang
2015-06-02 17:54   ` Peter Maydell
2015-06-02 20:25     ` Chen Gang
2015-05-30 21:19 ` [Qemu-devel] [PATCH 10/10 v11] target-tilegx: Add TILE-Gx building files Chen Gang
2015-06-02 17:52   ` Peter Maydell
2015-06-02 20:26     ` Chen Gang

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=556F18D7.7010905@ezchip.com \
    --to=cmetcalf@ezchip.com \
    --cc=afaerber@suse.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=rth@twiddle.net \
    --cc=walt@tilera.com \
    --cc=xili_gchen_5257@hotmail.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 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.