From patchwork Sat Nov 4 03:45:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 10041423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2F0FD6032A for ; Sat, 4 Nov 2017 03:51:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2156029A97 for ; Sat, 4 Nov 2017 03:51:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15EA829ADC; Sat, 4 Nov 2017 03:51:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, HK_RANDOM_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C39329356 for ; Sat, 4 Nov 2017 03:51:05 +0000 (UTC) Received: from localhost ([::1]:39216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eApU8-0000Vt-OR for patchwork-qemu-devel@patchwork.kernel.org; Fri, 03 Nov 2017 23:51:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eApPi-0006HE-Lc for qemu-devel@nongnu.org; Fri, 03 Nov 2017 23:46:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eApPh-00013m-4U for qemu-devel@nongnu.org; Fri, 03 Nov 2017 23:46:30 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:54804) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eApPg-00012m-PT for qemu-devel@nongnu.org; Fri, 03 Nov 2017 23:46:29 -0400 Received: by mail-lf0-x241.google.com with SMTP id a2so5140276lfh.11 for ; Fri, 03 Nov 2017 20:46:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B2+MJCGLPg/KkqEUtX+ZraOxkIPHLanhlHjQLj3U5Qk=; b=nvH94PTe314o/YyPttdTj8LAspYpb6IJbiaenhvrAjkytRKtgdVKwtOEqw6VShXOWa 9X9mCKQL/9n2B9bWx9M/tCcZOZSbZP4W+B0rlr4YdGoUwst9wpleby7kWpWaRqf7biAs MHN1L26Zw2MIMn3fusZHki+IKucOb0G+jRs2h1Dbsy5pnuEPMHqyLHiH57Ngs4XUovVf 2qHpVy8+rZKD98yPU1UQX/JBNF6uyLEvOVTACb/FHq7R8SIFBSyoAPJK99rYu8LzHG3S R0F9jYs62B6TMHSl3K8Y6ZeRN5y+BOZoJ4kGUe0TcJVwmu7eZSIq3uy/Q3RoeycvJ0ct Tr8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B2+MJCGLPg/KkqEUtX+ZraOxkIPHLanhlHjQLj3U5Qk=; b=q7tYs+LkUyaJOZhI4Wknuh8n7gXc/NLoErSxSuDNavCJfMwNuus/qb0j+79n6Zb46c k9vKUKHuRb1bg23af/ic6KZsHUDfKGKB8MpJPj33Bas/dj9filSCgykmpe7Xqg+wA+2h 7PdKY44/tSGTpos4+OD8Nnkbr8xXQjh6lITyFbp2S4bkdPF2z9CzFsc/1TvuLa7UYp+n 9Zf7eXstPMgsxgyL1rrWhTYIUt/1GAwST1NwawjkQeTiGVXRWCZC7QP1zErzvbyKgyM+ QAKFEUWrGyiVdnVwFDhJI1/Z6M2cKE88d605WeWa99d4UYNt+Du2lHH8zQq7A9gWgSv6 /BcQ== X-Gm-Message-State: AJaThX5WqeZSwkfJEHZHnoaWUTVZJX1akgWAH8TAKwoX7Hh2Wav6hQFD y2HVWJx8vNZwE9yMWjGcOsEECA== X-Google-Smtp-Source: ABhQp+SisrYrPrj2KrgJxczlTpQme450Z1WbdrUntUvBLqElMxzNvKta5t/a/pbbTt2uCo/cCY3ZJg== X-Received: by 10.25.211.84 with SMTP id k81mr3261180lfg.120.1509767187329; Fri, 03 Nov 2017 20:46:27 -0700 (PDT) Received: from octofox.net (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id h3sm1258383lfj.26.2017.11.03.20.46.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Nov 2017 20:46:26 -0700 (PDT) From: Max Filippov To: qemu-devel@nongnu.org Date: Fri, 3 Nov 2017 20:45:19 -0700 Message-Id: <1509767121-26925-15-git-send-email-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1509767121-26925-1-git-send-email-jcmvbkbc@gmail.com> References: <1509767121-26925-1-git-send-email-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH 14/16] target/xtensa: implement GPIO32 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP GPIO32 is not in the core ISA, but it was widely used in Diamond Cores. This implementation doesn't do actual I/O and doesn't handle the case of GPIO32 state being a part of coprocessor. Signed-off-by: Max Filippov --- target/xtensa/cpu.h | 1 + target/xtensa/translate.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index fae6d586d5cf..2a7bb099d52b 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -108,6 +108,7 @@ enum { }; enum { + EXPSTATE = 230, THREADPTR = 231, FCR = 232, FSR = 233, diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index da1f712badc7..a84bbf3bedc3 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -204,6 +204,7 @@ static const XtensaReg sregnames[256] = { }; static const XtensaReg uregnames[256] = { + [EXPSTATE] = XTENSA_REG_BITS("EXPSTATE", XTENSA_OPTION_ALL), [THREADPTR] = XTENSA_REG("THREADPTR", XTENSA_OPTION_THREAD_POINTER), [FCR] = XTENSA_REG("FCR", XTENSA_OPTION_FP_COPROCESSOR), [FSR] = XTENSA_REG("FSR", XTENSA_OPTION_FP_COPROCESSOR), @@ -1518,6 +1519,13 @@ static void translate_clamps(DisasContext *dc, const uint32_t arg[], } } +static void translate_clrb_expstate(DisasContext *dc, const uint32_t arg[], + const uint32_t par[]) +{ + /* TODO: GPIO32 may be a part of coprocessor */ + tcg_gen_andi_i32(cpu_UR[EXPSTATE], cpu_UR[EXPSTATE], ~(1u << arg[0])); +} + /* par[0]: privileged, par[1]: check memory access */ static void translate_dcache(DisasContext *dc, const uint32_t arg[], const uint32_t par[]) @@ -2013,6 +2021,15 @@ static void translate_quou(DisasContext *dc, const uint32_t arg[], } } +static void translate_read_impwire(DisasContext *dc, const uint32_t arg[], + const uint32_t par[]) +{ + if (gen_window_check1(dc, arg[0])) { + /* TODO: GPIO32 may be a part of coprocessor */ + tcg_gen_movi_i32(cpu_R[arg[0]], 0); + } +} + static void translate_rer(DisasContext *dc, const uint32_t arg[], const uint32_t par[]) { @@ -2157,6 +2174,13 @@ static void translate_rur(DisasContext *dc, const uint32_t arg[], } } +static void translate_setb_expstate(DisasContext *dc, const uint32_t arg[], + const uint32_t par[]) +{ + /* TODO: GPIO32 may be a part of coprocessor */ + tcg_gen_ori_i32(cpu_UR[EXPSTATE], cpu_UR[EXPSTATE], 1u << arg[0]); +} + static void translate_s32c1i(DisasContext *dc, const uint32_t arg[], const uint32_t par[]) { @@ -2445,6 +2469,15 @@ static void translate_wer(DisasContext *dc, const uint32_t arg[], } } +static void translate_wrmsk_expstate(DisasContext *dc, const uint32_t arg[], + const uint32_t par[]) +{ + if (gen_window_check2(dc, arg[0], arg[1])) { + /* TODO: GPIO32 may be a part of coprocessor */ + tcg_gen_and_i32(cpu_UR[EXPSTATE], cpu_R[arg[0]], cpu_R[arg[1]]); + } +} + static void translate_wsr(DisasContext *dc, const uint32_t arg[], const uint32_t par[]) { @@ -2706,6 +2739,9 @@ static const XtensaOpcodeOps core_ops[] = { .name = "clamps", .translate = translate_clamps, }, { + .name = "clrb_expstate", + .translate = translate_clrb_expstate, + }, { .name = "depbits", .translate = translate_depbits, }, { @@ -3268,6 +3304,9 @@ static const XtensaOpcodeOps core_ops[] = { .translate = translate_rtlb, .par = (const uint32_t[]){true, 1}, }, { + .name = "read_impwire", + .translate = translate_read_impwire, + }, { .name = "rems", .translate = translate_quos, .par = (const uint32_t[]){false}, @@ -3635,6 +3674,10 @@ static const XtensaOpcodeOps core_ops[] = { .name = "rsync", .translate = translate_nop, }, { + .name = "rur.expstate", + .translate = translate_rur, + .par = (const uint32_t[]){EXPSTATE}, + }, { .name = "rur.fcr", .translate = translate_rur, .par = (const uint32_t[]){FCR}, @@ -3685,6 +3728,9 @@ static const XtensaOpcodeOps core_ops[] = { .translate = translate_salt, .par = (const uint32_t[]){TCG_COND_LTU}, }, { + .name = "setb_expstate", + .translate = translate_setb_expstate, + }, { .name = "sext", .translate = translate_sext, }, { @@ -3775,6 +3821,9 @@ static const XtensaOpcodeOps core_ops[] = { .translate = translate_wtlb, .par = (const uint32_t[]){false}, }, { + .name = "wrmsk_expstate", + .translate = translate_wrmsk_expstate, + }, { .name = "wsr.176", .translate = translate_wsr, .par = (const uint32_t[]){176}, @@ -4083,6 +4132,10 @@ static const XtensaOpcodeOps core_ops[] = { .translate = translate_wsr, .par = (const uint32_t[]){WINDOW_START}, }, { + .name = "wur.expstate", + .translate = translate_wur, + .par = (const uint32_t[]){EXPSTATE}, + }, { .name = "wur.fcr", .translate = translate_wur, .par = (const uint32_t[]){FCR},