From patchwork Sun Jan 15 21:03:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 9517703 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 8F5FC601D8 for ; Sun, 15 Jan 2017 21:04:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B30D283FB for ; Sun, 15 Jan 2017 21:04:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D56328401; Sun, 15 Jan 2017 21:04:37 +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, 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 AA5B1283FB for ; Sun, 15 Jan 2017 21:04:36 +0000 (UTC) Received: from localhost ([::1]:52911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cSryc-00031y-DH for patchwork-qemu-devel@patchwork.kernel.org; Sun, 15 Jan 2017 16:04:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cSryM-00031i-CO for qemu-devel@nongnu.org; Sun, 15 Jan 2017 16:04:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cSryJ-00019e-8U for qemu-devel@nongnu.org; Sun, 15 Jan 2017 16:04:18 -0500 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:35983) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cSryJ-00018y-3I for qemu-devel@nongnu.org; Sun, 15 Jan 2017 16:04:15 -0500 Received: by mail-pg0-x243.google.com with SMTP id 75so3578576pgf.3 for ; Sun, 15 Jan 2017 13:04:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=D+e8g4NOWYn+HoeCcPAygTiJexynH7LyRfsyvkGYeR0=; b=L7Krsq6GuuFls/qV5W06MP5RewhoaeAV9Vr2kNWVoFd18L/yOO+hm+Uh+taWER6pak Fs1o6I9PHsQmFNZjJ9W1xZTNPDGQzn8dk5IioroOHVI6AG9ylVpfcmLrE/0TFjyEszLx 7PTxXqhSe86cxFOhC/ysOLuL8No062mfhZM5DDAwqE46s2ePD5S/LOx71+BWbV/p/P26 NweljJy+WQzwj/+m1Fv90ja3ic1hIj6APW3RYDhczSnI+tL/0/06+8erp9E/RaWKEKED Q4pTVe7GW2yB5ZEejZkX7bMlV6ChI5ToJH8j751FgC5Pp9zZhqPS4HxVH2rFeYWF+gaQ fkZg== 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; bh=D+e8g4NOWYn+HoeCcPAygTiJexynH7LyRfsyvkGYeR0=; b=VblzJtaQuBNVrFQt8C4F6Mk/BUcgk5Joy5BeIH0jxLBEaT/ICGeVm3h9c4b8f8tgfb UC1BEQrzUKaoOty75VKfs87tdvxEQOlietftpGqUxVY4xAdKpBJi9hc9OLzrdT2PmPYH hLeXTLdCdEY1HJvgNsV3ElAvMzNKGr6xTiuhir8MQ3XKRXtVoEaFZdYoHedkVNLwbTn4 1mTlNAlXdJ5zk2bvUQr3CagJ7LJJlO0ealPmhND0avAH41NHiCUKBbPFMIgRHjZpukS8 +6TDW2r3tzJTEvK+unIFF8t0AKTQhwTjhRSxonAfOdTN2XCAKBdDWq3IXFMi8u4DtpA1 uPSw== X-Gm-Message-State: AIkVDXL/JRFFxKkyWPEXCh17FKbRE5T91UZ/Pb0qUBnpIM3mfv7jGvzGfOdyFm9pUbLqNA== X-Received: by 10.84.209.203 with SMTP id y69mr45335211plh.115.1484514253825; Sun, 15 Jan 2017 13:04:13 -0800 (PST) Received: from octofox.net (c-73-202-152-109.hsd1.ca.comcast.net. [73.202.152.109]) by smtp.gmail.com with ESMTPSA id 66sm853491pgg.47.2017.01.15.13.04.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 15 Jan 2017 13:04:13 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Date: Sun, 15 Jan 2017 13:03:56 -0800 Message-Id: <1484514236-11584-1-git-send-email-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.1.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::243 Subject: [Qemu-devel] [PATCH] target/xtensa: add static vectors selection 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 Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Xtensa cores may have two distinct addresses for the static vectors group. Provide a function to select one of them. Signed-off-by: Max Filippov --- target/xtensa/cpu.c | 2 +- target/xtensa/cpu.h | 10 +++++++++- target/xtensa/overlay_tool.h | 11 ++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index e8e9f91..09b53c7 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -60,7 +60,7 @@ static void xtensa_cpu_reset(CPUState *s) xcc->parent_reset(s); env->exception_taken = 0; - env->pc = env->config->exception_vector[EXC_RESET]; + env->pc = env->config->exception_vector[EXC_RESET0 + env->static_vectors]; env->sregs[LITBASE] &= ~1; env->sregs[PS] = xtensa_option_enabled(env->config, XTENSA_OPTION_INTERRUPT) ? 0x1f : 0x10; diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 7fe82a3..6b044d3 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -209,7 +209,8 @@ enum { enum { /* Static vectors */ - EXC_RESET, + EXC_RESET0, + EXC_RESET1, EXC_MEMORY_ERROR, /* Dynamic vectors */ @@ -373,6 +374,7 @@ typedef struct CPUXtensaState { int64_t halt_clock; int exception_taken; + unsigned static_vectors; /* Watchpoints for DBREAK registers */ struct CPUWatchpoint *cpu_watchpoint[MAX_NDBREAK]; @@ -461,6 +463,12 @@ void reset_mmu(CPUXtensaState *env); void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUXtensaState *env); void debug_exception_env(CPUXtensaState *new_env, uint32_t cause); +static inline void xtensa_select_static_vectors(CPUXtensaState *env, + unsigned n) +{ + assert(n < 2); + env->static_vectors = n; +} #define XTENSA_OPTION_BIT(opt) (((uint64_t)1) << (opt)) #define XTENSA_OPTION_ALL (~(uint64_t)0) diff --git a/target/xtensa/overlay_tool.h b/target/xtensa/overlay_tool.h index e8a7fda..5357142 100644 --- a/target/xtensa/overlay_tool.h +++ b/target/xtensa/overlay_tool.h @@ -47,6 +47,14 @@ #define XCHAL_VECBASE_RESET_VADDR 0 #endif +#ifndef XCHAL_RESET_VECTOR0_VADDR +#define XCHAL_RESET_VECTOR0_VADDR XCHAL_RESET_VECTOR_VADDR +#endif + +#ifndef XCHAL_RESET_VECTOR1_VADDR +#define XCHAL_RESET_VECTOR1_VADDR XCHAL_RESET_VECTOR_VADDR +#endif + #ifndef XCHAL_HW_MIN_VERSION #define XCHAL_HW_MIN_VERSION 0 #endif @@ -133,7 +141,8 @@ #endif #define EXCEPTION_VECTORS { \ - [EXC_RESET] = XCHAL_RESET_VECTOR_VADDR, \ + [EXC_RESET0] = XCHAL_RESET_VECTOR0_VADDR, \ + [EXC_RESET1] = XCHAL_RESET_VECTOR1_VADDR, \ WINDOW_VECTORS \ [EXC_KERNEL] = XCHAL_KERNEL_VECTOR_VADDR, \ [EXC_USER] = XCHAL_USER_VECTOR_VADDR, \